40 if (psi_.needReference())
42 if (Pstream::master())
44 internalCoeffs_[
patchi][facei].component(cmpt) +=
45 diag()[psi_.mesh().boundary()[
patchi].faceCells()[facei]];
47 boundaryCoeffs_[
patchi][facei].component(cmpt) +=
48 diag()[psi_.mesh().boundary()[
patchi].faceCells()[facei]]
64 <<
"fvMatrix<Type>::solve(const dictionary& solverControls) : " 65 "solving fvMatrix<Type>" 80 if (type ==
"segregated")
82 return solveSegregated(solverControls);
84 else if (type ==
"coupled")
86 return solveCoupled(solverControls);
93 ) <<
"Unknown type " << type
94 <<
"; currently supported solver types are segregated and coupled" 111 <<
"fvMatrix<Type>::solveSegregated" 112 "(const dictionary& solverControls) : " 113 "solving fvMatrix<Type>" 122 "fvMatrix<Type>::solveSegregated",
133 addBoundarySource(source);
135 typename Type::labelType validComponents
137 psi.
mesh().template validComponents<Type>()
140 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
142 if (validComponents[cmpt] == -1)
continue;
147 addBoundaryDiag(
diag(), cmpt);
153 boundaryCoeffs_.component(cmpt)
158 internalCoeffs_.component(cmpt)
176 updateMatrixInterfaces
196 )->
solve(psiCmpt, sourceCmpt, cmpt);
203 solverPerfVec.replace(cmpt, solverPerf);
211 psi.
mesh().setSolverPerformance(psi.
name(), solverPerfVec);
213 return solverPerfVec;
226 <<
"fvMatrix<Type>::solveCoupled" 227 "(const dictionary& solverControls) : " 228 "solving fvMatrix<Type>" 237 coupledMatrix.upper() = upper();
238 coupledMatrix.lower() = lower();
239 coupledMatrix.source() = source();
241 addBoundaryDiag(coupledMatrix.diag(), 0);
242 addBoundarySource(coupledMatrix.source(),
false);
245 coupledMatrix.interfacesUpper() = boundaryCoeffs().component(0);
246 coupledMatrix.interfacesLower() = internalCoeffs().component(0);
261 coupledMatrixSolver->solve(psi)
271 psi.
mesh().setSolverPerformance(psi.
name(), solverPerf);
283 psi_.mesh().solverDict
287 psi_.mesh().data::template lookupOrDefault<bool>
288 (
"finalIteration",
false)
300 fvMat_.psi_.mesh().solverDict
304 fvMat_.psi_.mesh().data::template lookupOrDefault<bool>
305 (
"finalIteration",
false)
317 psi_.mesh().solverDict
321 psi_.mesh().data::template lookupOrDefault<bool>
322 (
"finalIteration",
false)
338 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
340 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
347 boundaryCoeffs_.component(cmpt)
356 res.
component(cmpt) - boundaryDiagCmpt*psiCmpt,
358 psi_.boundaryField().scalarInterfaces(),
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Generic GeometricField class.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void residual(scalarField &rA, const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
SolverPerformance< Type > solve()
Solve returning the solution statistics.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
tmp< Field< Type > > residual() const
Return the matrix residual.
A class for handling words, derived from string.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Abstract base-class for lduMatrix solvers.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
OSstream & masterStream(const label communicator)
Convert to OSstream.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const Mesh & mesh() const
Return mesh.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
autoPtr< fvSolver > solver()
Construct and return the solver.
void correctBoundaryConditions()
Correct boundary field.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const volScalarField & psi
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution.
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
const word & name() const
Return name.