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 rAU = 1.0/UEqn.A();
00009     U = rAU*UEqn.H();
00010 
00011     if (pZones.size() > 0)
00012     {
00013         // ddtPhiCorr not well defined for cases with porosity
00014         phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
00015     }
00016     else
00017     {
00018         phi =
00019             fvc::interpolate(rho)
00020            *(
00021                 (fvc::interpolate(U) & mesh.Sf())
00022               + fvc::ddtPhiCorr(rAU, rho, U, phi)
00023             );
00024     }
00025 
00026     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00027     {
00028         fvScalarMatrix pEqn
00029         (
00030             fvc::ddt(rho) + psi*correction(fvm::ddt(p))
00031           + fvc::div(phi)
00032           - fvm::laplacian(rho*rAU, p)
00033         ==
00034             parcels.Srho()
00035           + pointMassSources.Su()
00036         );
00037 
00038         if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
00039         {
00040             pEqn.solve(mesh.solver("pFinal"));
00041         }
00042         else
00043         {
00044             pEqn.solve();
00045         }
00046 
00047         if (nonOrth == nNonOrthCorr)
00048         {
00049             phi += pEqn.flux();
00050         }
00051     }
00052 
00053     // Second part of thermodynamic density update
00054     thermo.rho() += psi*p;
00055 
00056     #include "rhoEqn.H"
00057     #include "compressibleContinuityErrs.H"
00058 
00059     U -= rAU*fvc::grad(p);
00060     U.correctBoundaryConditions();
00061 }
Copyright © 2000-2009 OpenCFD Ltd