36 const label nPhases = phiPsiCorrs.
size();
38 forAll(phiPsiCorrs[0], facei)
45 if (phiPsiCorrs[
phasei][facei] > 0)
47 sumPos += phiPsiCorrs[
phasei][facei];
51 sumNeg += phiPsiCorrs[
phasei][facei];
55 scalar
sum = sumPos + sumNeg;
57 if (
sum > 0 && sumPos > VSMALL)
59 scalar
lambda = -sumNeg/sumPos;
63 if (phiPsiCorrs[
phasei][facei] > 0)
69 else if (
sum < 0 && sumNeg < -VSMALL)
71 scalar
lambda = -sumPos/sumNeg;
75 if (phiPsiCorrs[
phasei][facei] < 0)
87 const UPtrList<const scalarField>& alphas,
88 UPtrList<scalarField>& phiPsiCorrs,
89 const labelHashSet& fixed
95 forAll(phiPsiCorrs[0], facei)
97 scalar alphaNotFixed = 0, corrNotFixed = 0;
98 for (
const label
phasei : notFixed)
100 alphaNotFixed += alphas[
phasei][facei];
101 corrNotFixed += phiPsiCorrs[
phasei][facei];
104 scalar corrFixed = 0;
105 for (
const label
phasei : fixed)
107 corrFixed += phiPsiCorrs[
phasei][facei];
110 const scalar sumCorr = corrNotFixed + corrFixed;
112 const scalar
lambda = - sumCorr/alphaNotFixed;
114 for (
const label
phasei : notFixed)
MULES: Multidimensional universal limiter for explicit solution.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
label size() const noexcept
The number of entries in the list.
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
IOstream & fixed(IOstream &io)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
#define forAll(list, i)
Loop across all elements in list.