Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / equationReaderDemo / pEqn.H
blob42ebfc22531439a59eb018f2e6db5a731f782543
1     p.boundaryField().updateCoeffs();
3     volScalarField AU = UEqn().A();
4     U = UEqn().H()/AU;
5     UEqn.clear();
6     phi = fvc::interpolate(U) & mesh.Sf();
7     adjustPhi(phi, U, p);
9     // Non-orthogonal pressure corrector loop
10     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
11     {
12         fvScalarMatrix pEqn
13         (
14             fvm::laplacian(1.0/AU, p) == fvc::div(phi)
15         );
17         pEqn.setReference(pRefCell, pRefValue);
19         // Retain the residual from the first iteration
20         if (nonOrth == 0)
21         {
22             eqnResidual = pEqn.solve().initialResidual();
23             maxResidual = max(eqnResidual, maxResidual);
24         }
25         else
26         {
27             pEqn.solve();
28         }
30         if (nonOrth == nNonOrthCorr)
31         {
32             phi -= pEqn.flux();
33         }
34     }
36 #   include "continuityErrs.H"
38     // Explicitly relax pressure for momentum corrector
39     p.relax();
41     // Momentum corrector
42     U -= fvc::grad(p)/AU;
43     U.correctBoundaryConditions();