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

pEqn.H

Go to the documentation of this file.
00001 {
00002     rho = thermo.rho();
00003 
00004     // Thermodynamic density needs to be updated by psi*d(p) after the
00005     // pressure solution - done in 2 parts. Part 1:
00006     thermo.rho() -= psi*p;
00007 
00008     volScalarField rUA = 1.0/UEqn.A();
00009     U = rUA*UEqn.H();
00010 
00011     if (transonic)
00012     {
00013         surfaceScalarField phiv =
00014             (fvc::interpolate(U) & mesh.Sf())
00015           + fvc::ddtPhiCorr(rUA, rho, U, phi);
00016 
00017         phi = fvc::interpolate(rho)*phiv;
00018 
00019         surfaceScalarField phid
00020         (
00021             "phid",
00022             fvc::interpolate(thermo.psi())*phiv
00023         );
00024 
00025         for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00026         {
00027             fvScalarMatrix pEqn
00028             (
00029                 fvc::ddt(rho) + fvc::div(phi)
00030               + correction(fvm::ddt(psi, p) + fvm::div(phid, p))
00031               - fvm::laplacian(rho*rUA, p)
00032             );
00033 
00034             if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
00035             {
00036                 pEqn.solve(mesh.solver(p.name() + "Final"));
00037             }
00038             else
00039             {
00040                 pEqn.solve();
00041             }
00042 
00043             if (nonOrth == nNonOrthCorr)
00044             {
00045                 phi += pEqn.flux();
00046             }
00047         }
00048     }
00049     else
00050     {
00051         phi =
00052             fvc::interpolate(rho)
00053            *(
00054                 (fvc::interpolate(U) & mesh.Sf())
00055               + fvc::ddtPhiCorr(rUA, rho, U, phi)
00056             );
00057 
00058         for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00059         {
00060             fvScalarMatrix pEqn
00061             (
00062                 fvc::ddt(rho) + psi*correction(fvm::ddt(p))
00063               + fvc::div(phi)
00064               - fvm::laplacian(rho*rUA, p)
00065             );
00066 
00067             if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
00068             {
00069                 pEqn.solve(mesh.solver(p.name() + "Final"));
00070             }
00071             else
00072             {
00073                 pEqn.solve();
00074             }
00075 
00076             if (nonOrth == nNonOrthCorr)
00077             {
00078                 phi += pEqn.flux();
00079             }
00080         }
00081     }
00082 
00083     // Second part of thermodynamic density update
00084     thermo.rho() += psi*p;
00085 
00086     #include "rhoEqn.H"
00087     #include "compressibleContinuityErrs.H"
00088 
00089     U -= rUA*fvc::grad(p);
00090     U.correctBoundaryConditions();
00091 
00092     DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
00093 }
Copyright © 2000-2009 OpenCFD Ltd