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 #include "tmp.H"
50 #include "autoPtr.H"
51 #include "dimensionedTypes.H"
52 #include "className.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // Forward Declarations
60 template<class Type> class faMatrix;
61 template<class T> class UIndirectList;
62 
63 template<class Type>
64 Ostream& operator<<(Ostream&, const faMatrix<Type>&);
65 
66 template<class Type>
68 (
69  const faMatrix<Type>&,
71 );
72 
73 template<class Type>
75 (
76  const faMatrix<Type>&,
78 );
79 
80 template<class Type>
82 (
83  const faMatrix<Type>&,
85 );
86 
87 template<class Type>
89 (
90  const tmp<faMatrix<Type>>&,
92 );
93 
94 template<class Type>
96 (
97  const tmp<faMatrix<Type>>&,
99 );
100 
101 template<class Type>
103 (
104  const tmp<faMatrix<Type>>&,
106 );
107 
108 /*---------------------------------------------------------------------------*\
109  Class faMatrix Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 template<class Type>
113 class faMatrix
114 :
115  public refCount,
116  public lduMatrix
117 {
118 public:
119 
120  // Public Types
121 
122  //- The geometric field type for psi
123  typedef
125  psiFieldType;
126 
127  //- Field type for face flux (for non-orthogonal correction)
128  typedef
131 
134 
135 private:
136 
137  // Private Data
138 
139  //- Const reference to field
140  // Converted into a non-const reference at the point of solution.
141  const psiFieldType& psi_;
142 
143  //- Dimension set
144  dimensionSet dimensions_;
145 
146  //- Source term
147  Field<Type> source_;
148 
149  //- Boundary scalar field containing pseudo-matrix coeffs
150  //- for internal faces
151  FieldField<Field, Type> internalCoeffs_;
152 
153  //- Boundary scalar field containing pseudo-matrix coeffs
154  //- for boundary faces
155  FieldField<Field, Type> boundaryCoeffs_;
156 
157  //- Face flux field for non-orthogonal correction
158  mutable faceFluxFieldType* faceFluxCorrectionPtr_;
159 
160 
161 protected:
162 
163  //- Declare friendship with the faSolver class
164  friend class faSolver;
165 
166 
167  // Protected Member Functions
168 
169  //- Add patch contribution to internal field
170  template<class Type2>
171  void addToInternalField
172  (
173  const labelUList& addr,
174  const Field<Type2>& pf,
175  Field<Type2>& intf
176  ) const;
177 
178  template<class Type2>
179  void addToInternalField
180  (
181  const labelUList& addr,
182  const tmp<Field<Type2>>& tpf,
183  Field<Type2>& intf
184  ) const;
185 
186  //- Subtract patch contribution from internal field
187  template<class Type2>
189  (
190  const labelUList& addr,
191  const Field<Type2>& pf,
192  Field<Type2>& intf
193  ) const;
194 
195  template<class Type2>
197  (
198  const labelUList& addr,
199  const tmp<Field<Type2>>& tpf,
200  Field<Type2>& intf
201  ) const;
202 
203 
204  // Matrix completion functionality
205 
206  void addBoundaryDiag
207  (
208  scalarField& diag,
209  const direction cmpt
210  ) const;
211 
213 
214  void addBoundarySource
215  (
217  const bool couples = true
218  ) const;
219 
220 
221  // Matrix manipulation functionality
222 
223  //- Set solution in given faces to the specified values
224  template<template<class> class ListType>
225  void setValuesFromList
226  (
227  const labelUList& faceLabels,
228  const ListType<Type>& values
229  );
230 
231 
232 public:
233 
234  //- Solver class returned by the solver function
235  //- used for systems in which it is useful to cache the solver for reuse.
236  class faSolver
237  {
238  faMatrix<Type>& faMat_;
239 
241 
242  public:
243 
244  // Constructors
245 
247  :
248  faMat_(faMat),
249  solver_(std::move(sol))
250  {}
251 
252 
253  // Member Functions
254 
255  //- Solve returning the solution statistics.
256  // Solver controls read from dictionary
257  SolverPerformance<Type> solve(const dictionary& solverControls);
259  //- Solve returning the solution statistics.
260  // Solver controls read from faSolution
262  };
263 
264 
265  // Runtime information
266  ClassName("faMatrix");
267 
269  // Constructors
270 
271  //- Construct given a field to solve for
272  faMatrix
273  (
275  const dimensionSet& ds
276  );
277 
278  //- Copy construct
279  faMatrix(const faMatrix<Type>&);
280 
281  //- Copy/move construct from tmp<faMatrix<Type>>
282  faMatrix(const tmp<faMatrix<Type>>&);
283 
284  //- Deprecated(2022-05) - construct with dimensionSet instead
285  // \deprecated(2022-05) - construct with dimensionSet instead
286  FOAM_DEPRECATED_FOR(2022-05, "Construct with dimensionSet")
287  faMatrix
288  (
289  const GeometricField<Type, faPatchField, areaMesh>& psi,
290  Istream& is
291  )
292  :
293  faMatrix<Type>(psi, dimensionSet(is))
294  {}
295 
296  //- Construct and return a clone
297  tmp<faMatrix<Type>> clone() const
298  {
299  return tmp<faMatrix<Type>>::New(*this);
300  }
301 
302 
303  //- Destructor
304  virtual ~faMatrix();
305 
306 
307  // Member Functions
308 
309  // Access
310 
312  {
313  return psi_;
314  }
315 
316  const dimensionSet& dimensions() const noexcept
317  {
318  return dimensions_;
319  }
320 
321  Field<Type>& source() noexcept
322  {
323  return source_;
324  }
326  const Field<Type>& source() const noexcept
327  {
328  return source_;
329  }
330 
331  //- faBoundary scalar field containing pseudo-matrix coeffs
332  //- for internal cells
334  {
335  return internalCoeffs_;
336  }
337 
338  //- faBoundary scalar field containing pseudo-matrix coeffs
339  //- for internal cells
341  {
342  return internalCoeffs_;
343  }
344 
345  //- faBoundary scalar field containing pseudo-matrix coeffs
346  //- for boundary cells
347  const FieldField<Field, Type>& boundaryCoeffs() const noexcept
348  {
349  return boundaryCoeffs_;
350  }
351 
352  //- faBoundary scalar field containing pseudo-matrix coeffs
353  //- for boundary cells
355  {
356  return boundaryCoeffs_;
357  }
358 
359  //- Declare return type of the faceFluxCorrectionPtr() function
363  //- Return pointer to face-flux non-orthogonal correction field
365  {
366  return faceFluxCorrectionPtr_;
367  }
368 
369  //- True if face-flux non-orthogonal correction field exists
370  bool hasFaceFluxCorrection() const noexcept
371  {
372  return bool(faceFluxCorrectionPtr_);
373  }
374 
375 
376  // Operations
377 
378  //- Set solution in given faces to the specified value
379  //- and eliminate the corresponding equations from the matrix.
380  void setValues
381  (
382  const labelUList& faceLabels,
383  const Type& value
384  );
386  //- Set solution in given faces to the specified values
387  //- and eliminate the corresponding equations from the matrix.
388  void setValues
389  (
390  const labelUList& faceLabels,
391  const UList<Type>& values
392  );
393 
394  //- Set solution in given faces to the specified values
395  //- and eliminate the corresponding equations from the matrix.
396  void setValues
397  (
398  const labelUList& faceLabels,
400  );
401 
402  //- Set reference level for solution
404  (
405  const label facei,
406  const Type& value,
407  const bool forceReference = false
408  );
409 
410  //- Set reference level for solution
411  void setReferences
412  (
413  const labelUList& faceLabels,
414  const Type& value,
415  const bool forceReference = false
416  );
418  //- Set reference level for solution
419  void setReferences
420  (
421  const labelUList& faceLabels,
422  const UList<Type>& values,
423  const bool forceReference = false
424  );
426  //- Set reference level for a component of the solution
427  //- on a given patch face
429  (
430  const label patchi,
431  const label facei,
432  const direction cmpt,
433  const scalar value
434  );
435 
436  //- Relax matrix (for steady-state solution).
437  // alpha = 1 : diagonally equal
438  // alpha < 1 : ,, dominant
439  // alpha = 0 : do nothing
440  // Note: Requires positive diagonal.
441  void relax(const scalar alpha);
442 
443  //- Relax matrix (for steady-state solution).
444  // alpha is read from controlDict
445  void relax();
446 
447  //- Solve returning the solution statistics.
448  // Use the given solver controls
450 
451  //- Solve returning the solution statistics.
452  // Uses \p name solver controls from faSolution
454 
455  //- Solve returning the solution statistics.
456  // Solver controls read from faSolution
458 
459  //- Return the matrix residual
460  tmp<Field<Type>> residual() const;
461 
462  //- Return the matrix diagonal
463  tmp<scalarField> D() const;
464 
465  //- Return the central coefficient
466  tmp<areaScalarField> A() const;
467 
468  //- Return the H operation source
470 
471  //- Return the face-flux field from the matrix
473 
474  //- Return the solver dictionary (from faSolution) for \p name
475  const dictionary& solverDict(const word& name) const;
476 
477  //- Return the solver dictionary for psi
478  const dictionary& solverDict() const;
479 
480 
481  // Member Operators
482 
483  void operator=(const faMatrix<Type>&);
484  void operator=(const tmp<faMatrix<Type>>&);
485 
486  //- Inplace negate
487  void negate();
488 
489  void operator+=(const faMatrix<Type>&);
490  void operator+=(const tmp<faMatrix<Type>>&);
491 
492  void operator-=(const faMatrix<Type>&);
493  void operator-=(const tmp<faMatrix<Type>>&);
494 
497  void operator+=
498  (
500  );
501 
504  void operator-=
505  (
507  );
508 
509  void operator+=(const dimensioned<Type>&);
510  void operator-=(const dimensioned<Type>&);
511 
512  void operator+=(const Foam::zero) {}
513  void operator-=(const Foam::zero) {}
514 
516  void operator*=(const tmp<areaScalarField::Internal>&);
517  void operator*=(const tmp<areaScalarField>&);
518 
519  void operator*=(const dimensioned<scalar>&);
520 
521 
522  // Friend Operators
523 
524  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
525  operator& <Type>
526  (
527  const faMatrix<Type>&,
528  const DimensionedField<Type, areaMesh>&
529  );
530 
531  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
532  operator& <Type>
533  (
534  const faMatrix<Type>&,
535  const tmp<GeometricField<Type, faPatchField, areaMesh>>&
536  );
537 
538  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
539  operator& <Type>
540  (
541  const tmp<faMatrix<Type>>&,
542  const DimensionedField<Type, areaMesh>&
543  );
544 
545  friend tmp<GeometricField<Type, faPatchField, areaMesh>>
546  operator& <Type>
547  (
548  const tmp<faMatrix<Type>>&,
549  const tmp<GeometricField<Type, faPatchField, areaMesh>>&
550  );
551 
552 
553  // Ostream Operator
554 
555  friend Ostream& operator<< <Type>
556  (
557  Ostream&,
558  const faMatrix<Type>&
559  );
560 };
561 
562 
563 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
564 
565 template<class Type>
566 void checkMethod
567 (
568  const faMatrix<Type>&,
569  const faMatrix<Type>&,
570  const char*
571 );
572 
573 template<class Type>
574 void checkMethod
575 (
576  const faMatrix<Type>&,
577  const DimensionedField<Type, areaMesh>&,
578  const char*
579 );
580 
581 template<class Type>
582 void checkMethod
583 (
584  const faMatrix<Type>&,
585  const dimensioned<Type>&,
586  const char*
587 );
588 
589 
590 //- Solve returning the solution statistics given convergence tolerance
591 // Use the given solver controls
592 template<class Type>
593 SolverPerformance<Type> solve
594 (
595  faMatrix<Type>&,
596  const dictionary& solverControls
597 );
598 
599 //- Solve returning the solution statistics given convergence tolerance,
600 //- deleting temporary matrix after solution.
601 // Use the given solver controls
602 template<class Type>
603 SolverPerformance<Type> solve
604 (
605  const tmp<faMatrix<Type>>&,
606  const dictionary& solverControls
607 );
608 
609 
610 //- Solve returning the solution statistics given convergence tolerance
611 // Uses \p name solver controls from faSolution
612 template<class Type>
614 
615 //- Solve returning the solution statistics given convergence tolerance,
616 //- deleting temporary matrix after solution.
617 // Uses \p name solver controls from faSolution
618 template<class Type>
620 
621 
622 //- Solve returning the solution statistics given convergence tolerance
623 // Uses solver controls from faSolution
624 template<class Type>
626 
627 //- Solve returning the solution statistics given convergence tolerance,
628 //- deleting temporary matrix after solution.
629 // Uses solver controls from faSolution
630 template<class Type>
632 
633 
634 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
635 
636 //- Unary negation
637 template<class Type>
638 tmp<faMatrix<Type>> operator-
639 (
640  const faMatrix<Type>&
641 );
642 
643 //- Unary negation
644 template<class Type>
645 tmp<faMatrix<Type>> operator-
646 (
647  const tmp<faMatrix<Type>>&
648 );
649 
650 
651 template<class Type>
652 tmp<faMatrix<Type>> operator+
653 (
654  const faMatrix<Type>&,
655  const faMatrix<Type>&
656 );
657 
658 template<class Type>
659 tmp<faMatrix<Type>> operator+
660 (
661  const tmp<faMatrix<Type>>&,
662  const faMatrix<Type>&
663 );
664 
665 template<class Type>
666 tmp<faMatrix<Type>> operator+
667 (
668  const faMatrix<Type>&,
669  const tmp<faMatrix<Type>>&
670 );
671 
672 template<class Type>
673 tmp<faMatrix<Type>> operator+
674 (
675  const tmp<faMatrix<Type>>&,
676  const tmp<faMatrix<Type>>&
677 );
678 
679 
680 template<class Type>
681 tmp<faMatrix<Type>> operator-
682 (
683  const faMatrix<Type>&,
684  const faMatrix<Type>&
685 );
686 
687 template<class Type>
688 tmp<faMatrix<Type>> operator-
689 (
690  const tmp<faMatrix<Type>>&,
691  const faMatrix<Type>&
692 );
693 
694 template<class Type>
695 tmp<faMatrix<Type>> operator-
696 (
697  const faMatrix<Type>&,
698  const tmp<faMatrix<Type>>&
699 );
700 
701 template<class Type>
702 tmp<faMatrix<Type>> operator-
703 (
704  const tmp<faMatrix<Type>>&,
705  const tmp<faMatrix<Type>>&
706 );
707 
708 
709 template<class Type>
710 tmp<faMatrix<Type>> operator==
711 (
712  const faMatrix<Type>&,
713  const faMatrix<Type>&
714 );
715 
716 template<class Type>
717 tmp<faMatrix<Type>> operator==
718 (
719  const tmp<faMatrix<Type>>&,
720  const faMatrix<Type>&
721 );
722 
723 template<class Type>
724 tmp<faMatrix<Type>> operator==
725 (
726  const faMatrix<Type>&,
727  const tmp<faMatrix<Type>>&
728 );
729 
730 template<class Type>
731 tmp<faMatrix<Type>> operator==
732 (
733  const tmp<faMatrix<Type>>&,
734  const tmp<faMatrix<Type>>&
735 );
736 
737 
738 template<class Type>
739 tmp<faMatrix<Type>> operator+
740 (
741  const faMatrix<Type>&,
743 );
744 
745 template<class Type>
746 tmp<faMatrix<Type>> operator+
747 (
748  const faMatrix<Type>&,
750 );
751 
752 template<class Type>
753 tmp<faMatrix<Type>> operator+
754 (
755  const faMatrix<Type>&,
757 );
758 
759 template<class Type>
760 tmp<faMatrix<Type>> operator+
761 (
762  const tmp<faMatrix<Type>>&,
764 );
765 
766 template<class Type>
767 tmp<faMatrix<Type>> operator+
768 (
769  const tmp<faMatrix<Type>>&,
771 );
772 
773 template<class Type>
774 tmp<faMatrix<Type>> operator+
775 (
776  const tmp<faMatrix<Type>>&,
778 );
779 
780 template<class Type>
781 tmp<faMatrix<Type>> operator+
782 (
784  const faMatrix<Type>&
785 );
786 
787 template<class Type>
788 tmp<faMatrix<Type>> operator+
789 (
791  const faMatrix<Type>&
792 );
793 
794 template<class Type>
795 tmp<faMatrix<Type>> operator+
796 (
798  const faMatrix<Type>&
799 );
800 
801 template<class Type>
802 tmp<faMatrix<Type>> operator+
803 (
805  const tmp<faMatrix<Type>>&
806 );
807 
808 template<class Type>
809 tmp<faMatrix<Type>> operator+
810 (
812  const tmp<faMatrix<Type>>&
813 );
814 
815 template<class Type>
816 tmp<faMatrix<Type>> operator+
817 (
819  const tmp<faMatrix<Type>>&
820 );
821 
822 template<class Type>
823 tmp<faMatrix<Type>> operator-
824 (
825  const faMatrix<Type>&,
827 );
828 
829 template<class Type>
830 tmp<faMatrix<Type>> operator-
831 (
832  const faMatrix<Type>&,
834 );
835 
836 template<class Type>
837 tmp<faMatrix<Type>> operator-
838 (
839  const faMatrix<Type>&,
841 );
842 
843 template<class Type>
844 tmp<faMatrix<Type>> operator-
845 (
846  const tmp<faMatrix<Type>>&,
848 );
849 
850 template<class Type>
851 tmp<faMatrix<Type>> operator-
852 (
853  const tmp<faMatrix<Type>>&,
855 );
856 
857 template<class Type>
858 tmp<faMatrix<Type>> operator-
859 (
860  const tmp<faMatrix<Type>>&,
862 );
863 
864 
865 template<class Type>
866 tmp<faMatrix<Type>> operator-
867 (
869  const faMatrix<Type>&
870 );
871 
872 template<class Type>
873 tmp<faMatrix<Type>> operator-
874 (
876  const faMatrix<Type>&
877 );
878 
879 template<class Type>
880 tmp<faMatrix<Type>> operator-
881 (
883  const faMatrix<Type>&
884 );
885 
886 template<class Type>
887 tmp<faMatrix<Type>> operator-
888 (
890  const tmp<faMatrix<Type>>&
891 );
892 
893 template<class Type>
894 tmp<faMatrix<Type>> operator-
895 (
897  const tmp<faMatrix<Type>>&
898 );
899 
900 template<class Type>
901 tmp<faMatrix<Type>> operator-
902 (
904  const tmp<faMatrix<Type>>&
905 );
906 
907 template<class Type>
908 tmp<faMatrix<Type>> operator+
909 (
910  const faMatrix<Type>&,
911  const dimensioned<Type>&
912 );
913 
914 template<class Type>
915 tmp<faMatrix<Type>> operator+
916 (
917  const tmp<faMatrix<Type>>&,
918  const dimensioned<Type>&
919 );
920 
921 template<class Type>
922 tmp<faMatrix<Type>> operator+
923 (
924  const dimensioned<Type>&,
925  const faMatrix<Type>&
926 );
927 
928 template<class Type>
929 tmp<faMatrix<Type>> operator+
930 (
931  const dimensioned<Type>&,
932  const tmp<faMatrix<Type>>&
933 );
934 
935 template<class Type>
936 tmp<faMatrix<Type>> operator-
937 (
938  const faMatrix<Type>&,
939  const dimensioned<Type>&
940 );
941 
942 template<class Type>
943 tmp<faMatrix<Type>> operator-
944 (
945  const tmp<faMatrix<Type>>&,
946  const dimensioned<Type>&
947 );
948 
949 template<class Type>
950 tmp<faMatrix<Type>> operator-
951 (
952  const dimensioned<Type>&,
953  const faMatrix<Type>&
954 );
955 
956 template<class Type>
957 tmp<faMatrix<Type>> operator-
958 (
959  const dimensioned<Type>&,
960  const tmp<faMatrix<Type>>&
961 );
962 
963 template<class Type>
964 tmp<faMatrix<Type>> operator==
965 (
966  const faMatrix<Type>&,
968 );
969 
970 template<class Type>
971 tmp<faMatrix<Type>> operator==
972 (
973  const faMatrix<Type>&,
975 );
976 
977 template<class Type>
978 tmp<faMatrix<Type>> operator==
979 (
980  const faMatrix<Type>&,
982 );
983 
984 template<class Type>
985 tmp<faMatrix<Type>> operator==
986 (
987  const tmp<faMatrix<Type>>&,
989 );
990 
991 template<class Type>
992 tmp<faMatrix<Type>> operator==
993 (
994  const tmp<faMatrix<Type>>&,
996 );
997 
998 template<class Type>
999 tmp<faMatrix<Type>> operator==
1000 (
1001  const tmp<faMatrix<Type>>&,
1003 );
1004 
1005 template<class Type>
1006 tmp<faMatrix<Type>> operator==
1007 (
1008  const faMatrix<Type>&,
1009  const dimensioned<Type>&
1010 );
1011 
1012 template<class Type>
1013 tmp<faMatrix<Type>> operator==
1014 (
1015  const tmp<faMatrix<Type>>&,
1016  const dimensioned<Type>&
1017 );
1018 
1019 
1020 template<class Type>
1021 tmp<faMatrix<Type>> operator==
1022 (
1023  const faMatrix<Type>&,
1024  const Foam::zero
1025 );
1026 
1027 template<class Type>
1028 tmp<faMatrix<Type>> operator==
1029 (
1030  const tmp<faMatrix<Type>>&,
1031  const Foam::zero
1032 );
1033 
1034 
1035 template<class Type>
1036 tmp<faMatrix<Type>> operator*
1037 (
1039  const faMatrix<Type>&
1040 );
1041 
1042 template<class Type>
1043 tmp<faMatrix<Type>> operator*
1044 (
1046  const faMatrix<Type>&
1047 );
1048 
1049 template<class Type>
1050 tmp<faMatrix<Type>> operator*
1051 (
1052  const tmp<areaScalarField>&,
1053  const faMatrix<Type>&
1054 );
1055 
1056 template<class Type>
1057 tmp<faMatrix<Type>> operator*
1058 (
1060  const tmp<faMatrix<Type>>&
1061 );
1062 
1063 template<class Type>
1064 tmp<faMatrix<Type>> operator*
1065 (
1067  const tmp<faMatrix<Type>>&
1068 );
1069 
1070 template<class Type>
1071 tmp<faMatrix<Type>> operator*
1072 (
1073  const tmp<areaScalarField>&,
1074  const tmp<faMatrix<Type>>&
1075 );
1076 
1077 
1078 template<class Type>
1079 tmp<faMatrix<Type>> operator*
1080 (
1081  const dimensioned<scalar>&,
1082  const faMatrix<Type>&
1083 );
1084 
1085 template<class Type>
1086 tmp<faMatrix<Type>> operator*
1087 (
1088  const dimensioned<scalar>&,
1089  const tmp<faMatrix<Type>>&
1090 );
1091 
1092 
1093 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1094 
1095 } // End namespace Foam
1096 
1097 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1098 
1099 #ifdef NoRepository
1100  #include "faMatrix.C"
1101 #endif
1102 
1103 // Specialisation for scalars
1104 
1105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1106 
1107 #endif
1108 
1109 // ************************************************************************* //
void negate()
Inplace negate.
Definition: faMatrix.C:803
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:402
faceFluxFieldPtrType & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
Definition: faMatrix.H:417
void operator-=(const faMatrix< Type > &)
Definition: faMatrix.C:852
tmp< scalarField > D() const
Return the matrix diagonal.
Definition: faMatrix.C:606
ClassName("faMatrix")
const dimensionSet & dimensions() const noexcept
Definition: faMatrix.H:357
uint8_t direction
Definition: direction.H:46
GeometricField< Type, faPatchField, areaMesh > psiFieldType
The geometric field type for psi.
Definition: faMatrix.H:122
void operator+=(const faMatrix< Type > &)
Definition: faMatrix.C:818
const dictionary & solverDict() const
Return the solver dictionary for psi.
Definition: faMatrix.C:750
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:179
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
GeometricField< Type, faePatchField, edgeMesh > * faceFluxFieldPtrType
Declare return type of the faceFluxCorrectionPtr() function.
Definition: faMatrix.H:412
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
Definition: faMatrix.C:36
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:111
Field< Type > & source() noexcept
Definition: faMatrix.H:362
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:454
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
Generic dimensioned Type class.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
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:145
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition: faMatrix.H:394
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:376
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:670
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:74
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:589
void operator=(const faMatrix< Type > &)
Definition: faMatrix.C:762
void operator*=(const areaScalarField::Internal &)
Definition: faMatrix.C:971
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:1043
faSolver(faMatrix< Type > &faMat, autoPtr< lduMatrix::solver > &&sol)
Definition: faMatrix.H:268
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
Definition: faMatrix.C:634
void setValuesFromList(const labelUList &faceLabels, const ListType< Type > &values)
Set solution in given faces to the specified values.
Definition: faMatrix.C:299
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:425
tmp< areaScalarField > A() const
Return the central coefficient.
Definition: faMatrix.C:615
void setReference(const label facei, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition: faMatrix.C:435
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Definition: lduMatrix.H:79
Solver class returned by the solver function used for systems in which it is useful to cache the solv...
Definition: faMatrix.H:258
Macro definitions for declaring ClassName(), NamespaceName(), etc.
tmp< Field< Type > > residual() const
Return the matrix residual.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Definition: faMatrix.H:56
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
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:129
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:352
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:129
A class for managing temporary objects.
Definition: HashPtrTable.H:50
scalarField & diag()
Definition: lduMatrix.C:197
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< faMatrix< Type > > clone() const
Construct and return a clone.
Definition: faMatrix.H:336
Namespace for OpenFOAM.
virtual ~faMatrix()
Destructor.
Definition: faMatrix.C:285