initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / heatTransfer / buoyantBoussinesqSimpleFoam / pEqn.H
blob6408c7ccc80754426579d2feab91af7e744a7bb8
2     volScalarField rUA("rUA", 1.0/UEqn().A());
3     surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
5     U = rUA*UEqn().H();
6     UEqn.clear();
8     phi = fvc::interpolate(U) & mesh.Sf();
9     adjustPhi(phi, U, p);
11     surfaceScalarField buoyancyPhi =
12         rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
13     phi += buoyancyPhi;
15     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
16     {
17         fvScalarMatrix pEqn
18         (
19             fvm::laplacian(rUAf, p) == fvc::div(phi)
20         );
22         pEqn.setReference(pRefCell, pRefValue);
24         // retain the residual from the first iteration
25         if (nonOrth == 0)
26         {
27             eqnResidual = pEqn.solve().initialResidual();
28             maxResidual = max(eqnResidual, maxResidual);
29         }
30         else
31         {
32             pEqn.solve();
33         }
35         if (nonOrth == nNonOrthCorr)
36         {
37             // Calculate the conservative fluxes
38             phi -= pEqn.flux();
40             // Explicitly relax pressure for momentum corrector
41             p.relax();
43             // Correct the momentum source with the pressure gradient flux
44             // calculated from the relaxed pressure
45             U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
46             U.correctBoundaryConditions();
47         }
48     }
50     #include "continuityErrs.H"