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().solution().solverDict
289 !psi_.mesh().schemes().steady()
290 && psi_.mesh().data::template lookupOrDefault<bool>
291 (
"finalIteration",
false)
303 fvMat_.psi_.mesh().solution().solverDict
307 !fvMat_.psi_.mesh().schemes().steady()
308 && fvMat_.psi_.mesh().data::template lookupOrDefault<bool>
309 (
"finalIteration",
false)
321 psi_.mesh().solution().solverDict
323 !psi_.mesh().schemes().steady()
324 && psi_.mesh().data::template lookupOrDefault<bool>
325 (
"finalIteration",
false)
326 ?
word(name +
"Final")
338 psi_.mesh().solution().solverDict
342 !psi_.mesh().schemes().steady()
343 && psi_.mesh().data::template lookupOrDefault<bool>
363 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
365 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
372 boundaryCoeffs_.component(cmpt)
381 res.
component(cmpt) - boundaryDiagCmpt*psiCmpt,
383 psi_.boundaryField().scalarInterfaces(),
402 return fvm.
solve(name);
const word & name() const
Return name.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
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.
lduInterfaceFieldPtrsList scalarInterfaces() const
Return a list of pointers for each patch field with only those.
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.
A class for handling words, derived from string.
Abstract base-class for lduMatrix solvers.
const volScalarField & psi
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.
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.
LduInterfaceFieldPtrsList< Type > interfaces() const
Return a list of pointers for each patch field with only those.
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...
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...