33template<
class Type,
class DType,
class LUType>
34Foam::PBiCCCG<Type, DType, LUType>::PBiCCCG
52template<
class Type,
class DType,
class LUType>
59 const word preconditionerName(this->controlDict_.getWord(
"preconditioner"));
70 label nCells =
psi.size();
72 Type* __restrict__ psiPtr =
psi.begin();
75 Type* __restrict__ pAPtr = pA.begin();
78 Type* __restrict__ pTPtr = pT.begin();
81 Type* __restrict__ wAPtr = wA.begin();
84 Type* __restrict__ wTPtr = wT.begin();
87 scalar wArTold = wArT;
90 this->matrix_.Amul(wA,
psi);
91 this->matrix_.Tmul(wT,
psi);
96 Type* __restrict__ rAPtr = rA.begin();
97 Type* __restrict__ rTPtr = rT.begin();
100 Type normFactor = this->normFactor(
psi, wA, pA);
104 Info<<
" Normalisation factor = " << normFactor <<
endl;
108 solverPerf.initialResidual() = cmptDivide(gSumCmptMag(rA), normFactor);
109 solverPerf.finalResidual() = solverPerf.initialResidual();
115 || !solverPerf.checkConvergence
124 autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
125 preconPtr = LduMatrix<Type, DType, LUType>::preconditioner::New
138 preconPtr->precondition(wA, rA);
139 preconPtr->preconditionT(wT, rT);
142 wArT = gSumProd(wA, rT);
146 for (label cell=0; cell<nCells; cell++)
148 pAPtr[cell] = wAPtr[cell];
149 pTPtr[cell] = wTPtr[cell];
154 scalar
beta = wArT/wArTold;
156 for (label cell=0; cell<nCells; cell++)
158 pAPtr[cell] = wAPtr[cell] + (
beta* pAPtr[cell]);
159 pTPtr[cell] = wTPtr[cell] + (
beta* pTPtr[cell]);
165 this->matrix_.Amul(wA, pA);
166 this->matrix_.Tmul(wT, pT);
173 solverPerf.checkSingularity
185 scalar
alpha = wArT/wApT;
187 for (label cell=0; cell<nCells; cell++)
189 psiPtr[cell] += (
alpha* pAPtr[cell]);
190 rAPtr[cell] -= (
alpha* wAPtr[cell]);
191 rTPtr[cell] -= (
alpha* wTPtr[cell]);
194 solverPerf.finalResidual() =
200 nIter++ < this->maxIter_
201 && !solverPerf.checkConvergence
208 || nIter < this->minIter_
212 solverPerf.nIterations() =
213 pTraits<typename pTraits<Type>::labelType>::one*nIter;
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
static autoPtr< preconditioner > New(const solver &sol, const dictionary &preconditionerDict)
Return a new preconditioner.
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 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.
int log_
Verbosity level for solver output statements.
const LduMatrix< Type, DType, LUType > & matrix_
dictionary controlDict_
Dictionary of solution controls.
const word & fieldName() const noexcept
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
virtual SolverPerformance< Type > solve(Field< Type > &psi) const
Solve the matrix with this solver.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A cell is defined as a list of faces with extra functionality.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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
scalarProduct< Type, Type >::type gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
messageStream Info
Information stream (stdout output on master, null elsewhere).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
Type gSumCmptMag(const UList< Type > &f, const label comm)
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)