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

pEqn.H

Go to the documentation of this file.
00001 {
00002     volScalarField rAU = 1.0/UEqn.A();
00003     surfaceScalarField rAUf = fvc::interpolate(rAU);
00004 
00005     U = rAU*UEqn.H();
00006     surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf()));
00007 
00008     if (p.needReference())
00009     {
00010         fvc::makeRelative(phiU, U);
00011         adjustPhi(phiU, U, p);
00012         fvc::makeAbsolute(phiU, U);
00013     }
00014 
00015     phi = phiU +
00016     (
00017         fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)*mesh.magSf()
00018       + fvc::interpolate(rho)*(g & mesh.Sf())
00019     )*rAUf;
00020 
00021     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00022     {
00023         fvScalarMatrix pEqn
00024         (
00025             fvm::laplacian(rAUf, p) == fvc::div(phi)
00026         );
00027 
00028         pEqn.setReference(pRefCell, pRefValue);
00029 
00030         if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
00031         {
00032             pEqn.solve(mesh.solver(p.name() + "Final"));
00033         }
00034         else
00035         {
00036             pEqn.solve(mesh.solver(p.name()));
00037         }
00038 
00039         if (nonOrth == nNonOrthCorr)
00040         {
00041             phi -= pEqn.flux();
00042         }
00043     }
00044 
00045     U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
00046     U.correctBoundaryConditions();
00047 
00048     #include "continuityErrs.H"
00049 
00050     // Make the fluxes relative to the mesh motion
00051     fvc::makeRelative(phi, U);
00052 }
Copyright © 2000-2009 OpenCFD Ltd