Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::faMatrix
29
30Description
31 Finite-Area matrix.
32
33SourceFiles
34 faMatrix.C
35 faMatrixSolve.C
36
37Author
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
52namespace Foam
53{
54
55// Forward Declarations
56template<class Type> class faMatrix;
57template<class T> class UIndirectList;
59template<class Type>
61
62template<class Type>
64(
67);
68
69template<class Type>
71(
74);
75
76template<class Type>
78(
81);
82
83template<class Type>
85(
88);
89
90template<class Type>
92(
95);
96
97template<class Type>
99(
100 const tmp<faMatrix<Type>>&,
102);
103
104/*---------------------------------------------------------------------------*\
105 Class faMatrix Declaration
106\*---------------------------------------------------------------------------*/
107
108template<class Type>
109class faMatrix
110:
111 public refCount,
112 public lduMatrix
113{
114public:
115
116 // Public Types
117
118 //- The geometric field type for psi
119 typedef
122
123 //- Field type for face flux (for non-orthogonal correction)
124 typedef
127
130
131private:
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
157protected:
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>
168 (
169 const labelUList& addr,
170 const Field<Type2>& pf,
171 Field<Type2>& intf
172 ) const;
173
174 template<class Type2>
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
203 (
205 const direction cmpt
206 ) const;
207
209
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>
222 (
223 const labelUList& faceLabels,
224 const ListType<Type>& values
225 );
227
228public:
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
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
269 (
271 const dimensionSet& ds
272 );
273
274 //- Copy construct
275 faMatrix(const faMatrix<Type>&);
276
277 //- Copy/move construct from 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")
284 (
286 Istream& is
287 )
288 :
289 faMatrix<Type>(psi, dimensionSet(is))
290 {}
291
292 //- Construct and return a clone
294 {
295 return tmp<faMatrix<Type>>::New(*this);
296 }
297
299 //- Destructor
300 virtual ~faMatrix();
301
302
303 // Member Functions
304
305 // Access
306
308 {
309 return psi_;
310 }
311
313 {
314 return dimensions_;
315 }
316
318 {
319 return source_;
321
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
329 const FieldField<Field, Type>& internalCoeffs() const noexcept
330 {
331 return internalCoeffs_;
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
344 {
345 return boundaryCoeffs_;
346 }
347
348 //- faBoundary scalar field containing pseudo-matrix coeffs
349 //- for boundary cells
351 {
352 return boundaryCoeffs_;
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
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
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 (
400 const UIndirectList<Type>& values
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();
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+=(Foam::zero) {}
514 void operator-=(Foam::zero) {}
515
518 void operator*=(const tmp<areaScalarField>&);
519
520 void operator*=(const dimensioned<scalar>&);
521
522
523 // Friend Operators
524
526 operator& <Type>
527 (
528 const faMatrix<Type>&,
530 );
531
533 operator& <Type>
534 (
535 const faMatrix<Type>&,
537 );
538
540 operator& <Type>
541 (
542 const tmp<faMatrix<Type>>&,
544 );
545
547 operator& <Type>
548 (
551 );
552
553
554 // Ostream Operator
555
556 friend Ostream& operator<< <Type>
557 (
558 Ostream&,
560 );
561};
562
563
564// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
565
566template<class Type>
567void checkMethod
568(
570 const faMatrix<Type>&,
571 const char*
572);
573
574template<class Type>
575void checkMethod
576(
577 const faMatrix<Type>&,
579 const char*
580);
581
582template<class Type>
583void checkMethod
586 const dimensioned<Type>&,
587 const char*
588);
589
591//- Solve returning the solution statistics given convergence tolerance
592// Use the given solver controls
593template<class Type>
597 const dictionary& solverControls
600//- Solve returning the solution statistics given convergence tolerance,
601//- deleting temporary matrix after solution.
602// Use the given solver controls
603template<class 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
613template<class Type>
616//- Solve returning the solution statistics given convergence tolerance,
617//- deleting temporary matrix after solution.
618// Uses \p name solver controls from faSolution
619template<class Type>
621
623//- Solve returning the solution statistics given convergence tolerance
624// Uses solver controls from faSolution
625template<class Type>
627
628//- Solve returning the solution statistics given convergence tolerance,
629//- deleting temporary matrix after solution.
630// Uses solver controls from faSolution
631template<class Type>
633
634
635// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
636
637//- Unary negation
638template<class Type>
639tmp<faMatrix<Type>> operator-
640(
641 const faMatrix<Type>&
643
644//- Unary negation
645template<class Type>
646tmp<faMatrix<Type>> operator-
647(
648 const tmp<faMatrix<Type>>&
650
651
652template<class Type>
653tmp<faMatrix<Type>> operator+
654(
655 const faMatrix<Type>&,
656 const faMatrix<Type>&
657);
659template<class Type>
660tmp<faMatrix<Type>> operator+
661(
662 const tmp<faMatrix<Type>>&,
663 const faMatrix<Type>&
664);
665
666template<class Type>
667tmp<faMatrix<Type>> operator+
668(
669 const faMatrix<Type>&,
670 const tmp<faMatrix<Type>>&
671);
672
673template<class Type>
674tmp<faMatrix<Type>> operator+
675(
676 const tmp<faMatrix<Type>>&,
677 const tmp<faMatrix<Type>>&
678);
679
680
681template<class Type>
682tmp<faMatrix<Type>> operator-
683(
684 const faMatrix<Type>&,
685 const faMatrix<Type>&
686);
687
688template<class Type>
689tmp<faMatrix<Type>> operator-
690(
691 const tmp<faMatrix<Type>>&,
692 const faMatrix<Type>&
693);
694
695template<class Type>
696tmp<faMatrix<Type>> operator-
697(
698 const faMatrix<Type>&,
700);
701
702template<class Type>
703tmp<faMatrix<Type>> operator-
704(
705 const tmp<faMatrix<Type>>&,
706 const tmp<faMatrix<Type>>&
707);
708
709
710template<class Type>
711tmp<faMatrix<Type>> operator==
713 const faMatrix<Type>&,
714 const faMatrix<Type>&
715);
716
717template<class Type>
718tmp<faMatrix<Type>> operator==
719(
720 const tmp<faMatrix<Type>>&,
721 const faMatrix<Type>&
722);
723
724template<class Type>
726(
727 const faMatrix<Type>&,
728 const tmp<faMatrix<Type>>&
729);
730
731template<class Type>
732tmp<faMatrix<Type>> operator==
733(
735 const tmp<faMatrix<Type>>&
736);
737
738
739template<class Type>
740tmp<faMatrix<Type>> operator+
741(
742 const faMatrix<Type>&,
744);
745
746template<class Type>
747tmp<faMatrix<Type>> operator+
748(
749 const faMatrix<Type>&,
751);
753template<class Type>
754tmp<faMatrix<Type>> operator+
755(
756 const faMatrix<Type>&,
758);
759
760template<class Type>
762(
763 const tmp<faMatrix<Type>>&,
765);
766
767template<class Type>
768tmp<faMatrix<Type>> operator+
769(
772);
773
774template<class Type>
775tmp<faMatrix<Type>> operator+
776(
779);
780
781template<class Type>
782tmp<faMatrix<Type>> operator+
783(
785 const faMatrix<Type>&
786);
787
788template<class Type>
789tmp<faMatrix<Type>> operator+
790(
792 const faMatrix<Type>&
793);
794
795template<class Type>
796tmp<faMatrix<Type>> operator+
797(
799 const faMatrix<Type>&
800);
801
802template<class Type>
803tmp<faMatrix<Type>> operator+
804(
807);
808
809template<class Type>
810tmp<faMatrix<Type>> operator+
811(
814);
815
816template<class Type>
817tmp<faMatrix<Type>> operator+
818(
821);
822
823template<class Type>
824tmp<faMatrix<Type>> operator-
825(
826 const faMatrix<Type>&,
828);
829
830template<class Type>
831tmp<faMatrix<Type>> operator-
832(
833 const faMatrix<Type>&,
836
837template<class Type>
838tmp<faMatrix<Type>> operator-
839(
840 const faMatrix<Type>&,
843
844template<class Type>
845tmp<faMatrix<Type>> operator-
846(
847 const tmp<faMatrix<Type>>&,
850
851template<class Type>
852tmp<faMatrix<Type>> operator-
853(
854 const tmp<faMatrix<Type>>&,
857
858template<class Type>
859tmp<faMatrix<Type>> operator-
860(
861 const tmp<faMatrix<Type>>&,
863);
865
866template<class Type>
867tmp<faMatrix<Type>> operator-
868(
870 const faMatrix<Type>&
872
873template<class Type>
874tmp<faMatrix<Type>> operator-
875(
877 const faMatrix<Type>&
879
880template<class Type>
881tmp<faMatrix<Type>> operator-
882(
884 const faMatrix<Type>&
886
887template<class Type>
888tmp<faMatrix<Type>> operator-
889(
891 const tmp<faMatrix<Type>>&
893
894template<class Type>
895tmp<faMatrix<Type>> operator-
896(
898 const tmp<faMatrix<Type>>&
900
901template<class Type>
902tmp<faMatrix<Type>> operator-
903(
905 const tmp<faMatrix<Type>>&
907
908template<class Type>
909tmp<faMatrix<Type>> operator+
910(
911 const faMatrix<Type>&,
912 const dimensioned<Type>&
914
915template<class Type>
916tmp<faMatrix<Type>> operator+
917(
918 const tmp<faMatrix<Type>>&,
919 const dimensioned<Type>&
921
922template<class Type>
923tmp<faMatrix<Type>> operator+
924(
925 const dimensioned<Type>&,
926 const faMatrix<Type>&
928
929template<class Type>
930tmp<faMatrix<Type>> operator+
931(
932 const dimensioned<Type>&,
933 const tmp<faMatrix<Type>>&
935
936template<class Type>
937tmp<faMatrix<Type>> operator-
938(
939 const faMatrix<Type>&,
940 const dimensioned<Type>&
942
943template<class Type>
944tmp<faMatrix<Type>> operator-
945(
946 const tmp<faMatrix<Type>>&,
947 const dimensioned<Type>&
949
950template<class Type>
951tmp<faMatrix<Type>> operator-
952(
953 const dimensioned<Type>&,
954 const faMatrix<Type>&
956
957template<class Type>
958tmp<faMatrix<Type>> operator-
959(
960 const dimensioned<Type>&,
961 const tmp<faMatrix<Type>>&
963
964template<class Type>
965tmp<faMatrix<Type>> operator==
966(
967 const faMatrix<Type>&,
970
971template<class Type>
972tmp<faMatrix<Type>> operator==
973(
974 const faMatrix<Type>&,
977
978template<class Type>
979tmp<faMatrix<Type>> operator==
980(
981 const faMatrix<Type>&,
984
985template<class Type>
986tmp<faMatrix<Type>> operator==
987(
988 const tmp<faMatrix<Type>>&,
990);
992template<class Type>
993tmp<faMatrix<Type>> operator==
994(
995 const tmp<faMatrix<Type>>&,
997);
999template<class Type>
1000tmp<faMatrix<Type>> operator==
1001(
1002 const tmp<faMatrix<Type>>&,
1004);
1006template<class Type>
1007tmp<faMatrix<Type>> operator==
1008(
1009 const faMatrix<Type>&,
1010 const dimensioned<Type>&
1011);
1013template<class Type>
1014tmp<faMatrix<Type>> operator==
1015(
1016 const tmp<faMatrix<Type>>&,
1017 const dimensioned<Type>&
1018);
1020
1021template<class Type>
1022tmp<faMatrix<Type>> operator==
1023(
1024 const faMatrix<Type>&,
1025 const Foam::zero
1027
1028template<class Type>
1029tmp<faMatrix<Type>> operator==
1030(
1031 const tmp<faMatrix<Type>>&,
1032 const Foam::zero
1034
1035
1036template<class Type>
1037tmp<faMatrix<Type>> operator*
1038(
1041);
1042
1043template<class Type>
1044tmp<faMatrix<Type>> operator*
1045(
1048);
1049
1050template<class Type>
1051tmp<faMatrix<Type>> operator*
1052(
1053 const tmp<areaScalarField>&,
1055);
1056
1057template<class Type>
1058tmp<faMatrix<Type>> operator*
1059(
1062);
1063
1064template<class Type>
1065tmp<faMatrix<Type>> operator*
1066(
1069);
1070
1071template<class Type>
1072tmp<faMatrix<Type>> operator*
1073(
1074 const tmp<areaScalarField>&,
1076);
1077
1078
1079template<class Type>
1080tmp<faMatrix<Type>> operator*
1081(
1083 const faMatrix<Type>&
1084);
1085
1086template<class Type>
1087tmp<faMatrix<Type>> operator*
1088(
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
1104// Specialisation for scalars
1105
1106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1107
1108#endif
1109
1110// ************************************************************************* //
labelList faceLabels(nFaceLabels)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
Generic GeometricField class.
DimensionedField< scalar, areaMesh > Internal
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics.
A List with indirect addressing. Like IndirectList but does not store addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
Mesh data needed to do the Finite Area discretisation.
Definition areaFaMesh.H:50
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
SolverPerformance< Type > solve(const dictionary &solverControls)
Solve returning the solution statistics.
faSolver(faMatrix< Type > &faMat, autoPtr< lduMatrix::solver > &&sol)
Definition faMatrix.H:264
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition faMatrix.H:108
faMatrix(const tmp< faMatrix< Type > > &)
Copy/move construct from tmp<faMatrix<Type>>.
Definition faMatrix.C:241
void setValues(const labelUList &faceLabels, const UList< Type > &values)
Set solution in given faces to the specified values and eliminate the corresponding equations from th...
Definition faMatrix.C:398
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition faMatrix.C:484
void operator+=(const dimensioned< Type > &)
Definition faMatrix.C:934
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
Definition faMatrix.C:33
void operator*=(const dimensioned< scalar > &)
Definition faMatrix.C:1005
const Field< Type > & source() const noexcept
Definition faMatrix.H:363
void operator*=(const tmp< areaScalarField > &)
Definition faMatrix.C:994
void operator=(const faMatrix< Type > &)
Definition faMatrix.C:744
SolverPerformance< Type > solve(const word &name)
Solve returning the solution statistics.
GeometricField< scalar, faePatchField, edgeMesh > faceFluxFieldType
Definition faMatrix.H:125
const FieldField< Field, Type > & internalCoeffs() const noexcept
faBoundary scalar field containing pseudo-matrix coeffs for internal cells
Definition faMatrix.H:372
void operator+=(const DimensionedField< Type, areaMesh > &)
Definition faMatrix.C:868
void relax()
Relax matrix (for steady-state solution).
Definition faMatrix.C:574
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void setReferences(const labelUList &faceLabels, const UList< Type > &values, const bool forceReference=false)
Set reference level for solution.
Definition faMatrix.C:462
std::unique_ptr< faceFluxFieldType > faceFluxFieldPtrType
Definition faMatrix.H:407
tmp< faMatrix< Type > > clone() const
Construct and return a clone.
Definition faMatrix.H:332
void operator+=(Foam::zero)
Definition faMatrix.H:615
faceFluxFieldPtrType & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
Definition faMatrix.H:412
FieldField< Field, Type > & internalCoeffs() noexcept
faBoundary scalar field containing pseudo-matrix coeffs for internal cells
Definition faMatrix.H:381
tmp< GeometricField< scalar, faePatchField, edgeMesh > > flux() const
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:387
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition faMatrix.H:390
ClassName("faMatrix")
void setReference(const label facei, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition faMatrix.C:420
void setValues(const labelUList &faceLabels, const UIndirectList< Type > &values)
Set solution in given faces to the specified values and eliminate the corresponding equations from th...
Definition faMatrix.C:409
void setReferences(const labelUList &faceLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
Definition faMatrix.C:439
void operator+=(const faMatrix< Type > &)
Definition faMatrix.C:801
faMatrix(const faMatrix< Type > &)
Copy construct.
Definition faMatrix.C:218
const GeometricField< scalar, faPatchField, areaMesh > & psi() const
Definition faMatrix.H:348
const dimensionSet & dimensions() const noexcept
Definition faMatrix.H:353
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
Definition faMatrix.C:619
void addCmptAvBoundaryDiag(scalarField &diag) const
Definition faMatrix.C:126
void addBoundarySource(Field< Type > &source, const bool couples=true) const
Definition faMatrix.C:142
friend class faSolver
Declare friendship with the faSolver class.
Definition faMatrix.H:174
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.
GeometricField< scalar, faPatchField, areaMesh > psiFieldType
Definition faMatrix.H:118
virtual ~faMatrix()
Destructor.
Definition faMatrix.C:276
void operator+=(const tmp< faMatrix< Type > > &)
Definition faMatrix.C:826
void operator-=(const dimensioned< Type > &)
Definition faMatrix.C:944
const dictionary & solverDict(const word &name) const
Return the solver dictionary (from faSolution) for name.
Definition faMatrix.C:723
void operator-=(Foam::zero)
Definition faMatrix.H:616
tmp< areaScalarField > A() const
Return the central coefficient.
Definition faMatrix.C:600
void operator-=(const faMatrix< Type > &)
Definition faMatrix.C:834
tmp< Field< Type > > residual() const
Return the matrix residual.
void faceFluxCorrectionPtr(faceFluxFieldType *flux)
Set pointer to face-flux non-orthogonal correction field.
Definition faMatrix.H:420
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
Definition faMatrix.C:108
void negate()
Inplace negate.
Definition faMatrix.C:786
faMatrix(const GeometricField< Type, faPatchField, areaMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
Definition faMatrix.C:176
void setValuesFromList(const labelUList &faceLabels, const ListType< Type > &values)
Set solution in given faces to the specified values.
Definition faMatrix.C:288
void operator+=(const tmp< DimensionedField< Type, areaMesh > > &)
Definition faMatrix.C:879
void operator-=(const tmp< faMatrix< Type > > &)
Definition faMatrix.C:859
void operator-=(const tmp< DimensionedField< Type, areaMesh > > &)
Definition faMatrix.C:912
tmp< scalarField > D() const
Return the matrix diagonal.
Definition faMatrix.C:591
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
Definition faMatrix.C:71
void addToInternalField(const labelUList &addr, const tmp< Field< Type2 > > &tpf, Field< Type2 > &intf) const
Definition faMatrix.C:57
void subtractFromInternalField(const labelUList &addr, const tmp< Field< Type2 > > &tpf, Field< Type2 > &intf) const
Definition faMatrix.C:95
bool hasFaceFluxCorrection() const noexcept
True if face-flux non-orthogonal correction field exists.
Definition faMatrix.H:428
void operator-=(const DimensionedField< Type, areaMesh > &)
Definition faMatrix.C:901
void operator*=(const tmp< areaScalarField::Internal > &)
Definition faMatrix.C:983
FieldField< Field, Type > & boundaryCoeffs() noexcept
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition faMatrix.H:399
void operator=(const tmp< faMatrix< Type > > &)
Definition faMatrix.C:778
Field< scalar > & source() noexcept
Definition faMatrix.H:358
const dictionary & solverDict() const
Return the solver dictionary for psi.
Definition faMatrix.C:732
void operator*=(const areaScalarField::Internal &)
Definition faMatrix.C:954
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
lduMatrix(const lduMesh &mesh)
Construct (without coefficients) for an LDU addressed mesh.
Definition lduMatrix.C:54
const scalarField & diag() const
Definition lduMatrix.C:195
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
Namespace for OpenFOAM.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
Definition faMatrix.C:1026
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
uint8_t direction
Definition direction.H:49
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
UList< label > labelUList
A UList of labels.
Definition UList.H:75
volScalarField & alpha
CEqn solve()
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43