initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / compressible / rhoPorousSimpleFoam / pEqn.H
blob4d8e010f7e352464dd92558f23342c10774f6575
1 if (pressureImplicitPorosity)
3     U = trTU()&UEqn().H();
5 else
7     U = trAU()*UEqn().H();
10 UEqn.clear();
12 phi = fvc::interpolate(rho*U) & mesh.Sf();
13 bool closedVolume = adjustPhi(phi, U, p);
15 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
17     tmp<fvScalarMatrix> tpEqn;
19     if (pressureImplicitPorosity)
20     {
21         tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
22     }
23     else
24     {
25         tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
26     }
28     tpEqn().setReference(pRefCell, pRefValue);
29     // retain the residual from the first iteration
30     if (nonOrth == 0)
31     {
32         eqnResidual = tpEqn().solve().initialResidual();
33         maxResidual = max(eqnResidual, maxResidual);
34     }
35     else
36     {
37         tpEqn().solve();
38     }
40     if (nonOrth == nNonOrthCorr)
41     {
42         phi -= tpEqn().flux();
43     }
46 #include "incompressible/continuityErrs.H"
48 // Explicitly relax pressure for momentum corrector
49 p.relax();
51 if (pressureImplicitPorosity)
53     U -= trTU()&fvc::grad(p);
55 else
57     U -= trAU()*fvc::grad(p);
60 U.correctBoundaryConditions();
62 bound(p, pMin);
64 // For closed-volume cases adjust the pressure and density levels
65 // to obey overall mass continuity
66 if (closedVolume)
68     p += (initialMass - fvc::domainIntegrate(psi*p))
69         /fvc::domainIntegrate(psi);
72 rho = thermo.rho();
73 rho.relax();
74 Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;