mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
Checking a pair contains a particular phase and adding a contribution from the
"other" phase can now be written:
if (pair.contains(phase))
{
const phaseModel& otherPhase = pair.other(phase);
phiHbyAs[phasei] +=
fvc::interpolate(rAUs[phasei]*K)
*MRF.absolute(otherPhase.phi());
HbyAs[phasei] += rAUs[phasei]*K*otherPhase.U();
}
which previously would have been written as a loop over the pair and excluding
self reference:
const phaseModel* phase1 = &pair.phase1();
const phaseModel* phase2 = &pair.phase2();
forAllConstIter(phasePair, pair, iter)
{
if (phase1 == &phase)
{
phiHbyAs[phasei] +=
fvc::interpolate(rAUs[phasei]*K)
*MRF.absolute(phase2->phi());
HbyAs[phasei] += rAUs[phasei]*K*phase2->U();
}
Swap(phase1, phase2);
}