ENH: Time: access to libs
[OpenFOAM-2.0.x.git] / applications / solvers / multiphase / cavitatingFoam / pEqn.H
blobc604539cde376de10bb7d52c5a4efbd1658813fc
2     if (pimple.nOuterCorr() == 1)
3     {
4         p =
5         (
6             rho
7           - (1.0 - gamma)*rhol0
8           - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
9         )/psi;
10     }
12     surfaceScalarField rhof(fvc::interpolate(rho, "rhof"));
14     volScalarField rAU(1.0/UEqn.A());
15     surfaceScalarField rAUf("rAUf", rhof*fvc::interpolate(rAU));
16     volVectorField HbyA(rAU*UEqn.H());
18     phiv = (fvc::interpolate(HbyA) & mesh.Sf())
19          + fvc::ddtPhiCorr(rAU, rho, U, phiv);
21     p.boundaryField().updateCoeffs();
23     surfaceScalarField phiGradp(rAUf*mesh.magSf()*fvc::snGrad(p));
25     phiv -= phiGradp/rhof;
27     #include "resetPhivPatches.H"
29     for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
30     {
31         fvScalarMatrix pEqn
32         (
33             fvm::ddt(psi, p)
34           - (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
35           + fvc::div(phiv, rho)
36           + fvc::div(phiGradp)
37           - fvm::laplacian(rAUf, p)
38         );
40         pEqn.solve
41         (
42             mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
43         );
45         if (nonOrth == pimple.nNonOrthCorr())
46         {
47             phiv += (phiGradp + pEqn.flux())/rhof;
48         }
49     }
51     Info<< "Predicted p max-min : " << max(p).value()
52         << " " << min(p).value() << endl;
54     rho == max
55     (
56         psi*p
57       + (1.0 - gamma)*rhol0
58       + ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
59         rhoMin
60     );
62     #include "gammaPsi.H"
64     p =
65     (
66         rho
67       - (1.0 - gamma)*rhol0
68       - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
69     )/psi;
71     p.correctBoundaryConditions();
73     Info<< "Phase-change corrected p max-min : " << max(p).value()
74         << " " << min(p).value() << endl;
76     // Correct velocity
78     U = HbyA - rAU*fvc::grad(p);
80     // Remove the swirl component of velocity for "wedge" cases
81     if (pimple.dict().found("removeSwirl"))
82     {
83         label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl")));
85         Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
86         U.field().replace(swirlCmpt, 0.0);
87     }
89     U.correctBoundaryConditions();
91     Info<< "max(U) " << max(mag(U)).value() << endl;