Go to the documentation of this file.
45 if (psi_.needReference())
47 if (Pstream::master())
49 internalCoeffs_[patchi][facei].component(cmpt) +=
50 diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]];
52 boundaryCoeffs_[patchi][facei].component(cmpt) +=
53 diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]]
67 if (psi_.mesh().name() != polyMesh::defaultRegion)
76 <<
"fvMatrix<Type>::solveSegregatedOrCoupled"
77 "(const dictionary& solverControls) : "
78 "solving fvMatrix<Type>"
93 if (
type ==
"segregated")
95 return solveSegregated(solverControls);
97 else if (
type ==
"coupled")
99 return solveCoupled(solverControls);
104 <<
"Unknown type " <<
type
105 <<
"; currently supported solver types are segregated and coupled"
122 <<
"fvMatrix<Type>::solveSegregated"
123 "(const dictionary& solverControls) : "
124 "solving fvMatrix<Type>"
133 "fvMatrix<Type>::solveSegregated",
144 addBoundarySource(source);
146 typename Type::labelType validComponents
148 psi.mesh().template validComponents<Type>()
151 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
153 if (validComponents[cmpt] == -1)
continue;
158 addBoundaryDiag(
diag(), cmpt);
164 boundaryCoeffs_.component(cmpt)
169 internalCoeffs_.component(cmpt)
173 psi.boundaryField().scalarInterfaces();
182 const label startRequest = Pstream::nRequests();
194 updateMatrixInterfaces
217 )->
solve(psiCmpt, sourceCmpt, cmpt);
224 solverPerfVec.replace(cmpt, solverPerf);
225 solverPerfVec.solverName() = solverPerf.
solverName();
227 psi.primitiveFieldRef().replace(cmpt, psiCmpt);
231 psi.correctBoundaryConditions();
233 psi.mesh().setSolverPerformance(
psi.name(), solverPerfVec);
235 return solverPerfVec;
248 <<
"fvMatrix<Type>::solveCoupled"
249 "(const dictionary& solverControls) : "
250 "solving fvMatrix<Type>"
259 coupledMatrix.upper() =
upper();
260 coupledMatrix.lower() =
lower();
261 coupledMatrix.source() = source();
263 addBoundaryDiag(coupledMatrix.diag(), 0);
264 addBoundarySource(coupledMatrix.source(),
false);
266 coupledMatrix.interfaces() =
psi.boundaryFieldRef().interfaces();
267 coupledMatrix.interfacesUpper() = boundaryCoeffs().component(0);
268 coupledMatrix.interfacesLower() = internalCoeffs().component(0);
283 coupledMatrixSolver->solve(
psi)
291 psi.correctBoundaryConditions();
293 psi.mesh().setSolverPerformance(
psi.name(), solverPerf);
305 return psi_.mesh().solve(*
this, solverControls);
313 return solver(solverDict());
320 return solve(fvMat_.solverDict());
340 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
349 boundaryCoeffs_.component(cmpt)
358 res.
component(cmpt) - boundaryDiagCmpt*psiCmpt,
int debug
Static debugging option.
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
A class for handling words, derived from Foam::string.
A field of fields is a PtrList of fields with reference counting.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
SolverPerformance< Type > solveSegregatedOrCoupled(const dictionary &)
Solve segregated or coupled returning the solution statistics.
OSstream & masterStream(const label communicator)
Convert to OSstream.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
SolverPerformance< Type > solveCoupled(const dictionary &)
Solve coupled returning the solution statistics.
Base class for solution control classes.
messageStream Info
Information stream (uses stdout - output is on the master only)
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A Field wrapper with possible data conversion.
FieldType & ref()
Allow modification without const-ref check.
Traits class for primitives.
const dictionary & solverDict() const
Return the solver dictionary taking into account finalIteration.
A const Field wrapper with possible data conversion.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
const volScalarField & psi
void residual(solveScalarField &rA, const solveScalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
const Boundary & boundaryField() const
Return const-reference to the boundary field.