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_;
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_;
503 return faceFluxCorrectionPtr_;
509 return bool(faceFluxCorrectionPtr_);
544 const bool forceReference =
false 552 const bool forceReference =
false 560 const bool forceReference =
false 695 void operator*=(
const tmp<volScalarField::Internal>&);
703 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
706 const fvMatrix<Type>&,
707 const DimensionedField<Type, volMesh>&
710 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
713 const fvMatrix<Type>&,
714 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
717 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
720 const tmp<fvMatrix<Type>>&,
721 const DimensionedField<Type, volMesh>&
724 friend tmp<GeometricField<Type, fvPatchField, volMesh>>
727 const tmp<fvMatrix<Type>>&,
728 const tmp<GeometricField<Type, fvPatchField, volMesh>>&
734 friend Ostream& operator<< <Type>
737 const fvMatrix<Type>&
747 const fvMatrix<Type>&,
748 const fvMatrix<Type>&,
755 const fvMatrix<Type>&,
756 const DimensionedField<Type, volMesh>&,
763 const fvMatrix<Type>&,
764 const dimensioned<Type>&,
772 SolverPerformance<Type>
solve 775 const dictionary& solverControls
782 SolverPerformance<Type>
solve 784 const tmp<fvMatrix<Type>>&,
785 const dictionary& solverControls
792 SolverPerformance<Type>
solve(fvMatrix<Type>&,
const word&
name);
798 SolverPerformance<Type>
solve(
const tmp<fvMatrix<Type>>&,
const word&
name);
804 SolverPerformance<Type>
solve(fvMatrix<Type>&);
810 SolverPerformance<Type>
solve(
const tmp<fvMatrix<Type>>&);
816 tmp<fvMatrix<Type>>
correction(
const fvMatrix<Type>&);
822 tmp<fvMatrix<Type>>
correction(
const tmp<fvMatrix<Type>>&);
828 tmp<fvMatrix<Type>>
operator==
830 const fvMatrix<Type>&,
831 const fvMatrix<Type>&
835 tmp<fvMatrix<Type>>
operator==
837 const tmp<fvMatrix<Type>>&,
838 const fvMatrix<Type>&
842 tmp<fvMatrix<Type>>
operator==
844 const fvMatrix<Type>&,
845 const tmp<fvMatrix<Type>>&
849 tmp<fvMatrix<Type>>
operator==
1000 template<
class Type>
1007 template<
class Type>
1014 template<
class Type>
1021 template<
class Type>
1028 template<
class Type>
1035 template<
class Type>
1042 template<
class Type>
1049 template<
class Type>
1057 template<
class Type>
1064 template<
class Type>
1071 template<
class Type>
1078 template<
class Type>
1086 template<
class Type>
1093 template<
class Type>
1100 template<
class Type>
1107 template<
class Type>
1115 template<
class Type>
1122 template<
class Type>
1129 template<
class Type>
1136 template<
class Type>
1143 template<
class Type>
1150 template<
class Type>
1157 template<
class Type>
1164 template<
class Type>
1171 template<
class Type>
1178 template<
class Type>
1185 template<
class Type>
1192 template<
class Type>
1200 template<
class Type>
1207 template<
class Type>
1214 template<
class Type>
1221 template<
class Type>
1229 template<
class Type>
1236 template<
class Type>
1243 template<
class Type>
1250 template<
class Type>
1257 template<
class Type>
1264 template<
class Type>
1272 template<
class Type>
1279 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...
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.
UList< label > labelUList
A UList of labels.
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.
GeometricField< Type, fvsPatchField, surfaceMesh > * faceFluxFieldPtrType
Declare return type of the faceFluxCorrectionPtr() function.
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
const dictionary & solverDict() const
Return the solver dictionary for psi, taking into account finalIteration.