41 if (psi_.needReference())
43 if (Pstream::master())
45 internalCoeffs_[
patchi][facei].component(cmpt) +=
46 diag()[psi_.mesh().boundary()[
patchi].faceCells()[facei]];
48 boundaryCoeffs_[
patchi][facei].component(cmpt) +=
49 diag()[psi_.mesh().boundary()[
patchi].faceCells()[facei]]
65 <<
"fvMatrix<Type>::solve(const dictionary& solverControls) : " 66 "solving fvMatrix<Type>" 81 if (type ==
"segregated")
83 return solveSegregated(solverControls);
85 else if (type ==
"coupled")
87 return solveCoupled(solverControls);
94 ) <<
"Unknown type " << type
95 <<
"; currently supported solver types are segregated and coupled" 112 <<
"fvMatrix<Type>::solveSegregated" 113 "(const dictionary& solverControls) : " 114 "solving fvMatrix<Type>" 123 "fvMatrix<Type>::solveSegregated",
134 addBoundarySource(source);
136 typename Type::labelType validComponents
138 psi.
mesh().template validComponents<Type>()
141 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
143 if (validComponents[cmpt] == -1)
continue;
148 addBoundaryDiag(
diag(), cmpt);
154 boundaryCoeffs_.component(cmpt)
159 internalCoeffs_.component(cmpt)
177 updateMatrixInterfaces
197 )->
solve(psiCmpt, sourceCmpt, cmpt);
204 solverPerfVec.replace(cmpt, solverPerf);
205 solverPerfVec.solverName() = solverPerf.
solverName();
215 return solverPerfVec;
228 <<
"fvMatrix<Type>::solveCoupled" 229 "(const dictionary& solverControls) : " 230 "solving fvMatrix<Type>" 239 coupledMatrix.upper() = upper();
240 coupledMatrix.lower() = lower();
241 coupledMatrix.source() =
source();
243 addBoundaryDiag(coupledMatrix.diag(), 0);
244 addBoundarySource(coupledMatrix.source(),
false);
247 coupledMatrix.interfacesUpper() = boundaryCoeffs().component(0);
248 coupledMatrix.interfacesLower() = internalCoeffs().component(0);
263 coupledMatrixSolver->solve(psi)
285 psi_.mesh().solverDict
289 psi_.mesh().data::template lookupOrDefault<bool>
290 (
"finalIteration",
false)
302 fvMat_.psi_.mesh().solverDict
306 fvMat_.psi_.mesh().data::template lookupOrDefault<bool>
307 (
"finalIteration",
false)
319 psi_.mesh().solverDict
321 psi_.mesh().data::template lookupOrDefault<bool>
322 (
"finalIteration",
false)
323 ?
word(name +
"Final")
335 psi_.mesh().solverDict
339 psi_.mesh().data::template lookupOrDefault<bool>
359 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
361 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
368 boundaryCoeffs_.component(cmpt)
377 res.
component(cmpt) - boundaryDiagCmpt*psiCmpt,
379 psi_.boundaryField().scalarInterfaces(),
398 return fvm.
solve(name);
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
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...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
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.
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
void residual(scalarField &rA, const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
SolverPerformance< Type > solve()
Solve returning the solution statistics.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Abstract base-class for lduMatrix solvers.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
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.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
const Mesh & mesh() const
Return mesh.
word name(const complex &)
Return a string representation of a complex.
OSstream & masterStream(const label communicator)
Convert to OSstream.
fvModels source(alpha1, mixture.thermo1().rho())
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
autoPtr< fvSolver > solver()
Construct and return the solver.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
void correctBoundaryConditions()
Correct boundary field.
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
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.
tmp< Field< Type > > residual() const
Return the matrix residual.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
MeshObject to store the solver performance residuals of all the fields of the type it is instantiated...