38 template<
class RdeltaTType,
class RhoType,
class SpType,
class SuType>
41 const RdeltaTType& rDeltaT,
58 psi.primitiveFieldRef() =
60 rho.field()*
psi.primitiveField()*rDeltaT
63 )/(
rho.field()*rDeltaT -
Sp.field());
67 psi.primitiveFieldRef() =
69 rho.field()*
psi.primitiveField()*rDeltaT
72 )/(
rho.field()*rDeltaT -
Sp.field());
75 psi.correctBoundaryConditions();
79 template<
class RhoType>
91 template<
class RhoType,
class SpType,
class SuType>
103 if (fv::localEulerDdt::enabled(
mesh))
110 const scalar rDeltaT = 1.0/
mesh.time().deltaTValue();
116 template<
class RhoType,
class PsiMaxType,
class PsiMinType>
123 const PsiMaxType& psiMax,
124 const PsiMinType& psiMin
147 const PsiMaxType& psiMax,
148 const PsiMinType& psiMin
153 if (fv::localEulerDdt::enabled(
mesh))
174 const scalar rDeltaT = 1.0/
mesh.time().deltaTValue();
206 const RdeltaTType& rDeltaT,
213 const PsiMaxType& psiMax,
214 const PsiMinType& psiMin
224 const label nLimiterIter
226 MULEScontrols.
get<label>(
"nLimiterIter")
229 const scalar smoothLimiter
234 const scalar extremaCoeff
239 const scalar boundaryExtremaCoeff
243 "boundaryExtremaCoeff",
248 const scalar boundaryDeltaExtremaCoeff
250 max(boundaryExtremaCoeff - extremaCoeff, 0)
270 mesh.time().timeName(),
274 IOobject::NO_REGISTER
284 lambda.boundaryFieldRef();
297 const label own = owner[facei];
298 const label nei = neighb[facei];
300 psiMaxn[own] =
max(psiMaxn[own], psiIf[nei]);
301 psiMinn[own] =
min(psiMinn[own], psiIf[nei]);
303 psiMaxn[nei] =
max(psiMaxn[nei], psiIf[own]);
304 psiMinn[nei] =
min(psiMinn[nei], psiIf[own]);
306 const scalar phiCorrf = phiCorrIf[facei];
310 sumPhip[own] += phiCorrf;
311 mSumPhim[nei] += phiCorrf;
315 mSumPhim[own] -= phiCorrf;
316 sumPhip[nei] -= phiCorrf;
325 const labelList& pFaceCells =
mesh.boundary()[patchi].faceCells();
333 label pfCelli = pFaceCells[pFacei];
335 psiMaxn[pfCelli] =
max(psiMaxn[pfCelli], psiPNf[pFacei]);
336 psiMinn[pfCelli] =
min(psiMinn[pfCelli], psiPNf[pFacei]);
343 const label pfCelli = pFaceCells[pFacei];
345 psiMaxn[pfCelli] =
max(psiMaxn[pfCelli], psiPf[pFacei]);
346 psiMinn[pfCelli] =
min(psiMinn[pfCelli], psiPf[pFacei]);
352 if (boundaryDeltaExtremaCoeff > 0)
356 const label pfCelli = pFaceCells[pFacei];
358 const scalar extrema =
359 boundaryDeltaExtremaCoeff
360 *(psiMax[pfCelli] - psiMin[pfCelli]);
362 psiMaxn[pfCelli] += extrema;
363 psiMinn[pfCelli] -= extrema;
370 const label pfCelli = pFaceCells[pFacei];
372 const scalar phiCorrf = phiCorrPf[pFacei];
376 sumPhip[pfCelli] += phiCorrf;
380 mSumPhim[pfCelli] -= phiCorrf;
385 psiMaxn =
min(psiMaxn + extremaCoeff*(psiMax - psiMin), psiMax);
386 psiMinn =
max(psiMinn - extremaCoeff*(psiMax - psiMin), psiMin);
388 if (smoothLimiter > SMALL)
391 min(smoothLimiter*psiIf + (1.0 - smoothLimiter)*psiMaxn, psiMax);
393 max(smoothLimiter*psiIf + (1.0 - smoothLimiter)*psiMinn, psiMin);
399 (
rho.field()*rDeltaT -
Sp.field())*psiMaxn
401 -
rho.field()*
psi.primitiveField()*rDeltaT
408 - (
rho.field()*rDeltaT -
Sp.field())*psiMinn
409 +
rho.field()*
psi.primitiveField()*rDeltaT
415 for (
int j=0; j<nLimiterIter; j++)
422 const label own = owner[facei];
423 const label nei = neighb[facei];
425 const scalar lambdaPhiCorrf = lambdaIf[facei]*phiCorrIf[facei];
427 if (lambdaPhiCorrf > 0)
429 sumlPhip[own] += lambdaPhiCorrf;
430 mSumlPhim[nei] += lambdaPhiCorrf;
434 mSumlPhim[own] -= lambdaPhiCorrf;
435 sumlPhip[nei] -= lambdaPhiCorrf;
444 const labelList& pFaceCells =
mesh.boundary()[patchi].faceCells();
448 label pfCelli = pFaceCells[pFacei];
450 scalar lambdaPhiCorrf = lambdaPf[pFacei]*phiCorrfPf[pFacei];
452 if (lambdaPhiCorrf > 0)
454 sumlPhip[pfCelli] += lambdaPhiCorrf;
458 mSumlPhim[pfCelli] -= lambdaPhiCorrf;
468 (sumlPhip[celli] + psiMaxn[celli])
469 /(mSumPhim[celli] + ROOTVSMALL),
476 (mSumlPhim[celli] + psiMinn[celli])
477 /(sumPhip[celli] + ROOTVSMALL),
487 if (phiCorrIf[facei] > 0)
489 lambdaIf[facei] =
min 492 min(lambdap[owner[facei]], lambdam[neighb[facei]])
497 lambdaIf[facei] =
min 500 min(lambdam[owner[facei]], lambdap[neighb[facei]])
512 if (isA<wedgeFvPatch>(
mesh.boundary()[patchi]))
519 mesh.boundary()[patchi].faceCells();
523 const label pfCelli = pFaceCells[pFacei];
525 if (phiCorrfPf[pFacei] > 0)
528 min(lambdaPf[pFacei], lambdap[pfCelli]);
533 min(lambdaPf[pFacei], lambdam[pfCelli]);
540 mesh.boundary()[patchi].faceCells();
546 if ((phiPf[pFacei] + phiCorrfPf[pFacei]) > SMALL*SMALL)
548 const label pfCelli = pFaceCells[pFacei];
550 if (phiCorrfPf[pFacei] > 0)
553 min(lambdaPf[pFacei], lambdap[pfCelli]);
558 min(lambdaPf[pFacei], lambdam[pfCelli]);
581 const RdeltaTType& rDeltaT,
588 const PsiMaxType& psiMax,
589 const PsiMinType& psiMin
601 mesh.time().timeName(),
605 IOobject::NO_REGISTER
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
virtual bool coupled() const
True if the patch field is coupled.
void size(const label n)
Older name for setAddressableSize.
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
Dimensionless.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su)
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/chef2/andy/OpenFOAM/release/v2406/OpenFOAM-v2406/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{});alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
void limiterCorr(scalarField &allLambda, const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin)
Mesh data needed to do the Finite Volume discretisation.
virtual bool fixesValue() const
True if the patch field fixes a value.
void limitCorr(const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin)
messageStream Info
Information stream (stdout output on master, null elsewhere)
const volScalarField & psi
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Specialization of GeometricField which holds slices of given complete fields in a form that they act ...
Defines the attributes of an object for which implicit objectRegistry management is supported...
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
static constexpr const zero Zero
Global zero (0)