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,
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;
107 corrFixed += phiPsiCorrs[
phasei][facei];
110 const scalar sumCorr = corrNotFixed + corrFixed;
112 const scalar
lambda = - sumCorr/alphaNotFixed;
114 for (
const label
phasei : notFixed)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
IOstream & fixed(IOstream &io)
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
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...
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
label size() const noexcept
The number of entries in the list.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
MULES: Multidimensional universal limiter for explicit solution.