pdEqn.H 1.15 KB
Newer Older
Andrew Heather's avatar
Andrew Heather committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
    volScalarField rUA("rUA", 1.0/UEqn().A());
    surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));

    U = rUA*UEqn().H();
    UEqn.clear();

    phi =
        (fvc::interpolate(U) & mesh.Sf())
      + fvc::ddtPhiCorr(rUA, U, phi)
      + betaghf*fvc::snGrad(T)*rUAf*mesh.magSf();

    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
        fvScalarMatrix pdEqn
        (
            fvm::laplacian(rUAf, pd) == fvc::div(phi)
        );

        // retain the residual from the first iteration
        if (nonOrth == 0)
        {
            pdEqn.solve(mesh.solver(pd.name() + "Final"));
        }
        else
        {
            pdEqn.solve(mesh.solver(pd.name()));
        }

        if (nonOrth == nNonOrthCorr)
        {
            // Calculate the conservative fluxes
            phi -= pdEqn.flux();

            // Correct the momentum source with the pressure gradient flux
            // calculated from the relaxed pressure
            U -=
                rUA
               *fvc::reconstruct((pdEqn.flux() - betaghf*fvc::snGrad(T))/rUAf);
            U.correctBoundaryConditions();
        }
    }

    #include "continuityErrs.H"
}