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     volScalarField rUA("rUA", 1.0/UEqn.A());
00003     surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
00004 
00005     U = rUA*UEqn.H();
00006 
00007     phi = (fvc::interpolate(U) & mesh.Sf())
00008         + fvc::ddtPhiCorr(rUA, U, phi);
00009 
00010     surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf();
00011     phi -= buoyancyPhi;
00012 
00013     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00014     {
00015         fvScalarMatrix p_rghEqn
00016         (
00017             fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
00018         );
00019 
00020         p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
00021 
00022         p_rghEqn.solve
00023         (
00024             mesh.solver
00025             (
00026                 p_rgh.select
00027                 (
00028                     (
00029                         finalIter
00030                      && corr == nCorr-1
00031                      && nonOrth == nNonOrthCorr
00032                     )
00033                 )
00034             )
00035         );
00036 
00037         if (nonOrth == nNonOrthCorr)
00038         {
00039             // Calculate the conservative fluxes
00040             phi -= p_rghEqn.flux();
00041 
00042             // Explicitly relax pressure for momentum corrector
00043             p_rgh.relax();
00044 
00045             // Correct the momentum source with the pressure gradient flux
00046             // calculated from the relaxed pressure
00047             U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
00048             U.correctBoundaryConditions();
00049         }
00050     }
00051 
00052     #include <finiteVolume/continuityErrs.H>
00053 
00054     p = p_rgh + rhok*gh;
00055 
00056     if (p_rgh.needReference())
00057     {
00058         p += dimensionedScalar
00059         (
00060             "p",
00061             p.dimensions(),
00062             pRefValue - getRefCellValue(p, pRefCell)
00063         );
00064         p_rgh = p - rhok*gh;
00065     }
00066 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines