53 { normTypes::NO_NORM,
"none" },
55 { normTypes::L1_SCALED_NORM,
"L1_scaled" },
73 diagPtr_ = std::make_unique<scalarField>(*(A.diagPtr_));
78 upperPtr_ = std::make_unique<scalarField>(*(A.upperPtr_));
83 lowerPtr_ = std::make_unique<scalarField>(*(A.lowerPtr_));
88 lowerCSRPtr_ = std::make_unique<scalarField>(*(A.lowerCSRPtr_));
98 diagPtr_(std::move(
A.diagPtr_)),
99 lowerPtr_(std::move(
A.lowerPtr_)),
100 upperPtr_(std::move(
A.upperPtr_)),
101 lowerCSRPtr_(std::move(
A.lowerCSRPtr_)),
102 workPtr_(std::move(
A.workPtr_))
112 diagPtr_ = std::move(
A.diagPtr_);
113 upperPtr_ = std::move(
A.upperPtr_);
114 lowerPtr_ = std::move(
A.lowerPtr_);
115 lowerCSRPtr_ = std::move(
A.lowerCSRPtr_);
116 workPtr_ = std::move(
A.workPtr_);
123 diagPtr_ = std::make_unique<scalarField>(*(
A.diagPtr_));
128 upperPtr_ = std::make_unique<scalarField>(*(
A.upperPtr_));
133 lowerPtr_ = std::make_unique<scalarField>(*(
A.lowerPtr_));
140 lowerCSRPtr_ = std::make_unique<scalarField>(*(
A.lowerCSRPtr_));
150 bool withLower, withDiag, withUpper, withLowerCSR;
152 is >> withLower >> withDiag >> withUpper >> withLowerCSR;
156 lowerPtr_ = std::make_unique<scalarField>(is);
160 diagPtr_ = std::make_unique<scalarField>(is);
164 upperPtr_ = std::make_unique<scalarField>(is);
177 lowerCSRPtr_ = std::make_unique<scalarField>(is);
192 ? (!lowerPtr_ ?
"diagonal" :
"diagonal-lower")
193 : (!lowerPtr_ ?
"symmetric" :
"asymmetric")
198 return (!upperPtr_ && !lowerPtr_ ?
"empty" :
"ill-defined");
207 <<
"diagPtr_ unallocated"
235 diagPtr_ = std::make_unique<scalarField>(size,
Foam::zero{});
253 <<
"lowerPtr_ and upperPtr_ unallocated"
268 upperPtr_ = std::make_unique<scalarField>(*lowerPtr_);
273 lowerCSRPtr_.reset(
nullptr);
276 std::make_unique<scalarField>
278 lduAddr().lowerAddr().size(),
294 upperPtr_ = std::make_unique<scalarField>(*lowerPtr_);
299 lowerCSRPtr_.reset(
nullptr);
305 upperPtr_ = std::make_unique<scalarField>(nCoeffs, Foam::zero{});
324 <<
"lowerPtr_ and upperPtr_ unallocated"
337 lowerCSRPtr_.reset(
nullptr);
341 lowerPtr_ = std::make_unique<scalarField>(*upperPtr_);
346 std::make_unique<scalarField>
348 lduAddr().lowerAddr().size(),
362 lowerCSRPtr_.reset(
nullptr);
366 lowerPtr_ = std::make_unique<scalarField>(*upperPtr_);
375 std::make_unique<scalarField>(nCoeffs, Foam::zero{});
387 const label nLower = lduAddr().losortAddr().size();
389 lowerCSRPtr_ = std::make_unique<scalarField>(nLower);
393 lduAddr().map(*lowerPtr_, *lowerCSRPtr_);
397 lduAddr().map(*upperPtr_, *lowerCSRPtr_);
402 <<
"lowerPtr_ and upperPtr_ unallocated"
407 return *lowerCSRPtr_;
415 const label nLower = lduAddr().losortAddr().size();
417 lowerCSRPtr_ = std::make_unique<scalarField>(nLower);
421 lduAddr().map(*lowerPtr_, *lowerCSRPtr_);
425 lduAddr().map(*upperPtr_, *lowerCSRPtr_);
430 <<
"lowerPtr_ and upperPtr_ unallocated"
435 return *lowerCSRPtr_;
441 if (!workPtr_ || workPtr_->size() != size)
443 workPtr_ = std::make_unique<solveScalarField>(size,
Foam::zero{});
455 <<
"workPtr_ unallocated"
466 const word& fieldName,
480 :
IOobject::scopedName(
"residual", fieldName)
489 if (initial && dataPtr->isFirstIteration())
491 *residualPtr = residual;
493 <<
"Setting residual field for first solver iteration "
494 <<
"for solver field: " << fieldName <<
endl;
499 *residualPtr = residual;
501 <<
"Setting residual field for solver field "
502 << fieldName <<
endl;
532 if (mat.hasLowerCSR() && !mat.hasLower())
535 os << mat.lowerCSR();
547 const InfoProxy<lduMatrix>& iproxy
550 const auto& mat = *iproxy;
560 os <<
"lower:" << mat.lower().size() <<
endl;
564 os <<
"diag :" << mat.diag().size() <<
endl;
568 os <<
"upper:" << mat.upper().size() <<
endl;
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const char * name(bool b) noexcept
A string representation of bool as "false" / "true".
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
lduMatrix(const lduMesh &mesh)
Construct (without coefficients) for an LDU addressed mesh.
bool hasUpper() const noexcept
const lduAddressing & lduAddr() const
Return the LDU addressing.
normTypes
Enumerated matrix normalisation types.
@ DEFAULT_NORM
"default" norm (== L1_scaled)
void residual(solveScalarField &rA, const solveScalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
const scalarField & diag() const
const scalarField & upper() const
void setResidualField(const scalarField &residual, const word &fieldName, const bool initial) const
Set the residual field using an IOField on the object registry if it exists.
const scalarField & lowerCSR() const
static const Enum< normTypes > normTypesNames_
Names for the normTypes.
bool hasLower() const noexcept
const scalarField & lower() const
const lduMesh & mesh() const noexcept
Return the LDU mesh from which the addressing is obtained.
static const scalar defaultTolerance
Default (absolute) tolerance (1e-6).
word matrixTypeName() const
The matrix type (empty, diagonal, symmetric, ...).
const solveScalarField & work() const
Work array.
bool hasDiag() const noexcept
bool hasLowerCSR() const noexcept
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Database for mesh data, solution data, solver performance and other reduced data.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
Field< solveScalar > solveScalarField
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
IOField< scalar > scalarIOField
IO for a Field of scalar.