32 forAll(phiPsiCorrs[0], facei)
37 for (
int phasei=0; phasei<phiPsiCorrs.
size(); phasei++)
39 if (phiPsiCorrs[phasei][facei] > 0)
41 sumPos += phiPsiCorrs[phasei][facei];
45 sumNeg += phiPsiCorrs[phasei][facei];
49 const scalar
sum = sumPos + sumNeg;
51 if (
sum > 0 && sumPos > vSmall)
53 const scalar
lambda = -sumNeg/sumPos;
55 forAll (phiPsiCorrs, phasei)
57 if (phiPsiCorrs[phasei][facei] > 0)
59 phiPsiCorrs[phasei][facei] *=
lambda;
63 else if (
sum < 0 && sumNeg < -vSmall)
65 const scalar
lambda = -sumPos/sumNeg;
67 forAll (phiPsiCorrs, phasei)
69 if (phiPsiCorrs[phasei][facei] < 0)
71 phiPsiCorrs[phasei][facei] *=
lambda;
MULES: Multidimensional universal limiter for explicit solution.
#define forAll(list, i)
Loop across all elements in list.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
label size() const
Return the number of elements in the UPtrList.
dimensionedScalar lambda(viscosity->lookup("lambda"))
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)