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     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<< "Predicted p max-min : " << max(p).value()
00056         << " " << min(p).value() << endl;
00057 
00058     rho == max
00059     (
00060         psi*p
00061       + (1.0 - gamma)*rhol0
00062       + ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
00063         rhoMin
00064     );
00065 
00066     #include "gammaPsi.H"
00067 
00068     p =
00069     (
00070         rho
00071       - (1.0 - gamma)*rhol0
00072       - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
00073     )/psi;
00074 
00075     p.correctBoundaryConditions();
00076 
00077     Info<< "Phase-change corrected p max-min : " << max(p).value()
00078         << " " << min(p).value() << endl;
00079 
00080     // Correct velocity
00081 
00082     U = HbyA - rUA*fvc::grad(p);
00083 
00084     // Remove the swirl component of velocity for "wedge" cases
00085     if (piso.found("removeSwirl"))
00086     {
00087         label swirlCmpt(readLabel(piso.lookup("removeSwirl")));
00088 
00089         Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
00090         U.field().replace(swirlCmpt, 0.0);
00091     }
00092 
00093     U.correctBoundaryConditions();
00094 
00095     Info<< "max(U) " << max(mag(U)).value() << endl;
00096 }
00097 
00098 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines