OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

pEqn.H

Go to the documentation of this file.
00001 {
00002     bool closedVolume = p.needReference();
00003 
00004     rho = thermo.rho();
00005 
00006     volScalarField rUA = 1.0/UEqn().A();
00007     surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
00008 
00009     U = rUA*UEqn().H();
00010 
00011     surfaceScalarField phiU
00012     (
00013         fvc::interpolate(rho)
00014        *(
00015             (fvc::interpolate(U) & mesh.Sf())
00016           + fvc::ddtPhiCorr(rUA, rho, U, phi)
00017         )
00018     );
00019 
00020     phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rhorUAf;
00021 
00022     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00023     {
00024         fvScalarMatrix pEqn
00025         (
00026             fvm::ddt(psi, p)
00027           + fvc::div(phi)
00028           - fvm::laplacian(rhorUAf, p)
00029         );
00030 
00031         if
00032         (
00033             oCorr == nOuterCorr-1
00034          && corr == nCorr-1
00035          && nonOrth == nNonOrthCorr
00036         )
00037         {
00038             pEqn.solve(mesh.solver(p.name() + "Final"));
00039         }
00040         else
00041         {
00042             pEqn.solve(mesh.solver(p.name()));
00043         }
00044 
00045         if (nonOrth == nNonOrthCorr)
00046         {
00047             phi += pEqn.flux();
00048         }
00049     }
00050 
00051     // Correct velocity field
00052     U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
00053     U.correctBoundaryConditions();
00054 
00055     // Update pressure substantive derivative
00056     DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
00057 
00058     // Solve continuity
00059     #include "rhoEqn.H"
00060 
00061     // Update continuity errors
00062     #include "compressibleContinuityErrors.H"
00063 
00064     // For closed-volume cases adjust the pressure and density levels
00065     // to obey overall mass continuity
00066     if (closedVolume)
00067     {
00068         p += (massIni - fvc::domainIntegrate(psi*p))
00069             /fvc::domainIntegrate(psi);
00070         rho = thermo.rho();
00071     }
00072 
00073     // Update thermal conductivity
00074     K = thermoFluid[i].Cp()*turb.alphaEff();
00075 }
Copyright © 2000-2009 OpenCFD Ltd