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

correctPhi.H

Go to the documentation of this file.
00001 {
00002     wordList pcorrTypes
00003     (
00004         p.boundaryField().size(),
00005         zeroGradientFvPatchScalarField::typeName
00006     );
00007 
00008     for (label i=0; i<p.boundaryField().size(); i++)
00009     {
00010         if(p.boundaryField()[i].fixesValue())
00011         {
00012             pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
00013         }
00014     }
00015 
00016     volScalarField pcorr
00017     (
00018         IOobject
00019         (
00020             "pcorr",
00021             runTime.timeName(),
00022             mesh,
00023             IOobject::NO_READ,
00024             IOobject::NO_WRITE
00025         ),
00026         mesh,
00027         dimensionedScalar("pcorr", p.dimensions(), 0.0),
00028         pcorrTypes
00029     );
00030 
00031     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00032     {
00033         fvScalarMatrix pcorrEqn
00034         (
00035             fvm::laplacian(rAU, pcorr) == fvc::div(phi)
00036         );
00037 
00038         pcorrEqn.setReference(pRefCell, pRefValue);
00039         pcorrEqn.solve();
00040 
00041         if (nonOrth == nNonOrthCorr)
00042         {
00043             phi -= pcorrEqn.flux();
00044         }
00045     }
00046 }
00047 
00048 #include "continuityErrs.H"
Copyright © 2000-2009 OpenCFD Ltd