Clean up
[ShipHydroSIG.git] / src / navalFoamVariant2 / correctPhi.H
blobafd57ef83a26c0154ad4fe24bd6923b3dcb1daa4
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     // Flux predictor: evaluate velocity on moving boundary and assemble new
30     // fluxes.  Correct the fluxes to achieve zero divergence.
31     // HJ, experimental 21/Mar/2011
32     U.correctBoundaryConditions();
34     phi = fvc::interpolate(U) & mesh.Sf();
36     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
37     {
38         fvScalarMatrix pcorrEqn
39         (
40             fvm::laplacian(rAU/rho, pcorr) == fvc::div(phi)
41         );
43         pcorrEqn.setReference(pRefCell, pRefValue);
44         pcorrEqn.solve(mesh.solver(pd.name()));
46         if (nonOrth == nNonOrthCorr)
47         {
48             phi -= pcorrEqn.flux();
49         }
51         // Fluxes are corrected to absolute velocity and further corrected
52         // later.  HJ, 6/Feb/2009
53     }
55 #   include "continuityErrs.H"