ENH: Time: access to libs
[OpenFOAM-2.0.x.git] / applications / solvers / heatTransfer / buoyantBoussinesqSimpleFoam / pEqn.H
blob5d643837ffcdc31b46d5fc4c299cd3a30a21dc63
2     volScalarField rAU("rAU", 1.0/UEqn().A());
3     surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
5     U = rAU*UEqn().H();
6     UEqn.clear();
8     phi = fvc::interpolate(U) & mesh.Sf();
9     adjustPhi(phi, U, p_rgh);
11     surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
12     phi -= buoyancyPhi;
14     for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
15     {
16         fvScalarMatrix p_rghEqn
17         (
18             fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
19         );
21         p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
23         p_rghEqn.solve();
25         if (nonOrth == simple.nNonOrthCorr())
26         {
27             // Calculate the conservative fluxes
28             phi -= p_rghEqn.flux();
30             // Explicitly relax pressure for momentum corrector
31             p_rgh.relax();
33             // Correct the momentum source with the pressure gradient flux
34             // calculated from the relaxed pressure
35             U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rAUf);
36             U.correctBoundaryConditions();
37         }
38     }
40     #include "continuityErrs.H"
42     p = p_rgh + rhok*gh;
44     if (p_rgh.needReference())
45     {
46         p += dimensionedScalar
47         (
48             "p",
49             p.dimensions(),
50             pRefValue - getRefCellValue(p, pRefCell)
51         );
52         p_rgh = p - rhok*gh;
53     }