Go to the documentation of this file.
30 template<
class Type,
class DType,
class LUType>
33 const word& fieldName,
42 rD_(matrix.
diag().size())
44 const label nCells = matrix.
diag().size();
45 const DType*
const __restrict__ diagPtr = matrix.
diag().begin();
46 DType* __restrict__ rDPtr = rD_.begin();
48 for (
label cellI=0; cellI<nCells; cellI++)
50 rDPtr[cellI] =
inv(diagPtr[cellI]);
57 template<
class Type,
class DType,
class LUType>
60 const word& fieldName_,
67 Type* __restrict__ psiPtr =
psi.begin();
72 Type* __restrict__ bPrimePtr = bPrime.begin();
74 const DType*
const __restrict__ rDPtr = rD_.begin();
76 const LUType*
const __restrict__ upperPtr =
77 matrix_.
upper().begin();
79 const LUType*
const __restrict__ lowerPtr =
80 matrix_.
lower().begin();
82 const label*
const __restrict__ uPtr =
85 const label*
const __restrict__ ownStartPtr =
106 bPrime = matrix_.
source();
124 label fEnd = ownStartPtr[0];
126 for (
label cellI=0; cellI<nCells; cellI++)
130 fEnd = ownStartPtr[cellI + 1];
133 curPsi = bPrimePtr[cellI];
136 for (
label curFace=fStart; curFace<fEnd; curFace++)
138 curPsi -=
dot(upperPtr[curFace], psiPtr[uPtr[curFace]]);
142 curPsi =
dot(rDPtr[cellI], curPsi);
145 for (
label curFace=fStart; curFace<fEnd; curFace++)
147 bPrimePtr[uPtr[curFace]] -=
dot(lowerPtr[curFace], curPsi);
150 psiPtr[cellI] = curPsi;
156 template<
class Type,
class DType,
class LUType>
163 smooth(this->fieldName_,
psi, this->matrix_, rD_, nSweeps);
A class for handling words, derived from string.
#define forAll(list, i)
Loop across all elements in list.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
TGaussSeidelSmoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
Construct from components.
void initMatrixInterfaces(const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
Field< LUType > & upper()
const labelUList & ownerStartAddr() const
Return owner start addressing.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
iterator begin()
Return an iterator to begin traversing the UList.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
const volScalarField & psi
void updateMatrixInterfaces(const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Update interfaced interfaces for matrix operations.
static void smooth(const word &fieldName, Field< Type > &psi, const LduMatrix< Type, DType, LUType > &matrix, const Field< DType > &rD, const label nSweeps)
Smooth for the given number of sweeps.
const LduInterfaceFieldPtrsList< Type > & interfaces() const
Return interfaces.
FieldField< Field, LUType > & interfacesUpper()
const lduAddressing & lduAddr() const
Return the LDU addressing.
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
Field< LUType > & lower()
void smooth(volScalarField &field, const scalar coeff)