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     bool closedVolume = p_rgh.needReference();
00003     dimensionedScalar compressibility = fvc::domainIntegrate(psi);
00004     bool compressible = (compressibility.value() > SMALL);
00005 
00006     rho = thermo.rho();
00007 
00008     volScalarField rUA = 1.0/UEqn().A();
00009     surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
00010 
00011     U = rUA*UEqn().H();
00012 
00013     surfaceScalarField phiU
00014     (
00015         fvc::interpolate(rho)
00016        *(
00017             (fvc::interpolate(U) & mesh.Sf())
00018           + fvc::ddtPhiCorr(rUA, rho, U, phi)
00019         )
00020     );
00021 
00022     phi = phiU - rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
00023 
00024     {
00025         fvScalarMatrix p_rghDDtEqn
00026         (
00027             fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
00028           + fvc::div(phi)
00029         );
00030 
00031         // Thermodynamic density needs to be updated by psi*d(p) after the
00032         // pressure solution - done in 2 parts. Part 1:
00033         thermo.rho() -= psi*p_rgh;
00034 
00035         for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00036         {
00037             fvScalarMatrix p_rghEqn
00038             (
00039                 p_rghDDtEqn
00040               - fvm::laplacian(rhorUAf, p_rgh)
00041             );
00042 
00043             p_rghEqn.solve
00044             (
00045                 mesh.solver
00046                 (
00047                     p_rgh.select
00048                     (
00049                         (
00050                            oCorr == nOuterCorr-1
00051                         && corr == nCorr-1
00052                         && nonOrth == nNonOrthCorr
00053                         )
00054                     )
00055                 )
00056             );
00057 
00058             if (nonOrth == nNonOrthCorr)
00059             {
00060                 phi += p_rghEqn.flux();
00061             }
00062         }
00063 
00064         // Second part of thermodynamic density update
00065         thermo.rho() += psi*p_rgh;
00066     }
00067 
00068     // Correct velocity field
00069     U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
00070     U.correctBoundaryConditions();
00071 
00072     p = p_rgh + rho*gh;
00073 
00074     // Update pressure substantive derivative
00075     DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
00076 
00077     // Solve continuity
00078     #include <finiteVolume/rhoEqn.H>
00079 
00080     // Update continuity errors
00081     #include "compressibleContinuityErrors.H"
00082 
00083     // For closed-volume cases adjust the pressure and density levels
00084     // to obey overall mass continuity
00085     if (closedVolume && compressible)
00086     {
00087         p += (initialMass - fvc::domainIntegrate(thermo.rho()))
00088             /compressibility;
00089         rho = thermo.rho();
00090         p_rgh = p - rho*gh;
00091     }
00092 
00093     // Update thermal conductivity
00094     K = thermoFluid[i].Cp()*turb.alphaEff();
00095 }
00096 
00097 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines