ENH: partialWrite: support lagrangian
[OpenFOAM-1.7.x.git] / applications / solvers / incompressible / porousSimpleFoam / pEqn.H
blobe6797cd8603b8032e1c901583b6ddb15992b7ddc
1 if (pressureImplicitPorosity)
3     U = trTU()&UEqn().H();
5 else
7     U = trAU()*UEqn().H();
10 UEqn.clear();
11 phi = fvc::interpolate(U) & mesh.Sf();
12 adjustPhi(phi, U, p);
14 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
16     tmp<fvScalarMatrix> tpEqn;
18     if (pressureImplicitPorosity)
19     {
20         tpEqn = (fvm::laplacian(trTU(), p) == fvc::div(phi));
21     }
22     else
23     {
24         tpEqn = (fvm::laplacian(trAU(), p) == fvc::div(phi));
25     }
27     tpEqn().setReference(pRefCell, pRefValue);
28     // retain the residual from the first iteration
29     if (nonOrth == 0)
30     {
31         eqnResidual = tpEqn().solve().initialResidual();
32         maxResidual = max(eqnResidual, maxResidual);
33     }
34     else
35     {
36         tpEqn().solve();
37     }
39     if (nonOrth == nNonOrthCorr)
40     {
41         phi -= tpEqn().flux();
42     }
45 #include "continuityErrs.H"
47 // Explicitly relax pressure for momentum corrector
48 p.relax();
50 if (pressureImplicitPorosity)
52     U -= trTU()&fvc::grad(p);
54 else
56     U -= trAU()*fvc::grad(p);
59 U.correctBoundaryConditions();