ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / applications / solvers / compressible / rhoSimpleFoam / rhoPorousMRFSimpleFoam / pEqn.H
blob4fc258870b9a3b2225615659de250828a281f7fd
1 if (pressureImplicitPorosity)
3     U = trTU()&UEqn().H();
5 else
7     U = trAU()*UEqn().H();
10 UEqn.clear();
12 bool closedVolume = false;
14 if (simple.transonic())
16     surfaceScalarField phid
17     (
18         "phid",
19         fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
20     );
21     mrfZones.relativeFlux(fvc::interpolate(psi), phid);
23     for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
24     {
25         tmp<fvScalarMatrix> tpEqn;
27         if (pressureImplicitPorosity)
28         {
29             tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trTU(), p));
30         }
31         else
32         {
33             tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trAU(), p));
34         }
36         tpEqn().setReference(pRefCell, pRefValue);
38         tpEqn().solve();
40         if (nonOrth == simple.nNonOrthCorr())
41         {
42             phi == tpEqn().flux();
43         }
44     }
46 else
48     phi = fvc::interpolate(rho*U) & mesh.Sf();
49     mrfZones.relativeFlux(fvc::interpolate(rho), phi);
51     closedVolume = adjustPhi(phi, U, p);
53     for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
54     {
55         tmp<fvScalarMatrix> tpEqn;
57         if (pressureImplicitPorosity)
58         {
59             tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
60         }
61         else
62         {
63             tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
64         }
66         tpEqn().setReference(pRefCell, pRefValue);
68         tpEqn().solve();
70         if (nonOrth == simple.nNonOrthCorr())
71         {
72             phi -= tpEqn().flux();
73         }
74     }
77 #include "incompressible/continuityErrs.H"
79 // Explicitly relax pressure for momentum corrector
80 p.relax();
82 if (pressureImplicitPorosity)
84     U -= trTU()&fvc::grad(p);
86 else
88     U -= trAU()*fvc::grad(p);
91 U.correctBoundaryConditions();
93 // For closed-volume cases adjust the pressure and density levels
94 // to obey overall mass continuity
95 if (closedVolume)
97     p += (initialMass - fvc::domainIntegrate(psi*p))
98         /fvc::domainIntegrate(psi);
101 rho = thermo.rho();
102 rho = max(rho, rhoMin);
103 rho = min(rho, rhoMax);
104 rho.relax();
105 Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;