FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

pEqn.H

Go to the documentation of this file.
00001 rho = thermo.rho();
00002 
00003 volScalarField rUA = 1.0/UEqn().A();
00004 U = rUA*UEqn().H();
00005 
00006 if (nCorr <= 1)
00007 {
00008     UEqn.clear();
00009 }
00010 
00011 if (transonic)
00012 {
00013     surfaceScalarField phid
00014     (
00015         "phid",
00016         fvc::interpolate(psi)
00017        *(
00018             (fvc::interpolate(U) & mesh.Sf())
00019           + fvc::ddtPhiCorr(rUA, rho, U, phi)
00020         )
00021     );
00022     mrfZones.relativeFlux(fvc::interpolate(psi), phid);
00023 
00024     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00025     {
00026         fvScalarMatrix pEqn
00027         (
00028             fvm::ddt(psi, p)
00029           + fvm::div(phid, p)
00030           - fvm::laplacian(rho*rUA, p)
00031         );
00032 
00033         if
00034         (
00035             oCorr == nOuterCorr-1
00036             && corr == nCorr-1
00037             && nonOrth == nNonOrthCorr
00038         )
00039         {
00040             pEqn.solve(mesh.solver("pFinal"));
00041         }
00042         else
00043         {
00044             pEqn.solve();
00045         }
00046 
00047         if (nonOrth == nNonOrthCorr)
00048         {
00049             phi == pEqn.flux();
00050         }
00051     }
00052 }
00053 else
00054 {
00055     phi =
00056         fvc::interpolate(rho)*
00057         (
00058             (fvc::interpolate(U) & mesh.Sf())
00059           + fvc::ddtPhiCorr(rUA, rho, U, phi)
00060         );
00061     mrfZones.relativeFlux(fvc::interpolate(rho), phi);
00062 
00063     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00064     {
00065         // Pressure corrector
00066         fvScalarMatrix pEqn
00067         (
00068             fvm::ddt(psi, p)
00069           + fvc::div(phi)
00070           - fvm::laplacian(rho*rUA, p)
00071         );
00072 
00073         if
00074         (
00075             oCorr == nOuterCorr-1
00076          && corr == nCorr-1
00077          && nonOrth == nNonOrthCorr
00078         )
00079         {
00080             pEqn.solve(mesh.solver("pFinal"));
00081         }
00082         else
00083         {
00084             pEqn.solve();
00085         }
00086 
00087         if (nonOrth == nNonOrthCorr)
00088         {
00089             phi += pEqn.flux();
00090         }
00091     }
00092 }
00093 
00094 #include <finiteVolume/rhoEqn.H>
00095 #include <finiteVolume/compressibleContinuityErrs.H>
00096 
00097 //if (oCorr != nOuterCorr-1)
00098 {
00099     // Explicitly relax pressure for momentum corrector
00100     p.relax();
00101 
00102     rho = thermo.rho();
00103     rho.relax();
00104     Info<< "rho max/min : " << max(rho).value()
00105         << " " << min(rho).value() << endl;
00106 }
00107 
00108 U -= rUA*fvc::grad(p);
00109 U.correctBoundaryConditions();
00110 
00111 DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
00112 
00113 bound(p, pMin);
00114 
00115 // For closed-volume cases adjust the pressure and density levels
00116 // to obey overall mass continuity
00117 /*
00118 if (closedVolume)
00119 {
00120     p += (initialMass - fvc::domainIntegrate(psi*p))
00121         /fvc::domainIntegrate(psi);
00122 }
00123 */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines