38 lduMatrix::solver::addsymMatrixConstructorToTable<PCG>
47 const word& fieldName,
85 solveScalar* __restrict__ psiPtr =
psi.
begin();
88 solveScalar* __restrict__ pAPtr = pA.begin();
91 solveScalar* __restrict__ wAPtr = wA.begin();
93 solveScalar wArA = solverPerf.great_;
94 solveScalar wArAold = wArA;
97 matrix_.Amul(wA,
psi, interfaceBouCoeffs_, interfaces_, cmpt);
101 solveScalar* __restrict__ rAPtr = rA.begin();
111 solveScalar normFactor = this->normFactor(
psi, source, wA, pA);
115 Info<<
" Normalisation factor = " << normFactor <<
endl;
119 solverPerf.initialResidual() =
122 solverPerf.finalResidual() = solverPerf.initialResidual();
128 || !solverPerf.checkConvergence(tolerance_, relTol_, log_)
148 preconPtr_->precondition(wA, rA, cmpt);
153 if (solverPerf.nIterations() == 0)
155 for (label cell=0; cell<nCells; cell++)
157 pAPtr[cell] = wAPtr[cell];
162 const solveScalar
beta = wArA/wArAold;
164 for (label cell=0; cell<nCells; cell++)
166 pAPtr[cell] = wAPtr[cell] +
beta*pAPtr[cell];
172 matrix_.Amul(wA, pA, interfaceBouCoeffs_, interfaces_, cmpt);
174 solveScalar wApA =
gSumProd(wA, pA, matrix().
mesh().comm());
177 if (solverPerf.checkSingularity(
mag(wApA)/normFactor))
break;
182 const solveScalar
alpha = wArA/wApA;
184 for (label cell=0; cell<nCells; cell++)
186 psiPtr[cell] +=
alpha*pAPtr[cell];
187 rAPtr[cell] -=
alpha*wAPtr[cell];
190 solverPerf.finalResidual() =
197 ++solverPerf.nIterations() < maxIter_
198 && !solverPerf.checkConvergence(tolerance_, relTol_, log_)
200 || solverPerf.nIterations() < minIter_
206 preconPtr_->setFinished(solverPerf);
211 ConstPrecisionAdaptor<scalar, solveScalar>(rA)(),
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
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.
scalarProduct< Type, Type >::type gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
lduMatrix::solver::addsymMatrixConstructorToTable< PCG > addPCGSymMatrixConstructorToTable_
Ostream & endl(Ostream &os)
Add newline and flush stream.
A non-const Field/List wrapper with possible data conversion.
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
A field of fields is a PtrList of fields with reference counting.
A class for handling words, derived from Foam::string.
static autoPtr< preconditioner > New(const solver &sol, const dictionary &solverControls)
Return a new preconditioner.
A const Field/List wrapper with possible data conversion.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
int debug
Static debugging option.
Container< Type > & ref() const
Return non-const reference to the contents of a non-null managed pointer.
defineTypeNameAndDebug(combustionModel, 0)
virtual solverPerformance scalarSolve(solveScalarField &psi, const solveScalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
typeOfMag< Type >::type gSumMag(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)
static word getName(const dictionary &)
Find the preconditioner name (directly or from a sub-dictionary)
const volScalarField & psi
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Preconditioned conjugate gradient solver for symmetric lduMatrices using a run-time selectable precon...