You are on page 1of 2

In this section we will analyse step by step the pressure equation since this source code does not

solve only the pressure equation but executes also the corrector step for the velocity (which is used
as initial guess for the solution of the momentum equation in the next iteration step) and for the face
flux Φf which is used to discretize the convective terms in the momentum equation.

{
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rUAf = fvc::interpolate(rUA);

U = rUA*UEqn.H();

surfaceScalarField phiU
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);

adjustPhi(phiU, U, pd);

phi = phiU +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf();

for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)


{
fvScalarMatrix pdEqn
(
fvm::laplacian(rUAf, pd) == fvc::div(phi)
);

pdEqn.setReference(pdRefCell, pdRefValue);

if (corr == nCorr - 1 && nonOrth == nNonOrthCorr)


{
pdEqn.solve(mesh.solutionDict().solver(pd.name() + "Final"));
}
else
{
pdEqn.solve(mesh.solutionDict().solver(pd.name()));
}

if (nonOrth == nNonOrthCorr)
{
phi -= pdEqn.flux();
}
}

U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions();
}

You might also like