43 #ifndef Foam_fvMatrix_H 44 #define Foam_fvMatrix_H 62 template<
class Type>
class fvMatrix;
63 template<
class T>
class UIndirectList;
66 Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
70 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
72 const fvMatrix<Type>&,
73 const DimensionedField<Type, volMesh>&
77 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
79 const fvMatrix<Type>&,
80 const tmp<DimensionedField<Type, volMesh>>&
84 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
86 const fvMatrix<Type>&,
87 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
91 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
93 const tmp<fvMatrix<Type>>&,
94 const DimensionedField<Type, volMesh>&
98 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
100 const tmp<fvMatrix<Type>>&,
101 const tmp<DimensionedField<Type, volMesh>>&
105 tmp<GeometricField<Type, fvPatchField, volMesh>>
operator&
107 const tmp<fvMatrix<Type>>&,
108 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
155 word lduAssemblyName_;
175 mutable std::unique_ptr<faceFluxFieldType> faceFluxCorrectionPtr_;
187 template<
class Type2>
195 template<
class Type2>
204 template<
class Type2>
212 template<
class Type2>
241 const bool couples=
true 248 template<
template<
class>
class ListType>
252 const ListType<Type>&
values 275 solver_(
std::move(sol))
341 return (nMatrix_ == 0 ? 1 : nMatrix_);
344 const fvMatrix<Type>&
matrix(
const label i)
const 346 return (nMatrix_ == 0 ? *
this : subMatrices_[i]);
349 fvMatrix<Type>&
matrix(
const label i)
351 return (nMatrix_ == 0 ? *
this : subMatrices_[i]);
418 (i == 0 && nMatrix_ == 0) ? psi_ :
matrix(i).
psi()
423 GeometricField<Type, fvPatchField, volMesh>&
psi 430 (i == 0 && nMatrix_ == 0)
433 GeometricField<Type, fvPatchField, volMesh>&
437 GeometricField<Type, fvPatchField, volMesh>&
448 subMatrices_.
clear();
472 return internalCoeffs_;
479 return internalCoeffs_;
486 return boundaryCoeffs_;
493 return boundaryCoeffs_;
502 return faceFluxCorrectionPtr_;
508 faceFluxCorrectionPtr_.reset(
flux);
514 return bool(faceFluxCorrectionPtr_);
549 const bool forceReference =
false 557 const bool forceReference =
false 565 const bool forceReference =
false 700 void operator*=(
const tmp<volScalarField::Internal>&);
708 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
711 const fvMatrix<Type>&,
712 const DimensionedField<Type, volMesh>&
715 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
718 const fvMatrix<Type>&,
719 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
722 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
725 const tmp<fvMatrix<Type>>&,
726 const DimensionedField<Type, volMesh>&
729 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
732 const tmp<fvMatrix<Type>>&,
733 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
739 friend Ostream& operator<< <Type>
742 const fvMatrix<Type>&
752 const fvMatrix<Type>&,
753 const fvMatrix<Type>&,
760 const fvMatrix<Type>&,
761 const DimensionedField<Type, volMesh>&,
768 const fvMatrix<Type>&,
769 const dimensioned<Type>&,
777 SolverPerformance<Type>
solve 780 const dictionary& solverControls
787 SolverPerformance<Type>
solve 789 const tmp<fvMatrix<Type>>&,
790 const dictionary& solverControls
797 SolverPerformance<Type>
solve(fvMatrix<Type>&,
const word&
name);
803 SolverPerformance<Type>
solve(
const tmp<fvMatrix<Type>>&,
const word&
name);
809 SolverPerformance<Type>
solve(fvMatrix<Type>&);
815 SolverPerformance<Type>
solve(
const tmp<fvMatrix<Type>>&);
821 tmp<fvMatrix<Type>>
correction(
const fvMatrix<Type>&);
827 tmp<fvMatrix<Type>>
correction(
const tmp<fvMatrix<Type>>&);
833 tmp<fvMatrix<Type>>
operator==
835 const fvMatrix<Type>&,
836 const fvMatrix<Type>&
840 tmp<fvMatrix<Type>>
operator==
842 const tmp<fvMatrix<Type>>&,
843 const fvMatrix<Type>&
847 tmp<fvMatrix<Type>>
operator==
849 const fvMatrix<Type>&,
850 const tmp<fvMatrix<Type>>&
854 tmp<fvMatrix<Type>>
operator==
856 const tmp<fvMatrix<Type>>&,
857 const tmp<fvMatrix<Type>>&
1005 template<
class Type>
1012 template<
class Type>
1019 template<
class Type>
1026 template<
class Type>
1033 template<
class Type>
1040 template<
class Type>
1047 template<
class Type>
1054 template<
class Type>
1062 template<
class Type>
1069 template<
class Type>
1076 template<
class Type>
1083 template<
class Type>
1091 template<
class Type>
1098 template<
class Type>
1105 template<
class Type>
1112 template<
class Type>
1120 template<
class Type>
1127 template<
class Type>
1134 template<
class Type>
1141 template<
class Type>
1148 template<
class Type>
1155 template<
class Type>
1162 template<
class Type>
1169 template<
class Type>
1176 template<
class Type>
1183 template<
class Type>
1190 template<
class Type>
1197 template<
class Type>
1205 template<
class Type>
1212 template<
class Type>
1219 template<
class Type>
1226 template<
class Type>
1234 template<
class Type>
1241 template<
class Type>
1248 template<
class Type>
1255 template<
class Type>
1262 template<
class Type>
1269 template<
class Type>
1277 template<
class Type>
1284 template<
class Type>
void mapContributions(label fieldi, const FieldField< Field, Type > &fluxContrib, FieldField< Field, Type > &contrib, bool internal) const
Add internal and boundary contribution to local patches.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
GeometricField< Type, fvsPatchField, surfaceMesh > faceFluxFieldType
Field type for face flux (for non-orthogonal correction)
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
const scalarField & diag() const
tmp< fvMatrix< Type > > clone() const
Construct and return a clone.
void setValuesFromList(const labelUList &cellLabels, const ListType< Type > &values)
Set solution in given cells to the specified values.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
void createOrUpdateLduPrimitiveAssembly()
Create or update ldu assembly.
void relax()
Relax matrix (for steady-state solution).
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void negate()
Inplace negate.
const lduPrimitiveMeshAssembly & lduMeshAssembly()
Return optional lduAdressing.
void addCmptAvBoundaryDiag(scalarField &diag) const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
void manipulateMatrix(direction cmp)
Manipulate matrix.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
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 operator-=(const fvMatrix< Type > &)
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Solver class returned by the solver function used for systems in which it is useful to cache the solv...
bool checkImplicit(const label fieldi=0)
Name the implicit assembly addressing.
Generic GeometricField class.
Generic dimensioned Type class.
tmp< volScalarField > H1() const
Return H(1)
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
DimensionedField< scalar, volMesh > Internal
The internal field type from which this GeometricField is derived.
const labelListList & patchMap() const
Return patchMap.
void clear()
Clear multiple fvMatrices.
A field of fields is a PtrList of fields with reference counting.
tmp< scalarField > D() const
Return the matrix scalar diagonal.
void operator=(const fvMatrix< Type > &)
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
GeometricField< Type, fvPatchField, volMesh > psiFieldType
The geometric field type for psi.
Mesh data needed to do the Finite Volume discretisation.
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void addFvMatrix(fvMatrix< Type > &matrix)
Add fvMatrix.
Generic templated field type.
void setInterfaces(lduInterfaceFieldPtrsList &, PtrDynList< lduInterfaceField > &newInterfaces)
Set interfaces.
A class for handling words, derived from Foam::string.
void setReferences(const labelUList &cellLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
bool hasFaceFluxCorrection() const noexcept
True if face-flux non-orthogonal correction field exists.
virtual ~fvMatrix()
Destructor.
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.
void transferFvMatrixCoeffs()
Transfer lower, upper, diag and source to this fvMatrix.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
fvMatrix(const GeometricField< Type, fvPatchField, volMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
fvSolver(fvMatrix< Type > &fvMat, autoPtr< lduMatrix::solver > &&sol)
SolverPerformance< Type > solveSegregatedOrCoupled()
Solve segregated or coupled returning the solution statistics.
void operator*=(const volScalarField::Internal &)
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
A dynamically resizable PtrList with allocation management.
faceFluxFieldPtrType & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
lduPrimitiveMeshAssembly * lduMeshPtr()
Access to lduPrimitiveMeshAssembly.
void operator+=(const fvMatrix< Type > &)
Field< Type > & source() noexcept
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
tmp< volScalarField > A() const
Return the central coefficient.
const dimensionSet & dimensions() const noexcept
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
A scalar instance of fvMatrix.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
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 clear()
Clear the PtrList. Delete allocated entries and set size to zero.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void addBoundarySource(Field< Type > &source, const bool couples=true) const
const FieldField< Field, Type > & internalCoeffs() const noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for internal cells
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
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.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for boundary cells
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
A class for managing temporary objects.
const fvMatrix< Type > & matrix(const label i) const
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< Field< Type > > residual() const
Return the matrix residual.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void setBounAndInterCoeffs()
Manipulate boundary/internal coeffs for coupling.
label globalPatchID(const label fieldi, const label patchi) const
std::unique_ptr< faceFluxFieldType > faceFluxFieldPtrType
Declare return type of the faceFluxCorrectionPtr() function.
const dictionary & solverDict() const
Return the solver dictionary for psi, taking into account finalIteration.