Go to the documentation of this file.
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>"
74 return SolverPerformance<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"
97 return SolverPerformance<Type>();
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)
162 psi.boundaryField().scalarInterfaces();
176 updateMatrixInterfaces
196 )->solve(psiCmpt, sourceCmpt, cmpt);
203 solverPerfVec.
replace(cmpt, solverPerf);
205 psi.internalField().replace(cmpt, psiCmpt);
209 psi.correctBoundaryConditions();
211 psi.mesh().setSolverPerformance(
psi.name(), solverPerfVec);
213 return solverPerfVec;
226 <<
"fvMatrix<Type>::solveCoupled"
227 "(const dictionary& solverControls) : "
228 "solving fvMatrix<Type>"
236 coupledMatrix.diag() =
diag();
237 coupledMatrix.upper() = upper();
238 coupledMatrix.lower() = lower();
239 coupledMatrix.source() = source();
241 addBoundaryDiag(coupledMatrix.diag(), 0);
242 addBoundarySource(coupledMatrix.source(),
false);
244 coupledMatrix.interfaces() =
psi.boundaryField().interfaces();
245 coupledMatrix.interfacesUpper() = boundaryCoeffs().
component(0);
246 coupledMatrix.interfacesLower() = internalCoeffs().
component(0);
261 coupledMatrixSolver->solve(
psi)
269 psi.correctBoundaryConditions();
271 psi.mesh().setSolverPerformance(
psi.name(), solverPerf);
283 psi_.mesh().solverDict
287 psi_.mesh().data::template lookupOrDefault<bool>
288 (
"finalIteration",
false)
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++)
356 res.
component(cmpt) - boundaryDiagCmpt*psiCmpt,
358 psi_.boundaryField().scalarInterfaces(),
tmp< Field< Type > > residual() const
Return the matrix residual.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
A class for managing temporary objects.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
OSstream & masterStream(const label communicator)
Convert to OSstream.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
fvMatrix< Type > & fvMat_
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
FieldField< Field, Type > boundaryCoeffs_
Boundary scalar field containing pseudo-matrix coeffs.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const GeometricField< Type, fvPatchField, volMesh > & psi_
Const reference to GeometricField<Type, fvPatchField, volMesh>
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
autoPtr< fvSolver > solver()
Construct and return the solver.
void residual(scalarField &rA, const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const volScalarField & psi
Traits class for primitives.
void replace(const direction, const GeometricField< cmptType, PatchField, GeoMesh > &)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Generic GeometricField class.
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution.
Field< Type > source_
Source term.