43#ifndef Foam_fvMatrix_H
44#define Foam_fvMatrix_H
157 word lduAssemblyName_;
177 mutable std::unique_ptr<faceFluxFieldType> faceFluxCorrectionPtr_;
183 friend class fvSolver;
189 template<
class Type2>
197 template<
class Type2>
206 template<
class Type2>
214 template<
class Type2>
243 const bool couples=
true
250 template<
template<
class>
class ListType>
254 const ListType<Type>& values
277 solver_(std::move(sol))
343 return (nMatrix_ == 0 ? 1 : nMatrix_);
348 return (nMatrix_ == 0 ? *
this : subMatrices_[i]);
353 return (nMatrix_ == 0 ? *
this : subMatrices_[i]);
420 (i == 0 && nMatrix_ == 0) ? psi_ :
matrix(i).
psi()
425 GeometricField<Type, fvPatchField, volMesh>&
psi
432 (i == 0 && nMatrix_ == 0)
450 subMatrices_.
clear();
474 return internalCoeffs_;
481 return internalCoeffs_;
488 return boundaryCoeffs_;
495 return boundaryCoeffs_;
504 return faceFluxCorrectionPtr_;
510 faceFluxCorrectionPtr_.reset(
flux);
516 return bool(faceFluxCorrectionPtr_);
551 const bool forceReference =
false
559 const bool forceReference =
false
567 const bool forceReference =
false
702 void operator*=(
const tmp<volScalarField::Internal>&);
741 friend Ostream& operator<< <Type>
759 typename E::DiagExpr,
760 typename E::UpperExpr,
761 typename E::LowerExpr,
762 typename E::FaceFluxExpr,
763 typename E::SourceExpr
780 typename E::DiagExpr,
781 typename E::UpperExpr,
782 typename E::LowerExpr,
783 typename E::FaceFluxExpr,
784 typename E::SourceExpr
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Expression wrap of const reference to fvMatrix.
A field of fields is a PtrList of fields with reference counting.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
DimensionedField< scalar, volMesh > Internal
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A dynamically resizable PtrList with allocation management.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
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...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
fvSolver(fvMatrix< Type > &fvMat, autoPtr< lduMatrix::solver > &&sol)
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void operator*=(const tmp< volScalarField > &)
void operator+=(const tmp< DimensionedField< Type, volMesh > > &)
void operator-=(const fvMatrix< Type > &)
autoPtr< fvSolver > solver()
Construct and return the solver.
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
void operator+=(const dimensioned< Type > &)
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > flux() const
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
tmp< volScalarField > A() const
Return the central coefficient.
fvMatrix(const GeometricField< Type, fvPatchField, volMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
void manipulateMatrix(direction cmp)
Manipulate matrix.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
label globalPatchID(const label fieldi, const label patchi) const
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 setReferences(const labelUList &cellLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
void operator*=(const dimensioned< scalar > &)
const Field< Type > & source() const noexcept
SolverPerformance< Type > solve(const word &name)
Solve returning the solution statistics.
const FieldField< Field, Type > & internalCoeffs() const noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for internal cells
void transferFvMatrixCoeffs()
Transfer lower, upper, diag and source to this fvMatrix.
void relax()
Relax matrix (for steady-state solution).
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void operator+=(const tmp< fvMatrix< Type > > &)
void operator-=(const tmp< DimensionedField< Type, volMesh > > &)
fvMatrix(const fvMatrix< Type > &)
Copy construct.
std::unique_ptr< faceFluxFieldType > faceFluxFieldPtrType
tmp< volScalarField > H1() const
Return H(1).
void operator+=(const fvMatrix< Type > &)
const fvMatrix< Type > & matrix(const label i) const
void createOrUpdateLduPrimitiveAssembly()
Create or update ldu assembly.
void operator+=(Foam::zero)
autoPtr< fvSolver > solver(const dictionary &)
Construct and return the solver.
faceFluxFieldPtrType & faceFluxCorrectionPtr()
Return pointer to face-flux non-orthogonal correction field.
FieldField< Field, Type > & internalCoeffs() noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for internal cells
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for boundary cells
GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0)
virtual ~fvMatrix()
Destructor.
void operator*=(const tmp< volScalarField::Internal > &)
GeometricField< scalar, fvPatchField, volMesh > psiFieldType
GeometricField< scalar, fvsPatchField, surfaceMesh > faceFluxFieldType
SolverPerformance< Type > solveSegregatedOrCoupled()
Solve segregated or coupled 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 operator+=(const DimensionedField< Type, volMesh > &)
const dimensionSet & dimensions() const noexcept
const lduPrimitiveMeshAssembly & lduMeshAssembly()
Return optional lduAdressing.
void operator*=(const volScalarField::Internal &)
const lduPrimitiveMeshAssembly * lduMeshPtr() const
Const Access to lduPrimitiveMeshAssembly.
void addCmptAvBoundaryDiag(scalarField &diag) const
void addBoundarySource(Field< Type > &source, const bool couples=true) const
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
void setValues(const labelUList &cellLabels, const UIndirectList< Type > &values)
Set solution in given cells to the specified values and eliminate the corresponding equations from th...
void operator=(const tmp< fvMatrix< Type > > &)
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.
fvMatrix(const GeometricField< Type, fvPatchField, volMesh > &psi, const Expression::fvMatrixExpression< E, typename E::DiagExpr, typename E::UpperExpr, typename E::LowerExpr, typename E::FaceFluxExpr, typename E::SourceExpr > &expr)
Construct given a field to solve for and expressions for all the components.
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
void setValues(const labelUList &cellLabels, const UList< Type > &values)
Set solution in given cells to the specified values and eliminate the corresponding equations from th...
void setInterfaces(lduInterfaceFieldPtrsList &, PtrDynList< lduInterfaceField > &newInterfaces)
Set interfaces.
void operator-=(const dimensioned< Type > &)
void operator-=(const DimensionedField< Type, volMesh > &)
const dictionary & solverDict(const word &name) const
Return the solver dictionary (from fvSolution) for name.
void operator-=(Foam::zero)
SolverPerformance< Type > solveSegregatedOrCoupled(const dictionary &)
Solve segregated or coupled returning the solution statistics.
void operator-=(const tmp< fvMatrix< Type > > &)
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
tmp< Field< Type > > residual() const
Return the matrix residual.
void faceFluxCorrectionPtr(faceFluxFieldType *flux)
Set pointer to face-flux non-orthogonal correction field.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
void negate()
Inplace negate.
tmp< fvMatrix< Type > > clone() const
Construct and return a clone.
void setReferences(const labelUList &cellLabels, const UList< Type > &values, const bool forceReference=false)
Set reference level for solution.
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
void clear()
Clear multiple fvMatrices.
fvMatrix(const tmp< fvMatrix< Type > > &)
Copy/move construct from tmp<fvMatrix<Type>>.
void addFvMatrix(fvMatrix< Type > &matrix)
Add fvMatrix.
tmp< scalarField > D() const
Return the matrix scalar diagonal.
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
void addToInternalField(const labelUList &addr, const tmp< Field< Type2 > > &tpf, Field< Type2 > &intf) const
const GeometricField< scalar, fvPatchField, volMesh > & psi(const label i=0) const
bool checkImplicit(const label fieldi=0)
Name the implicit assembly addressing.
Expression::fvMatrixConstRefWrap< fvMatrix< scalar > > expr() const
friend class fvSolver
Declare friendship with the fvSolver class.
lduPrimitiveMeshAssembly * lduMeshPtr()
Access to lduPrimitiveMeshAssembly.
void operator=(const fvMatrix< Type > &)
void subtractFromInternalField(const labelUList &addr, const tmp< Field< Type2 > > &tpf, Field< Type2 > &intf) const
bool hasFaceFluxCorrection() const noexcept
True if face-flux non-orthogonal correction field exists.
void setValuesFromList(const labelUList &cellLabels, const ListType< Type > &values)
Set solution in given cells to the specified values.
FieldField< Field, Type > & boundaryCoeffs() noexcept
fvBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Field< scalar > & source() noexcept
fvMatrix< Type > & matrix(const label i)
const dictionary & solverDict() const
Return the solver dictionary for psi, taking into account finalIteration.
void setBounAndInterCoeffs()
Manipulate boundary/internal coeffs for coupling.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
lduMatrix(const lduMesh &mesh)
Construct (without coefficients) for an LDU addressed mesh.
const scalarField & diag() const
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
const labelListList & patchMap() const
Return patchMap.
constexpr refCount() noexcept
Default construct, initializing count to 0.
A class for managing temporary objects.
Mesh data needed to do the Finite Volume discretisation.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Macro definitions for declaring ClassName(), NamespaceName(), etc.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
const volScalarField & psi
Expression templates for fvMatrix.
A scalar instance of fvMatrix.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
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).
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
UList< label > labelUList
A UList of labels.
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
#define FOAM_DEPRECATED_FOR(since, replacement)