openfoam/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/YEqns.H
Mark Olesen 27c62303ad ENH: for-range, forAllIters() ... in applications/solvers
- reduced clutter when iterating over containers
2019-01-07 09:20:51 +01:00

57 lines
1.6 KiB
C

{
for (phaseModel& phase : fluid.phases())
{
PtrList<volScalarField>& Y = phase.Y();
if (!Y.empty())
{
//- Su phase source terms
PtrList<volScalarField::Internal> Sus(Y.size());
//- Sp phase source terms
PtrList<volScalarField::Internal> Sps(Y.size());
forAll(Sus, i)
{
Sus.set
(
i,
new volScalarField::Internal
(
IOobject
(
"Su" + phase.name(),
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar(dimless/dimTime, Zero)
)
);
Sps.set
(
i,
new volScalarField::Internal
(
IOobject
(
"Sp" + phase.name(),
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar(dimless/dimTime, Zero)
)
);
}
forAll(Y, i)
{
// Calculate mass exchange for species consistent with
// alpha's source terms.
fluid.massSpeciesTransfer(phase, Sus[i], Sps[i], Y[i].name());
}
phase.solveYi(Sus, Sps);
}
}
}