Files
OpenFOAM-6/applications
Henry Weller a9cb40b55b reactingEulerFoam::phasePair: Provide more convenient method to "loop" over pair
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);
            }
2018-01-01 16:06:56 +00:00
..