45 const RdeltaTType& rDeltaT,
52 const PsiMaxType& psiMax,
53 const PsiMinType& psiMin
61 const scalar boundaryDeltaExtremaCoeff
83 if (controls.
tol != 0)
85 phiCorrNorm = (V*(
rho.primitiveField()*rDeltaT -
Sp.primitiveField()));
98 const label own = owner[facei];
99 const label nei = neighb[facei];
101 const scalar phiCorrf = phiCorrIf[facei];
105 sumPhip[own] += phiCorrf;
106 mSumPhim[nei] += phiCorrf;
110 mSumPhim[own] -= phiCorrf;
111 sumPhip[nei] -= phiCorrf;
122 const label pfCelli = pFaceCells[pFacei];
123 const scalar phiCorrf = phiCorrPf[pFacei];
127 sumPhip[pfCelli] += phiCorrf;
131 mSumPhim[pfCelli] -= phiCorrf;
143 const label own = owner[facei];
144 const label nei = neighb[facei];
146 psiMaxn[own] =
max(psiMaxn[own], psiIf[nei]);
147 psiMinn[own] =
min(psiMinn[own], psiIf[nei]);
149 psiMaxn[nei] =
max(psiMaxn[nei], psiIf[own]);
150 psiMinn[nei] =
min(psiMinn[nei], psiIf[own]);
152 const scalar phiCorrf = phiCorrIf[facei];
156 sumPhip[own] += phiCorrf;
157 mSumPhim[nei] += phiCorrf;
161 mSumPhim[own] -= phiCorrf;
162 sumPhip[nei] -= phiCorrf;
179 const label pfCelli = pFaceCells[pFacei];
181 psiMaxn[pfCelli] =
max(psiMaxn[pfCelli], psiPNf[pFacei]);
182 psiMinn[pfCelli] =
min(psiMinn[pfCelli], psiPNf[pFacei]);
189 const label pfCelli = pFaceCells[pFacei];
191 psiMaxn[pfCelli] =
max(psiMaxn[pfCelli], psiPf[pFacei]);
192 psiMinn[pfCelli] =
min(psiMinn[pfCelli], psiPf[pFacei]);
198 if (boundaryDeltaExtremaCoeff > 0)
202 const label pfCelli = pFaceCells[pFacei];
204 const scalar extrema =
205 boundaryDeltaExtremaCoeff
206 *(psiMax[pfCelli] - psiMin[pfCelli]);
208 psiMaxn[pfCelli] += extrema;
209 psiMinn[pfCelli] -= extrema;
216 const label pfCelli = pFaceCells[pFacei];
217 const scalar phiCorrf = phiCorrPf[pFacei];
221 sumPhip[pfCelli] += phiCorrf;
225 mSumPhim[pfCelli] -= phiCorrf;
246 psiMaxn =
min(psiMaxn, psiMax);
247 psiMinn =
max(psiMinn, psiMin);
270 V*((
rho.primitiveField()*rDeltaT -
Sp.primitiveField())*psiMaxn)
275 - V*((
rho.primitiveField()*rDeltaT -
Sp.primitiveField())*psiMinn);
283 if (controls.
tol != 0)
297 surfaceScalarField::Internal::null()
304 for (
int j=0; j<controls.
nIter; j++)
307 scalar maxDeltaLambdaPhiCorrRes = 0;
318 const label own = owner[facei];
319 const label nei = neighb[facei];
321 const scalar lambdaPhiCorrf = lambdaIf[facei]*phiCorrIf[facei];
323 if (lambdaPhiCorrf > 0)
325 sumlPhip[own] += lambdaPhiCorrf;
326 mSumlPhim[nei] += lambdaPhiCorrf;
330 mSumlPhim[own] -= lambdaPhiCorrf;
331 sumlPhip[nei] -= lambdaPhiCorrf;
345 const label pfCelli = pFaceCells[pFacei];
346 const scalar lambdaPhiCorrf =
347 lambdaPf[pFacei]*phiCorrfPf[pFacei];
349 if (lambdaPhiCorrf > 0)
351 sumlPhip[pfCelli] += lambdaPhiCorrf;
355 mSumlPhim[pfCelli] -= lambdaPhiCorrf;
372 psiMaxn[celli]/(mSumPhim[celli] + rootVSmall),
379 psiMinn[celli]/(sumPhip[celli] + rootVSmall),
391 (sumlPhip[celli] + psiMaxn[celli])
392 /(mSumPhim[celli] + rootVSmall),
399 (mSumlPhim[celli] + psiMinn[celli])
400 /(sumPhip[celli] + rootVSmall),
408 const scalar lambdaIf0 = lambdaIf[facei];
410 if (phiCorrIf[facei] > 0)
413 min(lambdap[owner[facei]], lambdam[neighb[facei]]);
418 min(lambdam[owner[facei]], lambdap[neighb[facei]]);
421 if (controls.
tol > 0)
423 const scalar phiCorrRes =
424 mag(phiCorrIf[facei])
425 /
min(phiCorrNorm[owner[facei]], phiCorrNorm[neighb[facei]]);
427 if (phiCorrRes > controls.
tol)
429 maxDeltaLambdaPhiCorrRes =
max
431 maxDeltaLambdaPhiCorrRes,
432 mag(lambdaIf[facei] - lambdaIf0)*phiCorrRes
454 if (controls.
tol > 0)
456 lambdaBf0[
patchi] = lambdaPf;
461 const label pfCelli = pFaceCells[pFacei];
463 if (phiCorrfPf[pFacei] > 0)
465 lambdaPf[pFacei] = lambdap[pfCelli];
469 lambdaPf[pFacei] = lambdam[pfCelli];
483 if ((phiBDPf[pFacei] + phiCorrfPf[pFacei]) > small*small)
485 const label pfCelli = pFaceCells[pFacei];
486 const scalar lambdaPf0 = lambdaPf[pFacei];
488 if (phiCorrfPf[pFacei] > 0)
490 lambdaPf[pFacei] = lambdap[pfCelli];
494 lambdaPf[pFacei] = lambdam[pfCelli];
497 if (controls.
tol > 0)
499 const scalar phiCorrRes =
500 mag(phiCorrfPf[pFacei])/phiCorrNorm[pfCelli];
502 if (phiCorrRes > controls.
tol)
504 maxDeltaLambdaPhiCorrRes =
max
506 maxDeltaLambdaPhiCorrRes,
507 mag(lambdaPf[pFacei] - lambdaPf0)*phiCorrRes
519 surfaceScalarField::Internal::null(),
530 lambdaPf =
min(lambdaPf, lambdaNbrPf);
532 if (controls.
tol > 0)
542 const scalar phiCorrRes =
543 mag(phiCorrfPf[pFacei])
544 /phiCorrNorm[pFaceCells[pFacei]];
546 if (phiCorrRes > controls.
tol)
548 maxDeltaLambdaPhiCorrRes =
max
550 maxDeltaLambdaPhiCorrRes,
551 mag(lambdaPf[pFacei] - lambdaPf0[pFacei])
561 if (controls.
tol != 0)
567 Info<<
"MULES: maxDeltaLambdaPhiCorrRes "
568 << maxDeltaLambdaPhiCorrRes <<
endl;
571 if (maxDeltaLambdaPhiCorrRes < controls.
tol)
break;
MULES: Multidimensional universal limiter for explicit solution.
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricBoundaryField class.
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField of the values on the other side of couples.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void size(const label)
Override size to be inconsistent with allocated storage.
bool set(const label) const
Is element set.
Foam::calculatedFvsPatchField.
Mesh data needed to do the Finite Volume discretisation.
const labelUList & owner() const
Internal face owner.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const labelUList & neighbour() const
Internal face neighbour.
tmp< DimensionedField< scalar, volMesh > > Vsc() const
Return sub-cycle cell volumes.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual bool coupled() const
Return true if this patch field is coupled.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking) const
Return patchField on the opposite patch of a coupled patch.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
virtual bool coupled() const
Return true if this patch field is coupled.
A class for managing temporary objects.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const volScalarField & psi
dimensionedScalar lambda(viscosity->lookup("lambda"))
void limiter(const control &controls, surfaceScalarField &lambda, const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const scalarField &SuCorr, const surfaceScalarField &phi, const surfaceScalarField &phiCorr, const SpType &Sp, const PsiMaxType &psiMax, const PsiMinType &psiMin)
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Switch globalBounds
Optional switch to select global bounds only.
scalar smoothingCoeff
Optional coefficient to reduce the allowed range of the solution to.
scalar boundaryExtremaCoeff
Optional coefficient to relax the local boundedness constraint.
label nIter
Optional maximum number of limiter iterations.
scalar extremaCoeff
Optional coefficient to relax the local boundedness constraint.
scalar tol
Optional limiter convergence tolerance.