mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
The deprecated non-const tmp functionality is now on the compiler switch NON_CONST_TMP which can be enabled by adding -DNON_CONST_TMP to EXE_INC in the Make/options file. However, it is recommended to upgrade all code to the new safer tmp by using the '.ref()' member function rather than the non-const '()' dereference operator when non-const access to the temporary object is required. Please report any problems on Mantis. Henry G. Weller CFD Direct.
120 lines
2.9 KiB
C
120 lines
2.9 KiB
C
{
|
|
word alphaScheme("div(phi,alpha)");
|
|
word alpharScheme("div(phirb,alpha)");
|
|
|
|
if (MULESCorr)
|
|
{
|
|
fvScalarMatrix alpha1Eqn
|
|
(
|
|
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
|
|
+ fv::gaussConvectionScheme<scalar>
|
|
(
|
|
mesh,
|
|
phi,
|
|
upwind<scalar>(mesh, phi)
|
|
).fvmDiv(phi, alpha1)
|
|
);
|
|
|
|
solve(alpha1Eqn);
|
|
|
|
Info<< "Phase-1 volume fraction = "
|
|
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
|
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
|
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
|
|
<< endl;
|
|
|
|
tmp<surfaceScalarField> talphaPhiUD(alpha1Eqn.flux());
|
|
alphaPhi = talphaPhiUD();
|
|
|
|
if (alphaApplyPrevCorr && talphaPhiCorr0.valid())
|
|
{
|
|
Info<< "Applying the previous iteration correction flux" << endl;
|
|
|
|
MULES::correct
|
|
(
|
|
alpha1,
|
|
alphaPhi,
|
|
talphaPhiCorr0.ref(),
|
|
mixture.alphaMax(),
|
|
0
|
|
);
|
|
|
|
alphaPhi += talphaPhiCorr0();
|
|
}
|
|
|
|
// Cache the upwind-flux
|
|
talphaPhiCorr0 = talphaPhiUD;
|
|
}
|
|
|
|
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
|
{
|
|
tmp<surfaceScalarField> talphaPhiUn
|
|
(
|
|
fvc::flux
|
|
(
|
|
phi,
|
|
alpha1,
|
|
alphaScheme
|
|
)
|
|
+ fvc::flux
|
|
(
|
|
phir,
|
|
alpha1,
|
|
alpharScheme
|
|
)
|
|
);
|
|
|
|
if (MULESCorr)
|
|
{
|
|
tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);
|
|
volScalarField alpha10("alpha10", alpha1);
|
|
|
|
MULES::correct
|
|
(
|
|
alpha1,
|
|
talphaPhiUn(),
|
|
talphaPhiCorr.ref(),
|
|
mixture.alphaMax(),
|
|
0
|
|
);
|
|
|
|
// Under-relax the correction for all but the 1st corrector
|
|
if (aCorr == 0)
|
|
{
|
|
alphaPhi += talphaPhiCorr();
|
|
}
|
|
else
|
|
{
|
|
alpha1 = 0.5*alpha1 + 0.5*alpha10;
|
|
alphaPhi += 0.5*talphaPhiCorr();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
alphaPhi = talphaPhiUn;
|
|
|
|
MULES::explicitSolve
|
|
(
|
|
alpha1,
|
|
phi,
|
|
alphaPhi,
|
|
mixture.alphaMax(),
|
|
0
|
|
);
|
|
}
|
|
}
|
|
|
|
if (alphaApplyPrevCorr && MULESCorr)
|
|
{
|
|
talphaPhiCorr0 = alphaPhi - talphaPhiCorr0;
|
|
}
|
|
|
|
alpha2 = 1.0 - alpha1;
|
|
|
|
Info<< "Phase-1 volume fraction = "
|
|
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
|
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
|
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
|
|
<< endl;
|
|
}
|