faMatrix.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9  Copyright (C) 2020-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::faMatrix
29 
30 Description
31  Finite-Area matrix.
32 
33 SourceFiles
34  faMatrix.C
35  faMatrixSolve.C
36 
37 Author
38  Zeljko Tukovic, FMENA
39  Hrvoje Jasak, Wikki Ltd.
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef Foam_faMatrix_H
44 #define Foam_faMatrix_H
45 
46 #include "areaFields.H"
47 #include "edgeFields.H"
48 #include "lduMatrix.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward Declarations
56 template<class Type> class faMatrix;
57 template<class T> class UIndirectList;
58 
59 template<class Type>
60 Ostream& operator<<(Ostream&, const faMatrix<Type>&);
61 
62 template<class Type>
64 (
65  const faMatrix<Type>&,
67 );
68 
69 template<class Type>
71 (
72  const faMatrix<Type>&,
74 );
75 
76 template<class Type>
78 (
79  const faMatrix<Type>&,
81 );
82 
83 template<class Type>
85 (
86  const tmp<faMatrix<Type>>&,
88 );
89 
90 template<class Type>
92 (
93  const tmp<faMatrix<Type>>&,
95 );
96 
97 template<class Type>
99 (
100  const tmp<faMatrix<Type>>&,
102 );
103 
104 /*---------------------------------------------------------------------------*\
105  Class faMatrix Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 template<class Type>
109 class faMatrix
110 :
111  public refCount,
112  public lduMatrix
113 {
114 public:
115 
116  // Public Types
117 
118  //- The geometric field type for psi
119  typedef
121  psiFieldType;
122 
123  //- Field type for face flux (for non-orthogonal correction)
124  typedef
127 
130 
131 private:
132 
133  // Private Data
134 
135  //- Const reference to field
136  // Converted into a non-const reference at the point of solution.
137  const psiFieldType& psi_;
138 
139  //- Dimension set
140  dimensionSet dimensions_;
141 
142  //- Source term
143  Field<Type> source_;
144 
145  //- Boundary scalar field containing pseudo-matrix coeffs
146  //- for internal faces
147  FieldField<Field, Type> internalCoeffs_;
148 
149  //- Boundary scalar field containing pseudo-matrix coeffs
150  //- for boundary faces
151  FieldField<Field, Type> boundaryCoeffs_;
152 
153  //- Face flux field for non-orthogonal correction
154  mutable std::unique_ptr<faceFluxFieldType> faceFluxCorrectionPtr_;
155 
156 
157 protected:
158 
159  //- Declare friendship with the faSolver class
160  friend class faSolver;
161 
162 
163  // Protected Member Functions
164 
165  //- Add patch contribution to internal field
166  template<class Type2>
167  void addToInternalField
168  (
169  const labelUList& addr,
170  const Field<Type2>& pf,
171  Field<Type2>& intf
172  ) const;
173 
174  template<class Type2>
175  void addToInternalField
176  (
177  const labelUList& addr,
178  const tmp<Field<Type2>>& tpf,
179  Field<Type2>& intf
180  ) const;
181 
182  //- Subtract patch contribution from internal field
183  template<class Type2>
185  (
186  const labelUList& addr,
187  const Field<Type2>& pf,
188  Field<Type2>& intf
189  ) const;
190 
191  template<class Type2>
193  (
194  const labelUList& addr,
195  const tmp<Field<Type2>>& tpf,
196  Field<Type2>& intf
197  ) const;
198 
199 
200  // Matrix completion functionality
201 
202  void addBoundaryDiag
203  (
204  scalarField& diag,
205  const direction cmpt
206  ) const;
207 
209 
210  void addBoundarySource
211  (
213  const bool couples = true
214  ) const;
215 
216 
217  // Matrix manipulation functionality
218 
219  //- Set solution in given faces to the specified values
220  template<template<class> class ListType>
221  void setValuesFromList
222  (
223  const labelUList& faceLabels,
224  const ListType<Type>& values
225  );
226 
227 
228 public:
229 
230  //- Solver class returned by the solver function
231  //- used for systems in which it is useful to cache the solver for reuse.
232  class faSolver
233  {
234  faMatrix<Type>& faMat_;
235 
237 
238  public:
239 
240  // Constructors
241 
243  :
244  faMat_(faMat),
245  solver_(std::move(sol))
246  {}
247 
248 
249  // Member Functions
250 
251  //- Solve returning the solution statistics.
252  // Solver controls read from dictionary
253  SolverPerformance<Type> solve(const dictionary& solverControls);
255  //- Solve returning the solution statistics.
256  // Solver controls read from faSolution
258  };
259 
260 
261  // Runtime information
262  ClassName("faMatrix");
263 
265  // Constructors
266 
267  //- Construct given a field to solve for
268  faMatrix
269  (
271  const dimensionSet& ds
272  );
273 
274  //- Copy construct
275  faMatrix(const faMatrix<Type>&);
276 
277  //- Copy/move construct from tmp<faMatrix<Type>>
278  faMatrix(const tmp<faMatrix<Type>>&);
279 
280  //- Deprecated(2022-05) - construct with dimensionSet instead
281  // \deprecated(2022-05) - construct with dimensionSet instead
282  FOAM_DEPRECATED_FOR(2022-05, "Construct with dimensionSet")
283  faMatrix
284  (
285  const GeometricField<Type, faPatchField, areaMesh>& psi,
286  Istream& is
287  )
288  :
289  faMatrix<Type>(psi, dimensionSet(is))
290  {}
291 
292  //- Construct and return a clone
293  tmp<faMatrix<Type>> clone() const
294  {
295  return tmp<faMatrix<Type>>::New(*this);
296  }
297 
298 
299  //- Destructor
300  virtual ~faMatrix();
301 
302 
303  // Member Functions
304 
305  // Access
306 
308  {
309  return psi_;
310  }
311 
312  const dimensionSet& dimensions() const noexcept
313  {
314  return dimensions_;
315  }
316 
317  Field<Type>& source() noexcept
318  {
319  return source_;
320  }
322  const Field<Type>& source() const noexcept
323  {
324  return source_;
325  }
326 
327  //- faBoundary scalar field containing pseudo-matrix coeffs
328  //- for internal cells
330  {
331  return internalCoeffs_;
332  }
333 
334  //- faBoundary scalar field containing pseudo-matrix coeffs
335  //- for internal cells
337  {
338  return internalCoeffs_;
339  }
340 
341  //- faBoundary scalar field containing pseudo-matrix coeffs
342  //- for boundary cells
343  const FieldField<Field, Type>& boundaryCoeffs() const noexcept
344  {
345  return boundaryCoeffs_;
346  }
347 
348  //- faBoundary scalar field containing pseudo-matrix coeffs
349  //- for boundary cells
351  {
352  return boundaryCoeffs_;
353  }
354 
355  //- Declare return type of the faceFluxCorrectionPtr() function
356  typedef std::unique_ptr<faceFluxFieldType> faceFluxFieldPtrType;
357 
358  //- Return pointer to face-flux non-orthogonal correction field
360  {
361  return faceFluxCorrectionPtr_;
362  }
364  //- Set pointer to face-flux non-orthogonal correction field
366  {
367  faceFluxCorrectionPtr_.reset(flux);
368  }
369 
370  //- True if face-flux non-orthogonal correction field exists
371  bool hasFaceFluxCorrection() const noexcept
372  {
373  return bool(faceFluxCorrectionPtr_);
374  }
375 
376 
377  // Operations
378 
379  //- Set solution in given faces to the specified value
380  //- and eliminate the corresponding equations from the matrix.
382  (
383  const labelUList& faceLabels,
384  const Type& value
385  );
386 
387  //- Set solution in given faces to the specified values
388  //- and eliminate the corresponding equations from the matrix.
389  void setValues
390  (
391  const labelUList& faceLabels,
392  const UList<Type>& values
393  );
394 
395  //- Set solution in given faces to the specified values
396  //- and eliminate the corresponding equations from the matrix.
397  void setValues
398  (
401  );
402 
403  //- Set reference level for solution
404  void setReference
405  (
406  const label facei,
407  const Type& value,
408  const bool forceReference = false
409  );
410 
411  //- Set reference level for solution
413  (
414  const labelUList& faceLabels,
415  const Type& value,
416  const bool forceReference = false
417  );
418 
419  //- Set reference level for solution
421  (
422  const labelUList& faceLabels,
423  const UList<Type>& values,
424  const bool forceReference = false
425  );
426 
427  //- Set reference level for a component of the solution
428  //- on a given patch face
430  (
431  const label patchi,
432  const label facei,
433  const direction cmpt,
434  const scalar value
435  );
436 
437  //- Relax matrix (for steady-state solution).
438  // alpha = 1 : diagonally equal
439  // alpha < 1 : ,, dominant
440  // alpha = 0 : do nothing
441  // Note: Requires positive diagonal.
442  void relax(const scalar alpha);
443 
444  //- Relax matrix (for steady-state solution).
445  // alpha is read from controlDict
446  void relax();
447 
448  //- Solve returning the solution statistics.
449  // Use the given solver controls
451 
452  //- Solve returning the solution statistics.
453  // Uses \p name solver controls from faSolution
455 
456  //- Solve returning the solution statistics.
457  // Solver controls read from faSolution
459 
460  //- Return the matrix residual
461  tmp<Field<Type>> residual() const;
462 
463  //- Return the matrix diagonal
464  tmp<scalarField> D() const;
465 
466  //- Return the central coefficient
467  tmp<areaScalarField> A() const;
468 
469  //- Return the H operation source
471 
472  //- Return the face-flux field from the matrix
474 
475  //- Return the solver dictionary (from faSolution) for \p name
476  const dictionary& solverDict(const word& name) const;
477 
478  //- Return the solver dictionary for psi
479  const dictionary& solverDict() const;
480 
481 
482  // Member Operators
483 
484  void operator=(const faMatrix<Type>&);
485  void operator=(const tmp<faMatrix<Type>>&);
486 
487  //- Inplace negate
488  void negate();
489 
490  void operator+=(const faMatrix<Type>&);
491  void operator+=(const tmp<faMatrix<Type>>&);
492 
493  void operator-=(const faMatrix<Type>&);
494  void operator-=(const tmp<faMatrix<Type>>&);
495 
498  void operator+=
499  (
501  );
502 
505  void operator-=
506  (
508  );
509 
510  void operator+=(const dimensioned<Type>&);
511  void operator-=(const dimensioned<Type>&);
512 
513  void operator+=(const Foam::zero) {}
514  void operator-=(const Foam::zero) {}
515 
517  void operator*=(const tmp<areaScalarField::Internal>&);
518  void operator*=(const tmp<areaScalarField>&);
519 
520  void operator*=(const dimensioned<scalar>&);
521 
522 
523  // Friend Operators
524 
525  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
526  operator& <Type>
527  (
528  const faMatrix<Type>&,
529  const DimensionedField<Type, areaMesh>&
530  );
531 
532  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
533  operator& <Type>
534  (
535  const faMatrix<Type>&,
536  const tmp<GeometricField<Type, faPatchField, areaMesh>>&
537  );
538 
539  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
540  operator& <Type>
541  (
542  const tmp<faMatrix<Type>>&,
543  const DimensionedField<Type, areaMesh>&
544  );
545 
546  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
547  operator& <Type>
548  (
549  const tmp<faMatrix<Type>>&,
550  const tmp<GeometricField<Type, faPatchField, areaMesh>>&
551  );
552 
553 
554  // Ostream Operator
555 
556  friend Ostream& operator<< <Type>
557  (
558  Ostream&,
559  const faMatrix<Type>&
560  );
561 };
562 
563 
564 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
565 
566 template<class Type>
567 void checkMethod
568 (
569  const faMatrix<Type>&,
570  const faMatrix<Type>&,
571  const char*
572 );
573 
574 template<class Type>
575 void checkMethod
576 (
577  const faMatrix<Type>&,
578  const DimensionedField<Type, areaMesh>&,
579  const char*
580 );
581 
582 template<class Type>
583 void checkMethod
584 (
585  const faMatrix<Type>&,
586  const dimensioned<Type>&,
587  const char*
588 );
589 
590 
591 //- Solve returning the solution statistics given convergence tolerance
592 // Use the given solver controls
593 template<class Type>
594 SolverPerformance<Type> solve
595 (
596  faMatrix<Type>&,
597  const dictionary& solverControls
598 );
599 
600 //- Solve returning the solution statistics given convergence tolerance,
601 //- deleting temporary matrix after solution.
602 // Use the given solver controls
603 template<class Type>
604 SolverPerformance<Type> solve
605 (
606  const tmp<faMatrix<Type>>&,
607  const dictionary& solverControls
608 );
609 
610 
611 //- Solve returning the solution statistics given convergence tolerance
612 // Uses \p name solver controls from faSolution
613 template<class Type>
614 SolverPerformance<Type> solve(faMatrix<Type>&, const word& name);
616 //- Solve returning the solution statistics given convergence tolerance,
617 //- deleting temporary matrix after solution.
618 // Uses \p name solver controls from faSolution
619 template<class Type>
621 
622 
623 //- Solve returning the solution statistics given convergence tolerance
624 // Uses solver controls from faSolution
625 template<class Type>
627 
628 //- Solve returning the solution statistics given convergence tolerance,
629 //- deleting temporary matrix after solution.
630 // Uses solver controls from faSolution
631 template<class Type>
633 
634 
635 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
636 
637 //- Unary negation
638 template<class Type>
639 tmp<faMatrix<Type>> operator-
640 (
641  const faMatrix<Type>&
642 );
643 
644 //- Unary negation
645 template<class Type>
646 tmp<faMatrix<Type>> operator-
647 (
648  const tmp<faMatrix<Type>>&
649 );
650 
651 
652 template<class Type>
653 tmp<faMatrix<Type>> operator+
654 (
655  const faMatrix<Type>&,
656  const faMatrix<Type>&
657 );
658 
659 template<class Type>
660 tmp<faMatrix<Type>> operator+
661 (
662  const tmp<faMatrix<Type>>&,
663  const faMatrix<Type>&
664 );
665 
666 template<class Type>
667 tmp<faMatrix<Type>> operator+
668 (
669  const faMatrix<Type>&,
670  const tmp<faMatrix<Type>>&
671 );
672 
673 template<class Type>
674 tmp<faMatrix<Type>> operator+
675 (
676  const tmp<faMatrix<Type>>&,
677  const tmp<faMatrix<Type>>&
678 );
679 
680 
681 template<class Type>
682 tmp<faMatrix<Type>> operator-
683 (
684  const faMatrix<Type>&,
685  const faMatrix<Type>&
686 );
687 
688 template<class Type>
689 tmp<faMatrix<Type>> operator-
690 (
691  const tmp<faMatrix<Type>>&,
692  const faMatrix<Type>&
693 );
694 
695 template<class Type>
696 tmp<faMatrix<Type>> operator-
697 (
698  const faMatrix<Type>&,
699  const tmp<faMatrix<Type>>&
700 );
701 
702 template<class Type>
703 tmp<faMatrix<Type>> operator-
704 (
705  const tmp<faMatrix<Type>>&,
706  const tmp<faMatrix<Type>>&
707 );
708 
709 
710 template<class Type>
711 tmp<faMatrix<Type>> operator==
712 (
713  const faMatrix<Type>&,
714  const faMatrix<Type>&
715 );
716 
717 template<class Type>
718 tmp<faMatrix<Type>> operator==
719 (
720  const tmp<faMatrix<Type>>&,
721  const faMatrix<Type>&
722 );
723 
724 template<class Type>
725 tmp<faMatrix<Type>> operator==
726 (
727  const faMatrix<Type>&,
728  const tmp<faMatrix<Type>>&
729 );
730 
731 template<class Type>
732 tmp<faMatrix<Type>> operator==
733 (
734  const tmp<faMatrix<Type>>&,
735  const tmp<faMatrix<Type>>&
736 );
737 
738 
739 template<class Type>
740 tmp<faMatrix<Type>> operator+
741 (
742  const faMatrix<Type>&,
744 );
745 
746 template<class Type>
747 tmp<faMatrix<Type>> operator+
748 (
749  const faMatrix<Type>&,
751 );
752 
753 template<class Type>
754 tmp<faMatrix<Type>> operator+
755 (
756  const faMatrix<Type>&,
758 );
759 
760 template<class Type>
761 tmp<faMatrix<Type>> operator+
762 (
763  const tmp<faMatrix<Type>>&,
765 );
766 
767 template<class Type>
768 tmp<faMatrix<Type>> operator+
769 (
770  const tmp<faMatrix<Type>>&,
772 );
773 
774 template<class Type>
775 tmp<faMatrix<Type>> operator+
776 (
777  const tmp<faMatrix<Type>>&,
779 );
780 
781 template<class Type>
782 tmp<faMatrix<Type>> operator+
783 (
785  const faMatrix<Type>&
786 );
787 
788 template<class Type>
789 tmp<faMatrix<Type>> operator+
790 (
792  const faMatrix<Type>&
793 );
794 
795 template<class Type>
796 tmp<faMatrix<Type>> operator+
797 (
799  const faMatrix<Type>&
800 );
801 
802 template<class Type>
803 tmp<faMatrix<Type>> operator+
804 (
806  const tmp<faMatrix<Type>>&
807 );
808 
809 template<class Type>
810 tmp<faMatrix<Type>> operator+
811 (
813  const tmp<faMatrix<Type>>&
814 );
815 
816 template<class Type>
817 tmp<faMatrix<Type>> operator+
818 (
820  const tmp<faMatrix<Type>>&
821 );
822 
823 template<class Type>
824 tmp<faMatrix<Type>> operator-
825 (
826  const faMatrix<Type>&,
828 );
829 
830 template<class Type>
831 tmp<faMatrix<Type>> operator-
832 (
833  const faMatrix<Type>&,
835 );
836 
837 template<class Type>
838 tmp<faMatrix<Type>> operator-
839 (
840  const faMatrix<Type>&,
842 );
843 
844 template<class Type>
845 tmp<faMatrix<Type>> operator-
846 (
847  const tmp<faMatrix<Type>>&,
849 );
850 
851 template<class Type>
852 tmp<faMatrix<Type>> operator-
853 (
854  const tmp<faMatrix<Type>>&,
856 );
857 
858 template<class Type>
859 tmp<faMatrix<Type>> operator-
860 (
861  const tmp<faMatrix<Type>>&,
863 );
864 
865 
866 template<class Type>
867 tmp<faMatrix<Type>> operator-
868 (
870  const faMatrix<Type>&
871 );
872 
873 template<class Type>
874 tmp<faMatrix<Type>> operator-
875 (
877  const faMatrix<Type>&
878 );
879 
880 template<class Type>
881 tmp<faMatrix<Type>> operator-
882 (
884  const faMatrix<Type>&
885 );
886 
887 template<class Type>
888 tmp<faMatrix<Type>> operator-
889 (
891  const tmp<faMatrix<Type>>&
892 );
893 
894 template<class Type>
895 tmp<faMatrix<Type>> operator-
896 (
898  const tmp<faMatrix<Type>>&
899 );
900 
901 template<class Type>
902 tmp<faMatrix<Type>> operator-
903 (
905  const tmp<faMatrix<Type>>&
906 );
907 
908 template<class Type>
909 tmp<faMatrix<Type>> operator+
910 (
911  const faMatrix<Type>&,
912  const dimensioned<Type>&
913 );
914 
915 template<class Type>
916 tmp<faMatrix<Type>> operator+
917 (
918  const tmp<faMatrix<Type>>&,
919  const dimensioned<Type>&
920 );
921 
922 template<class Type>
923 tmp<faMatrix<Type>> operator+
924 (
925  const dimensioned<Type>&,
926  const faMatrix<Type>&
927 );
928 
929 template<class Type>
930 tmp<faMatrix<Type>> operator+
931 (
932  const dimensioned<Type>&,
933  const tmp<faMatrix<Type>>&
934 );
935 
936 template<class Type>
937 tmp<faMatrix<Type>> operator-
938 (
939  const faMatrix<Type>&,
940  const dimensioned<Type>&
941 );
942 
943 template<class Type>
944 tmp<faMatrix<Type>> operator-
945 (
946  const tmp<faMatrix<Type>>&,
947  const dimensioned<Type>&
948 );
949 
950 template<class Type>
951 tmp<faMatrix<Type>> operator-
952 (
953  const dimensioned<Type>&,
954  const faMatrix<Type>&
955 );
956 
957 template<class Type>
958 tmp<faMatrix<Type>> operator-
959 (
960  const dimensioned<Type>&,
961  const tmp<faMatrix<Type>>&
962 );
963 
964 template<class Type>
965 tmp<faMatrix<Type>> operator==
966 (
967  const faMatrix<Type>&,
969 );
970 
971 template<class Type>
972 tmp<faMatrix<Type>> operator==
973 (
974  const faMatrix<Type>&,
976 );
977 
978 template<class Type>
979 tmp<faMatrix<Type>> operator==
980 (
981  const faMatrix<Type>&,
983 );
984 
985 template<class Type>
986 tmp<faMatrix<Type>> operator==
987 (
988  const tmp<faMatrix<Type>>&,
990 );
991 
992 template<class Type>
993 tmp<faMatrix<Type>> operator==
994 (
995  const tmp<faMatrix<Type>>&,
997 );
998 
999 template<class Type>
1000 tmp<faMatrix<Type>> operator==
1001 (
1002  const tmp<faMatrix<Type>>&,
1004 );
1005 
1006 template<class Type>
1007 tmp<faMatrix<Type>> operator==
1008 (
1009  const faMatrix<Type>&,
1010  const dimensioned<Type>&
1011 );
1012 
1013 template<class Type>
1014 tmp<faMatrix<Type>> operator==
1015 (
1016  const tmp<faMatrix<Type>>&,
1017  const dimensioned<Type>&
1018 );
1019 
1020 
1021 template<class Type>
1022 tmp<faMatrix<Type>> operator==
1023 (
1024  const faMatrix<Type>&,
1025  const Foam::zero
1026 );
1027 
1028 template<class Type>
1029 tmp<faMatrix<Type>> operator==
1030 (
1031  const tmp<faMatrix<Type>>&,
1032  const Foam::zero
1033 );
1034 
1035 
1036 template<class Type>
1037 tmp<faMatrix<Type>> operator*
1038 (
1040  const faMatrix<Type>&
1041 );
1042 
1043 template<class Type>
1044 tmp<faMatrix<Type>> operator*
1045 (
1047  const faMatrix<Type>&
1048 );
1049 
1050 template<class Type>
1051 tmp<faMatrix<Type>> operator*
1052 (
1053  const tmp<areaScalarField>&,
1054  const faMatrix<Type>&
1055 );
1056 
1057 template<class Type>
1058 tmp<faMatrix<Type>> operator*
1059 (
1061  const tmp<faMatrix<Type>>&
1062 );
1063 
1064 template<class Type>
1065 tmp<faMatrix<Type>> operator*
1066 (
1068  const tmp<faMatrix<Type>>&
1069 );
1070 
1071 template<class Type>
1072 tmp<faMatrix<Type>> operator*
1073 (
1074  const tmp<areaScalarField>&,
1075  const tmp<faMatrix<Type>>&
1076 );
1077 
1078 
1079 template<class Type>
1080 tmp<faMatrix<Type>> operator*
1081 (
1082  const dimensioned<scalar>&,
1083  const faMatrix<Type>&
1084 );
1085 
1086 template<class Type>
1087 tmp<faMatrix<Type>> operator*
1088 (
1089  const dimensioned<scalar>&,
1090  const tmp<faMatrix<Type>>&
1091 );
1092 
1093 
1094 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1095 
1096 } // End namespace Foam
1097 
1098 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1099 
1100 #ifdef NoRepository
1101  #include "faMatrix.C"
1102 #endif
1103 
1104 // Specialisation for scalars
1105 
1106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1107 
1108 #endif
1109 
1110 // ************************************************************************* //
void negate()
Inplace negate.
Definition: faMatrix.C:794
void setValues(const labelUList &faceLabels, const Type &value)
Set solution in given faces to the specified value and eliminate the corresponding equations from the...
Definition: faMatrix.C:392
faceFluxFieldPtrType & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
Definition: faMatrix.H:412
const scalarField & diag() const
Definition: lduMatrix.C:163
void operator-=(const faMatrix< Type > &)
Definition: faMatrix.C:842
tmp< scalarField > D() const
Return the matrix diagonal.
Definition: faMatrix.C:596
ClassName("faMatrix")
const dimensionSet & dimensions() const noexcept
Definition: faMatrix.H:353
uint8_t direction
Definition: direction.H:46
GeometricField< Type, faPatchField, areaMesh > psiFieldType
The geometric field type for psi.
Definition: faMatrix.H:118
void operator+=(const faMatrix< Type > &)
Definition: faMatrix.C:809
const dictionary & solverDict() const
Return the solver dictionary for psi.
Definition: faMatrix.C:740
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
faMatrix(const GeometricField< Type, faPatchField, areaMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
Definition: faMatrix.C:176
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
Definition: faMatrix.C:33
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution on a given patch face.
Definition: faMatrixSolve.C:32
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
Definition: faMatrix.C:108
Field< Type > & source() noexcept
Definition: faMatrix.H:358
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
void setReferences(const labelUList &faceLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition: faMatrix.C:444
Generic GeometricField class.
Generic dimensioned Type class.
std::unique_ptr< faceFluxFieldType > faceFluxFieldPtrType
Declare return type of the faceFluxCorrectionPtr() function.
Definition: faMatrix.H:407
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:46
labelList faceLabels(nFaceLabels)
DimensionedField< scalar, areaMesh > Internal
The internal field type from which this GeometricField is derived.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
Definition: faMatrix.C:142
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition: faMatrix.H:390
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
const FieldField< Field, Type > & internalCoeffs() const noexcept
faBoundary scalar field containing pseudo-matrix coeffs for internal cells
Definition: faMatrix.H:372
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux() const
Return the face-flux field from the matrix.
Definition: faMatrix.C:660
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
Definition: faMatrix.C:71
SolverPerformance< Type > solve()
Solve returning the solution statistics.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
void relax()
Relax matrix (for steady-state solution).
Definition: faMatrix.C:579
void operator=(const faMatrix< Type > &)
Definition: faMatrix.C:752
void operator*=(const areaScalarField::Internal &)
Definition: faMatrix.C:962
Generic templated field type.
Definition: Field.H:62
A class for handling words, derived from Foam::string.
Definition: word.H:63
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics...
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
Definition: faMatrix.C:1034
faSolver(faMatrix< Type > &faMat, autoPtr< lduMatrix::solver > &&sol)
Definition: faMatrix.H:264
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
Definition: faMatrix.C:624
void setValuesFromList(const labelUList &faceLabels, const ListType< Type > &values)
Set solution in given faces to the specified values.
Definition: faMatrix.C:289
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
bool hasFaceFluxCorrection() const noexcept
True if face-flux non-orthogonal correction field exists.
Definition: faMatrix.H:428
tmp< areaScalarField > A() const
Return the central coefficient.
Definition: faMatrix.C:605
void setReference(const label facei, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition: faMatrix.C:425
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Definition: lduMatrix.H:80
Solver class returned by the solver function used for systems in which it is useful to cache the solv...
Definition: faMatrix.H:254
tmp< Field< Type > > residual() const
Return the matrix residual.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Definition: faMatrix.H:52
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:47
A special matrix type and solver, designed for finite area solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: faMatricesFwd.H:37
GeometricField< Type, faePatchField, edgeMesh > faceFluxFieldType
Field type for face flux (for non-orthogonal correction)
Definition: faMatrix.H:125
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
const GeometricField< Type, faPatchField, areaMesh > & psi() const
Definition: faMatrix.H:348
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
void addCmptAvBoundaryDiag(scalarField &diag) const
Definition: faMatrix.C:126
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< faMatrix< Type > > clone() const
Construct and return a clone.
Definition: faMatrix.H:332
Namespace for OpenFOAM.
virtual ~faMatrix()
Destructor.
Definition: faMatrix.C:277