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 rUA = 1.0/UEqn.A();
00003     surfaceScalarField rUAf = fvc::interpolate(rUA);
00004 
00005     U = rUA*UEqn.H();
00006 
00007     surfaceScalarField phiU
00008     (
00009         "phiU",
00010         (fvc::interpolate(U) & mesh.Sf())
00011       + fvc::ddtPhiCorr(rUA, rho, U, phi)
00012     );
00013 
00014     phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rUAf;
00015 
00016     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00017     {
00018         fvScalarMatrix pEqn
00019         (
00020             fvm::laplacian(rUAf, p) == fvc::div(phi)
00021         );
00022 
00023         pEqn.setReference(pRefCell, pRefValue);
00024 
00025         if
00026         (
00027             corr == nCorr-1
00028          && nonOrth == nNonOrthCorr
00029         )
00030         {
00031             pEqn.solve(mesh.solver(p.name() + "Final"));
00032         }
00033         else
00034         {
00035             pEqn.solve(mesh.solver(p.name()));
00036         }
00037 
00038         if (nonOrth == nNonOrthCorr)
00039         {
00040             phi -= pEqn.flux();
00041         }
00042     }
00043 
00044     U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
00045     U.correctBoundaryConditions();
00046 }
Copyright © 2000-2009 OpenCFD Ltd