fvMatrix.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 | Copyright (C) 2011-2017 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fvMatrix
26 
27 Description
28  A special matrix type and solver, designed for finite volume
29  solutions of scalar equations.
30  Face addressing is used to make all matrix assembly
31  and solution loops vectorise.
32 
33 SourceFiles
34  fvMatrix.C
35  fvMatrixSolve.C
36  fvScalarMatrix.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef fvMatrix_H
41 #define fvMatrix_H
42 
43 #include "volFields.H"
44 #include "surfaceFields.H"
45 #include "lduMatrix.H"
46 #include "tmp.H"
47 #include "autoPtr.H"
48 #include "dimensionedTypes.H"
49 #include "zero.H"
50 #include "className.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of friend functions and operators
58 
59 template<class Type>
60 class fvMatrix;
61 
62 template<class Type>
63 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
64 (
65  const fvMatrix<Type>&,
66  const DimensionedField<Type, volMesh>&
67 );
68 
69 template<class Type>
70 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
71 (
72  const fvMatrix<Type>&,
73  const tmp<DimensionedField<Type, volMesh>>&
74 );
75 
76 template<class Type>
77 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
78 (
79  const fvMatrix<Type>&,
80  const tmp<GeometricField<Type, fvPatchField, volMesh>>&
81 );
82 
83 template<class Type>
84 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
85 (
86  const tmp<fvMatrix<Type>>&,
87  const DimensionedField<Type, volMesh>&
88 );
89 
90 template<class Type>
91 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
92 (
93  const tmp<fvMatrix<Type>>&,
94  const tmp<DimensionedField<Type, volMesh>>&
95 );
96 
97 template<class Type>
98 tmp<GeometricField<Type, fvPatchField, volMesh>> operator&
99 (
100  const tmp<fvMatrix<Type>>&,
101  const tmp<GeometricField<Type, fvPatchField, volMesh>>&
102 );
103 
104 template<class Type>
105 Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
107 template<class T> class UIndirectList;
108 
109 
110 /*---------------------------------------------------------------------------*\
111  Class fvMatrix Declaration
112 \*---------------------------------------------------------------------------*/
113 
114 template<class Type>
115 class fvMatrix
116 :
117  public tmp<fvMatrix<Type>>::refCount,
118  public lduMatrix
119 {
120  // Private data
121 
122  //- Const reference to GeometricField<Type, fvPatchField, volMesh>
123  // Converted into a non-const reference at the point of solution.
125 
126  //- Dimension set
127  dimensionSet dimensions_;
128 
129  //- Source term
130  Field<Type> source_;
131 
132  //- Boundary scalar field containing pseudo-matrix coeffs
133  // for internal cells
134  FieldField<Field, Type> internalCoeffs_;
135 
136  //- Boundary scalar field containing pseudo-matrix coeffs
137  // for boundary cells
138  FieldField<Field, Type> boundaryCoeffs_;
139 
140 
141  //- Face flux field for non-orthogonal correction
143  *faceFluxCorrectionPtr_;
144 
145 
146 protected:
147 
148  //- Declare friendship with the fvSolver class
149  friend class fvSolver;
150 
151  // Protected Member Functions
152 
153  //- Add patch contribution to internal field
154  template<class Type2>
155  void addToInternalField
156  (
157  const labelUList& addr,
158  const Field<Type2>& pf,
159  Field<Type2>& intf
160  ) const;
161 
162  template<class Type2>
163  void addToInternalField
164  (
165  const labelUList& addr,
166  const tmp<Field<Type2>>& tpf,
167  Field<Type2>& intf
168  ) const;
169 
170  //- Subtract patch contribution from internal field
171  template<class Type2>
173  (
174  const labelUList& addr,
175  const Field<Type2>& pf,
176  Field<Type2>& intf
177  ) const;
178 
179  template<class Type2>
181  (
182  const labelUList& addr,
183  const tmp<Field<Type2>>& tpf,
184  Field<Type2>& intf
185  ) const;
186 
187 
188  // Matrix completion functionality
189 
190  void addBoundaryDiag
191  (
192  scalarField& diag,
193  const direction cmpt
194  ) const;
195 
197 
198  void addBoundarySource
199  (
201  const bool couples=true
202  ) const;
203 
204  // Matrix manipulation functionality
205 
206  //- Set solution in given cells to the specified values
207  template<template<class> class ListType>
208  void setValuesFromList
209  (
210  const labelUList& cells,
211  const ListType<Type>& values
212  );
213 
214 
215 public:
216 
217  //- Solver class returned by the solver function
218  // used for systems in which it is useful to cache the solver for reuse
219  // e.g. if the solver is potentially expensive to construct (AMG) and can
220  // be used several times (PISO)
221  class fvSolver
222  {
223  fvMatrix<Type>& fvMat_;
224 
226 
227  public:
228 
229  // Constructors
231  fvSolver(fvMatrix<Type>& fvMat, autoPtr<lduMatrix::solver> sol)
232  :
233  fvMat_(fvMat),
234  solver_(sol)
235  {}
236 
237 
238  // Member functions
239 
240  //- Solve returning the solution statistics.
241  // Use the given solver controls
243 
244  //- Solve returning the solution statistics.
245  // Solver controls read from fvSolution
247  };
248 
249 
250  ClassName("fvMatrix");
251 
252 
253  // Constructors
254 
255  //- Construct given a field to solve for
256  fvMatrix
257  (
259  const dimensionSet&
260  );
261 
262  //- Construct as copy
263  fvMatrix(const fvMatrix<Type>&);
264 
265  //- Construct as copy of tmp<fvMatrix<Type>> deleting argument
266  #ifndef NoConstructFromTmp
267  fvMatrix(const tmp<fvMatrix<Type>>&);
268  #endif
269 
270  //- Construct from Istream given field to solve for
272 
273  //- Clone
274  tmp<fvMatrix<Type>> clone() const;
275 
276 
277  //- Destructor
278  virtual ~fvMatrix();
279 
280 
281  // Member functions
282 
283  // Access
286  {
287  return psi_;
288  }
290  const dimensionSet& dimensions() const
291  {
292  return dimensions_;
293  }
296  {
297  return source_;
298  }
300  const Field<Type>& source() const
301  {
302  return source_;
303  }
304 
305  //- fvBoundary scalar field containing pseudo-matrix coeffs
306  // for internal cells
308  {
309  return internalCoeffs_;
310  }
311 
312  //- fvBoundary scalar field containing pseudo-matrix coeffs
313  // for boundary cells
315  {
316  return boundaryCoeffs_;
317  }
318 
319 
320  //- Declare return type of the faceFluxCorrectionPtr() function
323 
324  //- Return pointer to face-flux non-orthogonal correction field
325  surfaceTypeFieldPtr& faceFluxCorrectionPtr()
326  {
327  return faceFluxCorrectionPtr_;
328  }
329 
330 
331  // Operations
332 
333  //- Set solution in given cells to the specified values
334  // and eliminate the corresponding equations from the matrix.
335  void setValues
336  (
337  const labelUList& cells,
338  const UList<Type>& values
339  );
340 
341  //- Set solution in given cells to the specified values
342  // and eliminate the corresponding equations from the matrix.
343  void setValues
344  (
345  const labelUList& cells,
346  const UIndirectList<Type>& values
347  );
348 
349  //- Set reference level for solution
350  void setReference
351  (
352  const label celli,
353  const Type& value,
354  const bool forceReference = false
355  );
356 
357  //- Set reference level for a component of the solution
358  // on a given patch face
360  (
361  const label patchi,
362  const label facei,
363  const direction cmpt,
364  const scalar value
365  );
366 
367  //- Relax matrix (for steady-state solution).
368  // alpha = 1 : diagonally equal
369  // alpha < 1 : diagonally dominant
370  // alpha = 0 : do nothing
371  // Note: Requires positive diagonal.
372  void relax(const scalar alpha);
373 
374  //- Relax matrix (for steady-state solution).
375  // alpha is read from controlDict
376  void relax();
377 
378  //- Manipulate based on a boundary field
379  void boundaryManipulate
380  (
382  Boundary& values
383  );
384 
385  //- Construct and return the solver
386  // Use the given solver controls
388 
389  //- Construct and return the solver
390  // Solver controls read from fvSolution
392 
393  //- Solve segregated or coupled returning the solution statistics.
394  // Use the given solver controls
396 
397  //- Solve segregated returning the solution statistics.
398  // Use the given solver controls
400 
401  //- Solve coupled returning the solution statistics.
402  // Use the given solver controls
404 
405  //- Solve returning the solution statistics.
406  // Solver controls read from fvSolution
408 
409  //- Return the matrix residual
410  tmp<Field<Type>> residual() const;
411 
412  //- Return the matrix scalar diagonal
413  tmp<scalarField> D() const;
414 
415  //- Return the matrix Type diagonal
416  tmp<Field<Type>> DD() const;
417 
418  //- Return the central coefficient
419  tmp<volScalarField> A() const;
420 
421  //- Return the H operation source
423 
424  //- Return H(1)
425  tmp<volScalarField> H1() const;
426 
427  //- Return the face-flux field from the matrix
429  flux() const;
430 
431 
432  // Member operators
433 
434  void operator=(const fvMatrix<Type>&);
435  void operator=(const tmp<fvMatrix<Type>>&);
436 
437  void negate();
438 
439  void operator+=(const fvMatrix<Type>&);
440  void operator+=(const tmp<fvMatrix<Type>>&);
441 
442  void operator-=(const fvMatrix<Type>&);
443  void operator-=(const tmp<fvMatrix<Type>>&);
444 
445  void operator+=
446  (
448  );
449  void operator+=
450  (
452  );
453  void operator+=
454  (
456  );
457 
458  void operator-=
459  (
461  );
462  void operator-=
463  (
465  );
466  void operator-=
467  (
469  );
470 
471  void operator+=(const dimensioned<Type>&);
472  void operator-=(const dimensioned<Type>&);
473 
474  void operator+=(const zero&);
475  void operator-=(const zero&);
476 
479  void operator*=(const tmp<volScalarField>&);
480 
481  void operator*=(const dimensioned<scalar>&);
482 
483 
484  // Friend operators
485 
487  operator& <Type>
488  (
489  const fvMatrix<Type>&,
491  );
492 
494  operator& <Type>
495  (
496  const fvMatrix<Type>&,
498  );
499 
501  operator& <Type>
502  (
503  const tmp<fvMatrix<Type>>&,
505  );
506 
508  operator& <Type>
509  (
510  const tmp<fvMatrix<Type>>&,
512  );
513 
514 
515  // Ostream operator
516 
517  friend Ostream& operator<< <Type>
518  (
519  Ostream&,
520  const fvMatrix<Type>&
521  );
522 };
523 
524 
525 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
526 
527 template<class Type>
528 void checkMethod
529 (
530  const fvMatrix<Type>&,
531  const fvMatrix<Type>&,
532  const char*
533 );
534 
535 template<class Type>
536 void checkMethod
537 (
538  const fvMatrix<Type>&,
540  const char*
541 );
542 
543 template<class Type>
544 void checkMethod
545 (
546  const fvMatrix<Type>&,
547  const dimensioned<Type>&,
548  const char*
549 );
550 
551 
552 //- Solve returning the solution statistics given convergence tolerance
553 // Use the given solver controls
554 template<class Type>
555 SolverPerformance<Type> solve(fvMatrix<Type>&, const dictionary&);
556 
557 
558 //- Solve returning the solution statistics given convergence tolerance,
559 // deleting temporary matrix after solution.
560 // Use the given solver controls
561 template<class Type>
563 (
564  const tmp<fvMatrix<Type>>&,
565  const dictionary&
566 );
567 
568 
569 //- Solve returning the solution statistics given convergence tolerance
570 // Solver controls read fvSolution
571 template<class Type>
572 SolverPerformance<Type> solve(fvMatrix<Type>&);
573 
574 
575 //- Solve returning the solution statistics given convergence tolerance,
576 // deleting temporary matrix after solution.
577 // Solver controls read fvSolution
578 template<class Type>
579 SolverPerformance<Type> solve(const tmp<fvMatrix<Type>>&);
580 
581 
582 //- Return the correction form of the given matrix
583 // by subtracting the matrix multiplied by the current field
584 template<class Type>
585 tmp<fvMatrix<Type>> correction(const fvMatrix<Type>&);
586 
587 
588 //- Return the correction form of the given temporary matrix
589 // by subtracting the matrix multiplied by the current field
590 template<class Type>
591 tmp<fvMatrix<Type>> correction(const tmp<fvMatrix<Type>>&);
592 
593 
594 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
595 
596 template<class Type>
597 tmp<fvMatrix<Type>> operator==
598 (
599  const fvMatrix<Type>&,
600  const fvMatrix<Type>&
601 );
602 
603 template<class Type>
604 tmp<fvMatrix<Type>> operator==
605 (
606  const tmp<fvMatrix<Type>>&,
607  const fvMatrix<Type>&
608 );
609 
610 template<class Type>
611 tmp<fvMatrix<Type>> operator==
612 (
613  const fvMatrix<Type>&,
614  const tmp<fvMatrix<Type>>&
615 );
616 
617 template<class Type>
618 tmp<fvMatrix<Type>> operator==
619 (
620  const tmp<fvMatrix<Type>>&,
621  const tmp<fvMatrix<Type>>&
622 );
623 
624 
625 template<class Type>
626 tmp<fvMatrix<Type>> operator==
627 (
628  const fvMatrix<Type>&,
630 );
631 
632 template<class Type>
633 tmp<fvMatrix<Type>> operator==
634 (
635  const fvMatrix<Type>&,
637 );
638 
639 template<class Type>
640 tmp<fvMatrix<Type>> operator==
641 (
642  const fvMatrix<Type>&,
644 );
645 
646 template<class Type>
647 tmp<fvMatrix<Type>> operator==
648 (
649  const tmp<fvMatrix<Type>>&,
651 );
652 
653 template<class Type>
654 tmp<fvMatrix<Type>> operator==
655 (
656  const tmp<fvMatrix<Type>>&,
658 );
659 
660 template<class Type>
661 tmp<fvMatrix<Type>> operator==
662 (
663  const tmp<fvMatrix<Type>>&,
665 );
666 
667 template<class Type>
668 tmp<fvMatrix<Type>> operator==
669 (
670  const fvMatrix<Type>&,
671  const dimensioned<Type>&
672 );
673 
674 template<class Type>
675 tmp<fvMatrix<Type>> operator==
676 (
677  const tmp<fvMatrix<Type>>&,
678  const dimensioned<Type>&
679 );
680 
681 
682 template<class Type>
683 tmp<fvMatrix<Type>> operator==
684 (
685  const fvMatrix<Type>&,
686  const zero&
687 );
688 
689 template<class Type>
690 tmp<fvMatrix<Type>> operator==
691 (
692  const tmp<fvMatrix<Type>>&,
693  const zero&
694 );
695 
696 
697 template<class Type>
698 tmp<fvMatrix<Type>> operator-
699 (
700  const fvMatrix<Type>&
701 );
702 
703 template<class Type>
704 tmp<fvMatrix<Type>> operator-
705 (
706  const tmp<fvMatrix<Type>>&
707 );
708 
709 
710 template<class Type>
711 tmp<fvMatrix<Type>> operator+
712 (
713  const fvMatrix<Type>&,
714  const fvMatrix<Type>&
715 );
716 
717 template<class Type>
718 tmp<fvMatrix<Type>> operator+
719 (
720  const tmp<fvMatrix<Type>>&,
721  const fvMatrix<Type>&
722 );
723 
724 template<class Type>
725 tmp<fvMatrix<Type>> operator+
726 (
727  const fvMatrix<Type>&,
728  const tmp<fvMatrix<Type>>&
729 );
730 
731 template<class Type>
732 tmp<fvMatrix<Type>> operator+
733 (
734  const tmp<fvMatrix<Type>>&,
735  const tmp<fvMatrix<Type>>&
736 );
737 
738 
739 template<class Type>
740 tmp<fvMatrix<Type>> operator+
741 (
742  const fvMatrix<Type>&,
744 );
745 
746 template<class Type>
747 tmp<fvMatrix<Type>> operator+
748 (
749  const fvMatrix<Type>&,
751 );
752 
753 template<class Type>
754 tmp<fvMatrix<Type>> operator+
755 (
756  const fvMatrix<Type>&,
758 );
759 
760 template<class Type>
761 tmp<fvMatrix<Type>> operator+
762 (
763  const tmp<fvMatrix<Type>>&,
765 );
766 
767 template<class Type>
768 tmp<fvMatrix<Type>> operator+
769 (
770  const tmp<fvMatrix<Type>>&,
772 );
773 
774 template<class Type>
775 tmp<fvMatrix<Type>> operator+
776 (
777  const tmp<fvMatrix<Type>>&,
779 );
780 
781 template<class Type>
782 tmp<fvMatrix<Type>> operator+
783 (
785  const fvMatrix<Type>&
786 );
787 
788 template<class Type>
789 tmp<fvMatrix<Type>> operator+
790 (
792  const fvMatrix<Type>&
793 );
794 
795 template<class Type>
796 tmp<fvMatrix<Type>> operator+
797 (
799  const fvMatrix<Type>&
800 );
801 
802 template<class Type>
803 tmp<fvMatrix<Type>> operator+
804 (
805  const DimensionedField<Type, volMesh>&,
806  const tmp<fvMatrix<Type>>&
807 );
808 
809 template<class Type>
810 tmp<fvMatrix<Type>> operator+
811 (
812  const tmp<DimensionedField<Type, volMesh>>&,
813  const tmp<fvMatrix<Type>>&
814 );
815 
816 template<class Type>
817 tmp<fvMatrix<Type>> operator+
818 (
819  const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
820  const tmp<fvMatrix<Type>>&
821 );
822 
823 
824 template<class Type>
825 tmp<fvMatrix<Type>> operator+
826 (
827  const fvMatrix<Type>&,
828  const dimensioned<Type>&
829 );
830 
831 template<class Type>
832 tmp<fvMatrix<Type>> operator+
833 (
834  const tmp<fvMatrix<Type>>&,
835  const dimensioned<Type>&
836 );
837 
838 template<class Type>
839 tmp<fvMatrix<Type>> operator+
840 (
841  const dimensioned<Type>&,
842  const fvMatrix<Type>&
843 );
844 
845 template<class Type>
846 tmp<fvMatrix<Type>> operator+
847 (
848  const dimensioned<Type>&,
849  const tmp<fvMatrix<Type>>&
850 );
851 
852 
853 template<class Type>
854 tmp<fvMatrix<Type>> operator-
855 (
856  const fvMatrix<Type>&,
857  const fvMatrix<Type>&
858 );
859 
860 template<class Type>
861 tmp<fvMatrix<Type>> operator-
862 (
863  const tmp<fvMatrix<Type>>&,
864  const fvMatrix<Type>&
865 );
866 
867 template<class Type>
868 tmp<fvMatrix<Type>> operator-
869 (
870  const fvMatrix<Type>&,
871  const tmp<fvMatrix<Type>>&
872 );
873 
874 template<class Type>
875 tmp<fvMatrix<Type>> operator-
876 (
877  const tmp<fvMatrix<Type>>&,
878  const tmp<fvMatrix<Type>>&
879 );
880 
881 
882 template<class Type>
883 tmp<fvMatrix<Type>> operator-
884 (
885  const fvMatrix<Type>&,
886  const DimensionedField<Type, volMesh>&
887 );
888 
889 template<class Type>
890 tmp<fvMatrix<Type>> operator-
891 (
892  const fvMatrix<Type>&,
893  const tmp<DimensionedField<Type, volMesh>>&
894 );
895 
896 template<class Type>
897 tmp<fvMatrix<Type>> operator-
898 (
899  const fvMatrix<Type>&,
900  const tmp<GeometricField<Type, fvPatchField, volMesh>>&
901 );
902 
903 template<class Type>
904 tmp<fvMatrix<Type>> operator-
905 (
906  const tmp<fvMatrix<Type>>&,
907  const DimensionedField<Type, volMesh>&
908 );
909 
910 template<class Type>
911 tmp<fvMatrix<Type>> operator-
912 (
913  const tmp<fvMatrix<Type>>&,
914  const tmp<DimensionedField<Type, volMesh>>&
915 );
916 
917 template<class Type>
918 tmp<fvMatrix<Type>> operator-
919 (
920  const tmp<fvMatrix<Type>>&,
921  const tmp<GeometricField<Type, fvPatchField, volMesh>>&
922 );
923 
924 template<class Type>
925 tmp<fvMatrix<Type>> operator-
926 (
927  const DimensionedField<Type, volMesh>&,
928  const fvMatrix<Type>&
929 );
930 
931 template<class Type>
932 tmp<fvMatrix<Type>> operator-
933 (
934  const tmp<DimensionedField<Type, volMesh>>&,
935  const fvMatrix<Type>&
936 );
937 
938 template<class Type>
939 tmp<fvMatrix<Type>> operator-
940 (
941  const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
942  const fvMatrix<Type>&
943 );
944 
945 template<class Type>
946 tmp<fvMatrix<Type>> operator-
947 (
948  const DimensionedField<Type, volMesh>&,
949  const tmp<fvMatrix<Type>>&
950 );
951 
952 template<class Type>
953 tmp<fvMatrix<Type>> operator-
954 (
955  const tmp<DimensionedField<Type, volMesh>>&,
956  const tmp<fvMatrix<Type>>&
957 );
958 
959 template<class Type>
960 tmp<fvMatrix<Type>> operator-
961 (
962  const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
963  const tmp<fvMatrix<Type>>&
964 );
965 
966 
967 template<class Type>
968 tmp<fvMatrix<Type>> operator-
969 (
970  const fvMatrix<Type>&,
971  const dimensioned<Type>&
972 );
973 
974 template<class Type>
975 tmp<fvMatrix<Type>> operator-
976 (
977  const tmp<fvMatrix<Type>>&,
978  const dimensioned<Type>&
979 );
980 
981 template<class Type>
982 tmp<fvMatrix<Type>> operator-
983 (
984  const dimensioned<Type>&,
985  const fvMatrix<Type>&
986 );
987 
988 template<class Type>
989 tmp<fvMatrix<Type>> operator-
990 (
991  const dimensioned<Type>&,
992  const tmp<fvMatrix<Type>>&
993 );
994 
995 
996 template<class Type>
997 tmp<fvMatrix<Type>> operator*
998 (
1000  const fvMatrix<Type>&
1001 );
1002 
1003 template<class Type>
1004 tmp<fvMatrix<Type>> operator*
1005 (
1007  const fvMatrix<Type>&
1008 );
1009 
1010 template<class Type>
1011 tmp<fvMatrix<Type>> operator*
1012 (
1013  const tmp<volScalarField>&,
1014  const fvMatrix<Type>&
1015 );
1016 
1017 template<class Type>
1018 tmp<fvMatrix<Type>> operator*
1019 (
1020  const volScalarField::Internal&,
1021  const tmp<fvMatrix<Type>>&
1022 );
1023 
1024 template<class Type>
1025 tmp<fvMatrix<Type>> operator*
1026 (
1027  const tmp<volScalarField::Internal>&,
1028  const tmp<fvMatrix<Type>>&
1029 );
1030 
1031 template<class Type>
1032 tmp<fvMatrix<Type>> operator*
1033 (
1034  const tmp<volScalarField>&,
1035  const tmp<fvMatrix<Type>>&
1036 );
1037 
1038 
1039 template<class Type>
1040 tmp<fvMatrix<Type>> operator*
1041 (
1042  const dimensioned<scalar>&,
1043  const fvMatrix<Type>&
1044 );
1045 
1046 template<class Type>
1047 tmp<fvMatrix<Type>> operator*
1048 (
1049  const dimensioned<scalar>&,
1050  const tmp<fvMatrix<Type>>&
1051 );
1052 
1053 
1054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1055 
1056 } // End namespace Foam
1057 
1058 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1059 
1060 #ifdef NoRepository
1061  #include "fvMatrix.C"
1062 #endif
1063 
1064 // Specialisation for scalars
1065 #include "fvScalarMatrix.H"
1066 
1067 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1068 
1069 #endif
1070 
1071 // ************************************************************************* //
Foam::surfaceFields.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
Definition: fvMatrix.C:38
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
Definition: fvMatrix.C:111
Reference counter for various OpenFOAM components.
Definition: refCount.H:49
void relax()
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:674
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void negate()
Definition: fvMatrix.C:1007
FieldField< Field, Type > & internalCoeffs()
fvBoundary scalar field containing pseudo-matrix coeffs
Definition: fvMatrix.H:306
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Definition: fvMatrix.H:284
uint8_t direction
Definition: direction.H:45
void addCmptAvBoundaryDiag(scalarField &diag) const
Definition: fvMatrix.C:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition: fvMatrix.C:508
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
Definition: fvMatrix.C:766
void operator-=(const fvMatrix< Type > &)
Definition: fvMatrix.C:1056
Solver class returned by the solver function.
Definition: fvMatrix.H:220
Generic GeometricField class.
Generic dimensioned Type class.
tmp< volScalarField > H1() const
Return H(1)
Definition: fvMatrix.C:828
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
Definition: fvMatrix.C:75
Generic field type.
Definition: FieldField.H:51
tmp< scalarField > D() const
Return the matrix scalar diagonal.
Definition: fvMatrix.C:704
void operator=(const fvMatrix< Type > &)
Definition: fvMatrix.C:963
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
surfaceTypeFieldPtr & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
Definition: fvMatrix.H:324
fvSolver(fvMatrix< Type > &fvMat, autoPtr< lduMatrix::solver > sol)
Definition: fvMatrix.H:230
Dimension set for the base types.
Definition: dimensionSet.H:120
SolverPerformance< Type > solve()
Solve returning the solution statistics.
const cellShapeList & cells
Pre-declare SubField and related Field type.
Definition: Field.H:57
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics...
void setValues(const labelUList &cells, const UList< Type > &values)
Set solution in given cells to the specified values.
Definition: fvMatrix.C:486
FieldField< Field, Type > & boundaryCoeffs()
fvBoundary scalar field containing pseudo-matrix coeffs
Definition: fvMatrix.H:313
virtual ~fvMatrix()
Destructor.
Definition: fvMatrix.C:467
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
tmp< fvMatrix< Type > > clone() const
Clone.
Definition: fvMatrix.C:455
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Field< Type > & source()
Definition: fvMatrix.H:294
void operator*=(const volScalarField::Internal &)
Definition: fvMatrix.C:1191
void operator+=(const fvMatrix< Type > &)
Definition: fvMatrix.C:1022
ClassName("fvMatrix")
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
Definition: fvMatrix.C:713
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Definition: lduMatrix.H:79
GeometricField< Type, fvsPatchField, surfaceMesh > * surfaceTypeFieldPtr
Declare return type of the faceFluxCorrectionPtr() function.
Definition: fvMatrix.H:321
tmp< volScalarField > A() const
Return the central coefficient.
Definition: fvMatrix.C:737
label patchi
A scalar instance of fvMatrix.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
A List with indirect addressing.
Definition: fvMatrix.H:106
autoPtr< fvSolver > solver()
Construct and return the solver.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void setValuesFromList(const labelUList &cells, const ListType< Type > &values)
Set solution in given cells to the specified values.
Definition: fvMatrix.C:178
void checkMethod(const fvMatrix< Type > &, const fvMatrix< Type > &, const char *)
Definition: fvMatrix.C:1264
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
void addBoundarySource(Field< Type > &source, const bool couples=true) const
Definition: fvMatrix.C:145
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution.
Definition: fvMatrixSolve.C:33
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
Definition: fvMatrix.C:876
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
Definition: fvMatrix.C:691
A class for managing temporary objects.
Definition: PtrList.H:53
scalarField & diag()
Definition: lduMatrix.C:186
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< Field< Type > > residual() const
Return the matrix residual.
fvMatrix(const GeometricField< Type, fvPatchField, volMesh > &, const dimensionSet &)
Construct given a field to solve for.
Definition: fvMatrix.C:268
Namespace for OpenFOAM.
const dimensionSet & dimensions() const
Definition: fvMatrix.H:289