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 {
00002     rho = thermo.rho();
00003 
00004     volScalarField rUA = 1.0/UEqn.A();
00005     surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
00006 
00007     U = rUA*UEqn.H();
00008 
00009     phi = fvc::interpolate(rho)*
00010     (
00011         (fvc::interpolate(U) & mesh.Sf())
00012       + fvc::ddtPhiCorr(rUA, rho, U, phi)
00013     );
00014 
00015     surfaceScalarField buoyancyPhi = -rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
00016     phi += buoyancyPhi;
00017 
00018     {
00019         fvScalarMatrix p_rghDDtEqn
00020         (
00021             fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
00022           + fvc::div(phi)
00023         );
00024 
00025         // Thermodynamic density needs to be updated by psi*d(p) after the
00026         // pressure solution - done in 2 parts. Part 1:
00027         thermo.rho() -= psi*p_rgh;
00028 
00029         for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00030         {
00031             fvScalarMatrix p_rghEqn
00032             (
00033                 p_rghDDtEqn - fvm::laplacian(rhorUAf, p_rgh)
00034             );
00035 
00036             p_rghEqn.solve
00037             (
00038                 mesh.solver
00039                 (
00040                     p_rgh.select
00041                     (
00042                         (
00043                             finalIter
00044                          && corr == nCorr-1
00045                          && nonOrth == nNonOrthCorr
00046                         )
00047                     )
00048                 )
00049             );
00050 
00051             if (nonOrth == nNonOrthCorr)
00052             {
00053                 // Second part of thermodynamic density update
00054                 thermo.rho() += psi*p_rgh;
00055 
00056                 // Calculate the conservative fluxes
00057                 phi += p_rghEqn.flux();
00058 
00059                 // Explicitly relax pressure for momentum corrector
00060                 p_rgh.relax();
00061 
00062                 // Correct the momentum source with the pressure gradient flux
00063                 // calculated from the relaxed pressure
00064                 U += rUA*fvc::reconstruct
00065                 (
00066                     (buoyancyPhi + p_rghEqn.flux())/rhorUAf
00067                 );
00068 
00069                 U.correctBoundaryConditions();
00070             }
00071         }
00072     }
00073 
00074     p = p_rgh + rho*gh;
00075 
00076     DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
00077 
00078     #include <finiteVolume/rhoEqn.H>
00079     #include <finiteVolume/compressibleContinuityErrs.H>
00080 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines