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

correctPhi.H

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