Initial commit of NavalHydro package from Wikki to the ShipHydroSIG
[ShipHydroSIG.git] / src / navalFoam / correctPhi.H
blob5983e669a382f85773c590ab86cd48b4ba38868d
2 #   include "continuityErrs.H"
4     wordList pcorrTypes(pd.boundaryField().types());
6     for (label i=0; i < pd.boundaryField().size(); i++)
7     {
8         if (pd.boundaryField()[i].fixesValue())
9         {
10             pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
11         }
12     }
14     volScalarField pcorr
15     (
16         IOobject
17         (
18             "pcorr",
19             runTime.timeName(),
20             mesh,
21             IOobject::NO_READ,
22             IOobject::NO_WRITE
23         ),
24         mesh,
25         dimensionedScalar("pcorr", pd.dimensions(), 0.0),
26         pcorrTypes
27     );
29     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
30     {
31         fvScalarMatrix pcorrEqn
32         (
33             fvm::laplacian(rAU, pcorr) == fvc::div(phi)
34         );
36         pcorrEqn.setReference(pRefCell, pRefValue);
37         pcorrEqn.solve(mesh.solver(pd.name()));
39         if (nonOrth == nNonOrthCorr)
40         {
41             phi -= pcorrEqn.flux();
42         }
44         // Fluxes are corrected to absolute velocity and further corrected
45         // later.  HJ, 6/Feb/2009
46     }
48 #   include "continuityErrs.H"