Skip to content
Snippets Groups Projects
pEqn.H 1.04 KiB
Newer Older
{
    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)
    );

    phi = phiU +
        (
henry's avatar
henry committed
            fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)*mesh.magSf()
          + fvc::interpolate(rho)*(g & mesh.Sf())
        )*rUAf;
henry's avatar
henry committed
    adjustPhi(phi, U, p);

    for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
henry's avatar
henry committed
        fvScalarMatrix pEqn
henry's avatar
henry committed
            fvm::laplacian(rUAf, p) == fvc::div(phi)
henry's avatar
henry committed
        pEqn.setReference(pRefCell, pRefValue);

        if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
        {
henry's avatar
henry committed
            pEqn.solve(mesh.solver(p.name() + "Final"));
henry's avatar
henry committed
            pEqn.solve(mesh.solver(p.name()));
        }

        if (nonOrth == nNonOrthCorr)
        {
henry's avatar
henry committed
            phi -= pEqn.flux();
        }
    }

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