34 template<
class Type,
class DType,
class LUType>
38 const word& fieldName,
43 const word solverName(solverDict.
get<
word>(
"solver"));
57 else if (
matrix.symmetric())
59 auto* ctorPtr = symMatrixConstructorTable(solverName);
66 "symmetric matrix solver",
68 *symMatrixConstructorTablePtr_
82 else if (
matrix.asymmetric())
84 auto* ctorPtr = asymMatrixConstructorTable(solverName);
91 "asymmetric matrix solver",
93 *asymMatrixConstructorTablePtr_
109 <<
"cannot solve incomplete matrix, " 110 "no diagonal or off-diagonal coefficient" 119 template<
class Type,
class DType,
class LUType>
122 const word& fieldName,
127 fieldName_(fieldName),
130 controlDict_(solverDict),
135 normType_(
lduMatrix::normTypes::DEFAULT_NORM),
145 template<
class Type,
class DType,
class LUType>
148 controlDict_.readIfPresent(
"log", log_);
151 controlDict_.readIfPresent(
"minIter", minIter_);
152 controlDict_.readIfPresent(
"maxIter", maxIter_);
153 controlDict_.readIfPresent(
"tolerance", tolerance_);
154 controlDict_.readIfPresent(
"relTol", relTol_);
158 template<
class Type,
class DType,
class LUType>
164 controlDict_ = solverDict;
169 template<
class Type,
class DType,
class LUType>
189 matrix_.sumA(tmpField);
197 +
cmptMag(matrix_.source() - tmpField)
212 return pTraits<Type>::one;
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Type normFactor(const Field< Type > &psi, const Field< Type > &Apsi, Field< Type > &tmpField, const lduMatrix::normTypes normType) const
Return the matrix norm using the specified norm method.
A traits class, which is primarily used for primitives.
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
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.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
static const Enum< normTypes > normTypesNames_
Names for the normTypes.
Type gSum(const FieldField< Field, Type > &f)
Generic templated field type.
A class for handling words, derived from Foam::string.
normTypes
Enumerated matrix normalisation types.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
solver(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Construct for given field name, matrix and controls.
const word & fieldName() const noexcept
"default" norm (== L1_scaled)
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
virtual void read(const dictionary &)
Read and reset the solver parameters from the given dictionary.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
static autoPtr< solver > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Return a new solver.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const volScalarField & psi
virtual void readControls()
Read the control parameters from controlDict_.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
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)