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