33 template<
class Type,
class DType,
class LUType>
36 const word& fieldName,
52 template<
class Type,
class DType,
class LUType>
56 const word preconditionerName(this->controlDict_.getWord(
"preconditioner"));
61 preconditionerName + typeName,
67 label nCells =
psi.size();
69 Type* __restrict__ psiPtr =
psi.begin();
72 Type* __restrict__ pAPtr = pA.begin();
75 Type* __restrict__ wAPtr = wA.begin();
81 this->matrix_.Amul(wA,
psi);
85 Type* __restrict__ rAPtr = rA.
begin();
88 Type normFactor = this->normFactor(
psi, wA, pA);
92 Info<<
" Normalisation factor = " << normFactor <<
endl;
97 solverPerf.finalResidual() = solverPerf.initialResidual();
103 || !solverPerf.checkConvergence
112 autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
126 preconPtr->precondition(wA, rA);
133 for (label cell=0; cell<nCells; cell++)
135 pAPtr[cell] = wAPtr[cell];
146 for (label cell=0; cell<nCells; cell++)
154 this->matrix_.Amul(wA, pA);
162 solverPerf.checkSingularity
180 for (label cell=0; cell<nCells; cell++)
186 solverPerf.finalResidual() =
192 nIter++ < this->maxIter_
193 && !solverPerf.checkConvergence
200 || nIter < this->minIter_
204 solverPerf.nIterations() =
205 pTraits<typename pTraits<Type>::labelType>::one*nIter;
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
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.
Type gSumCmptMag(const UList< Type > &f, const label comm)
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
virtual SolverPerformance< Type > solve(Field< Type > &psi) const
Solve the matrix with this solver.
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
Generic templated field type.
A class for handling words, derived from Foam::string.
Preconditioned conjugate gradient solver for symmetric lduMatrices using a run-time selectable precon...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
messageStream Info
Information stream (stdout output on master, null elsewhere)
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
const volScalarField & psi
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].