Removed unneeded lib dependency from mdInitialise
[foam-extend-3.2.git] / applications / solvers / multiphase / twoPhaseEulerFoam / pEqn.H
blobade4ce0b3da45091f58262a56d8bec2b4f5a05e7
2     surfaceScalarField alphaf = fvc::interpolate(alpha);
3     surfaceScalarField betaf = scalar(1) - alphaf;
5     volScalarField rUaA = 1.0/UaEqn.A();
6     volScalarField rUbA = 1.0/UbEqn.A();
8     rUaAf = fvc::interpolate(rUaA);
9     surfaceScalarField rUbAf = fvc::interpolate(rUbA);
11     Ua = rUaA*UaEqn.H();
12     Ub = rUbA*UbEqn.H();
14     surfaceScalarField phiDraga =
15         fvc::interpolate(beta/rhoa*K*rUaA)*phib + rUaAf*(g & mesh.Sf());
17     if (g0.value() > 0.0)
18     {
19         phiDraga -= ppMagf*fvc::snGrad(alpha)*mesh.magSf();
20     }
22     if (kineticTheory.on())
23     {
24         phiDraga -= rUaAf*fvc::snGrad(kineticTheory.pa()/rhoa)*mesh.magSf();
25     }
27     surfaceScalarField phiDragb =
28         fvc::interpolate(alpha/rhob*K*rUbA)*phia + rUbAf*(g & mesh.Sf());
30     // Fix for gravity on outlet boundary.
31     forAll(p.boundaryField(), patchi)
32     {
33         if (isA<zeroGradientFvPatchScalarField>(p.boundaryField()[patchi]))
34         {
35             phiDraga.boundaryField()[patchi] = 0.0;
36             phiDragb.boundaryField()[patchi] = 0.0;
37         }
38     }
40     phia = (fvc::interpolate(Ua) & mesh.Sf()) + fvc::ddtPhiCorr(rUaA, Ua, phia)
41          + phiDraga;
43     phib = (fvc::interpolate(Ub) & mesh.Sf()) + fvc::ddtPhiCorr(rUbA, Ub, phib)
44          + phiDragb;
46     phi = alphaf*phia + betaf*phib;
48     surfaceScalarField Dp("(rho*(1|A(U)))", alphaf*rUaAf/rhoa + betaf*rUbAf/rhob);
50     for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
51     {
52         fvScalarMatrix pEqn
53         (
54             fvm::laplacian(Dp, p) == fvc::div(phi)
55         );
57         pEqn.setReference(pRefCell, pRefValue);
58         pEqn.solve();
60         if (nonOrth == nNonOrthCorr)
61         {
62             surfaceScalarField SfGradp = pEqn.flux()/Dp;
64             phia -= rUaAf*SfGradp/rhoa;
65             phib -= rUbAf*SfGradp/rhob;
66             phi = alphaf*phia + betaf*phib;
68             p.relax();
69             SfGradp = pEqn.flux()/Dp;
71             Ua += fvc::reconstruct(phiDraga - rUaAf*SfGradp/rhoa);
72             Ua.correctBoundaryConditions();
74             Ub += fvc::reconstruct(phiDragb - rUbAf*SfGradp/rhob);
75             Ub.correctBoundaryConditions();
77             U = alpha*Ua + beta*Ub;
78         }
79     }
82 #include "continuityErrs.H"