initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / heatTransfer / chtMultiRegionFoam / fluid / pEqn.H
bloba264b68fe5eab2388d38ca1aaf75a3f416db2330
2     bool closedVolume = p.needReference();
4     rho = thermo.rho();
6     volScalarField rUA = 1.0/UEqn().A();
7     surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
9     U = rUA*UEqn().H();
11     surfaceScalarField phiU
12     (
13         fvc::interpolate(rho)
14        *(
15             (fvc::interpolate(U) & mesh.Sf())
16           + fvc::ddtPhiCorr(rUA, rho, U, phi)
17         )
18     );
20     phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rhorUAf;
22     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
23     {
24         fvScalarMatrix pEqn
25         (
26             fvm::ddt(psi, p)
27           + fvc::div(phi)
28           - fvm::laplacian(rhorUAf, p)
29         );
31         if
32         (
33             oCorr == nOuterCorr-1
34          && corr == nCorr-1
35          && nonOrth == nNonOrthCorr
36         )
37         {
38             pEqn.solve(mesh.solver(p.name() + "Final"));
39         }
40         else
41         {
42             pEqn.solve(mesh.solver(p.name()));
43         }
45         if (nonOrth == nNonOrthCorr)
46         {
47             phi += pEqn.flux();
48         }
49     }
51     // Correct velocity field
52     U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
53     U.correctBoundaryConditions();
55     // Update pressure substantive derivative
56     DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
58     // Solve continuity
59     #include "rhoEqn.H"
61     // Update continuity errors
62     #include "compressibleContinuityErrors.H"
64     // For closed-volume cases adjust the pressure and density levels
65     // to obey overall mass continuity
66     if (closedVolume)
67     {
68         p += (massIni - fvc::domainIntegrate(psi*p))
69             /fvc::domainIntegrate(psi);
70         rho = thermo.rho();
71     }
73     // Update thermal conductivity
74     K = thermoFluid[i].Cp()*turb.alphaEff();