46 const word& solverName,
47 const word& fieldName,
72 auto* ctorPtr = symMatrixConstructorTable(solverName);
79 "symmetric matrix solver",
81 *symMatrixConstructorTablePtr_
85 return autoPtr<lduMatrix::solver>
100 auto* ctorPtr = asymMatrixConstructorTable(solverName);
107 "asymmetric matrix solver",
109 *asymMatrixConstructorTablePtr_
113 return autoPtr<lduMatrix::solver>
128 <<
"cannot solve incomplete matrix, " 129 "no diagonal or off-diagonal coefficient" 138 const word& fieldName,
148 solverControls.
get<
word>(
"solver"),
163 const word& fieldName,
171 fieldName_(fieldName),
173 interfaceBouCoeffs_(interfaceBouCoeffs),
174 interfaceIntCoeffs_(interfaceIntCoeffs),
175 interfaces_(interfaces),
176 controlDict_(solverControls),
185 profiling_(
"lduMatrix::solver." + fieldName)
202 controlDict_.readIfPresent(
"log", log_);
204 controlDict_.readIfPresent(
"minIter", minIter_);
205 controlDict_.readIfPresent(
"maxIter", maxIter_);
206 controlDict_.readIfPresent(
"tolerance", tolerance_);
207 controlDict_.readIfPresent(
"relTol", relTol_);
213 controlDict_ = solverControls;
255 matrix_.sumA(tmpField, interfaceBouCoeffs_, interfaces_);
262 (
mag(Apsi - tmpField) +
mag(source - tmpField))(),
263 matrix_.mesh().comm()
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
bool symmetric() const noexcept
virtual void read(const dictionary &)
Read and reset the solver parameters from the given stream.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
pTraits< solveScalar >::cmptType cmptType
Component type.
const lduMatrix & matrix() const noexcept
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
A non-const Field/List wrapper with possible data conversion.
static constexpr const label defaultMaxIter
Default maximum number of iterations for solvers (1000)
A field of fields is a PtrList of fields with reference counting.
static const Enum< normTypes > normTypesNames_
Names for the normTypes.
Type gSum(const FieldField< Field, Type > &f)
A class for handling words, derived from Foam::string.
Abstract base-class for lduMatrix solvers.
A const Field/List wrapper with possible data conversion.
const lduInterfaceFieldPtrsList & interfaces() const noexcept
static const scalar defaultTolerance
Default (absolute) tolerance (1e-6)
solver(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Construct solver for given field name, matrix etc.
normTypes
Enumerated matrix normalisation types.
bool asymmetric() const noexcept
static autoPtr< solver > New(const word &solverName, const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Return a new solver of given type.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
solveScalarField::cmptType normFactor(const solveScalarField &psi, const solveScalarField &source, const solveScalarField &Apsi, solveScalarField &tmpField, const lduMatrix::normTypes normType) const
Return the matrix norm using the specified norm method.
bool diagonal() const noexcept
"default" norm (== L1_scaled)
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
virtual solverPerformance scalarSolve(solveScalarField &psi, const solveScalarField &source, const direction cmpt=0) const
Solve with given field and rhs (in solveScalar precision).
const volScalarField & psi
const word & fieldName() const noexcept
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
virtual void readControls()
Read the control parameters from controlDict_.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)