34template<
class Type,
class DType,
class LUType>
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"
119template<
class Type,
class DType,
class LUType>
122 const word& fieldName,
127 fieldName_(fieldName),
130 controlDict_(solverDict),
135 normType_(
lduMatrix::normTypes::DEFAULT_NORM),
145template<
class Type,
class DType,
class LUType>
148 controlDict_.readIfPresent(
"log", log_);
151 controlDict_.readIfPresent(
"minIter", minIter_);
158template<
class Type,
class DType,
class LUType>
169template<
class Type,
class DType,
class LUType>
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
label maxIter_
Maximum number of iterations in the solver.
solver(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Construct for given field name, matrix and controls.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
Type relTol_
Convergence tolerance relative to the initial.
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.
label minIter_
Minimum number of iterations in the solver.
Type tolerance_
Final convergence tolerance.
lduMatrix::normTypes normType_
The matrix normalisation type.
int log_
Verbosity level for solver output statements.
virtual void readControls()
Read the control parameters from controlDict_.
const LduMatrix< Type, DType, LUType > & matrix_
static autoPtr< solver > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Return a new solver.
virtual void read(const dictionary &)
Read and reset the solver parameters from the given dictionary.
dictionary controlDict_
Dictionary of solution controls.
const word & fieldName() const noexcept
LduMatrix(const lduMesh &mesh)
Construct given an LDU addressed mesh.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
normTypes
Enumerated matrix normalisation types.
@ DEFAULT_NORM
"default" norm (== L1_scaled)
@ L1_SCALED_NORM
"L1_scaled" norm
@ NO_NORM
"none" norm (returns 1)
static const Enum< normTypes > normTypesNames_
Names for the normTypes.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
A traits class, which is primarily used for primitives and vector-space.
A class for handling words, derived from Foam::string.
const volScalarField & psi
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
Type gSum(const FieldField< Field, Type > &f)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
static constexpr const zero Zero
Global zero (0).
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
errorManipArg< error, int > exit(error &err, const int errNo=1)