openfoam/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
Henry 5b4cd73e55 PIMPLE: Rationalised loop structure
Automated the caching of "finalIteration".
2011-03-26 21:48:15 +00:00

73 lines
1.6 KiB
C

{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf(fvc::interpolate(rAU));
U = rAU*UEqn.H();
surfaceScalarField phiU
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
);
adjustPhi(phiU, U, p_rgh);
phi = phiU +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf();
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
const volScalarField& vDotcP = vDotP[0]();
const volScalarField& vDotvP = vDotP[1]();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix p_rghEqn
(
fvc::div(phi) - fvm::laplacian(rAUf, p_rgh)
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
);
p_rghEqn.setReference(pRefCell, pRefValue);
p_rghEqn.solve
(
mesh.solver
(
p_rgh.select
(
pimpleCorr.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
);
if (nonOrth == nNonOrthCorr)
{
phi += p_rghEqn.flux();
}
}
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions();
#include "continuityErrs.H"
p == p_rgh + rho*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
p_rgh = p - rho*gh;
}
}