FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

correctPhi.H

Go to the documentation of this file.
00001 {
00002     if (mesh.changing())
00003     {
00004         forAll(U.boundaryField(), patchi)
00005         {
00006             if (U.boundaryField()[patchi].fixesValue())
00007             {
00008                 U.boundaryField()[patchi].initEvaluate();
00009             }
00010         }
00011 
00012         forAll(U.boundaryField(), patchi)
00013         {
00014             if (U.boundaryField()[patchi].fixesValue())
00015             {
00016                 U.boundaryField()[patchi].evaluate();
00017 
00018                 phi.boundaryField()[patchi] =
00019                 U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
00020             }
00021         }
00022     }
00023 
00024     wordList pcorrTypes
00025     (
00026         p.boundaryField().size(),
00027         zeroGradientFvPatchScalarField::typeName
00028     );
00029 
00030     for (label i=0; i<p.boundaryField().size(); i++)
00031     {
00032         if(p.boundaryField()[i].fixesValue())
00033         {
00034             pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
00035         }
00036     }
00037 
00038     volScalarField pcorr
00039     (
00040         IOobject
00041         (
00042             "pcorr",
00043             runTime.timeName(),
00044             mesh,
00045             IOobject::NO_READ,
00046             IOobject::NO_WRITE
00047         ),
00048         mesh,
00049         dimensionedScalar("pcorr", p.dimensions(), 0.0),
00050         pcorrTypes
00051     );
00052 
00053     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00054     {
00055         fvScalarMatrix pcorrEqn
00056         (
00057             fvm::laplacian(rAU, pcorr) == fvc::div(phi)
00058         );
00059 
00060         pcorrEqn.setReference(pRefCell, pRefValue);
00061         pcorrEqn.solve();
00062 
00063         if (nonOrth == nNonOrthCorr)
00064         {
00065             phi -= pcorrEqn.flux();
00066         }
00067     }
00068 }
00069 
00070 #include <finiteVolume/continuityErrs.H>
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines