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

pEqn.H

Go to the documentation of this file.
00001 {
00002     if (nOuterCorr == 1)
00003     {
00004         p =
00005         (
00006             rho
00007           - (1.0 - gamma)*rhol0
00008           - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
00009         )/psi;
00010     }
00011 
00012     surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
00013 
00014     volScalarField rUA = 1.0/UEqn.A();
00015     surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
00016     volVectorField HbyA = rUA*UEqn.H();
00017 
00018     phiv = (fvc::interpolate(HbyA) & mesh.Sf())
00019          + fvc::ddtPhiCorr(rUA, rho, U, phiv);
00020 
00021     p.boundaryField().updateCoeffs();
00022 
00023     surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
00024 
00025     phiv -= phiGradp/rhof;
00026 
00027     #include "resetPhivPatches.H"
00028 
00029     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00030     {
00031         fvScalarMatrix pEqn
00032         (
00033             fvm::ddt(psi, p)
00034           - (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
00035           + fvc::div(phiv, rho)
00036           + fvc::div(phiGradp)
00037           - fvm::laplacian(rUAf, p)
00038         );
00039 
00040         if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
00041         {
00042             pEqn.solve(mesh.solver(p.name() + "Final"));
00043         }
00044         else
00045         {
00046             pEqn.solve(mesh.solver(p.name()));
00047         }
00048 
00049         if (nonOrth == nNonOrthCorr)
00050         {
00051             phiv += (phiGradp + pEqn.flux())/rhof;
00052         }
00053     }
00054 
00055     Info<< "max-min p: " << max(p).value()
00056         << " " << min(p).value() << endl;
00057 
00058 
00059     U = HbyA - rUA*fvc::grad(p);
00060 
00061     // Remove the swirl component of velocity for "wedge" cases
00062     if (piso.found("removeSwirl"))
00063     {
00064         label swirlCmpt(readLabel(piso.lookup("removeSwirl")));
00065 
00066         Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
00067         U.field().replace(swirlCmpt, 0.0);
00068     }
00069 
00070     U.correctBoundaryConditions();
00071 
00072     Info<< "max(U) " << max(mag(U)).value() << endl;
00073 
00074     rho == max
00075     (
00076         psi*p
00077       + (1.0 - gamma)*rhol0
00078       + ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
00079         rhoMin
00080     );
00081 
00082     Info<< "max-min rho: " << max(rho).value()
00083         << " " << min(rho).value() << endl;
00084 
00085     #include "gammaPsi.H"
00086 }
Copyright © 2000-2009 OpenCFD Ltd