pEqn.H
Go to the documentation of this file.
1{
2 volScalarField rAU("rAU", 1.0/UEqn.A());
3
4 surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
5 volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
6
7 surfaceScalarField phiHbyA
8 (
9 "phiHbyA",
10 fvc::flux(HbyA)
11 );
12
14 {
15 surfaceScalarField faceMaskOld
16 (
17 localMin<scalar>(mesh).interpolate(cellMask.oldTime())
18 );
19 phiHbyA +=
20 MRF.zeroFilter
21 (
22 fvc::interpolate(rho*rAU)*faceMaskOld*fvc::ddtCorr(U, Uf)
23 );
24 }
25
26 MRF.makeRelative(phiHbyA);
27
28 surfaceScalarField phig
29 (
30 (
31 mixture.surfaceTensionForce()
32 - ghf*fvc::snGrad(rho)
33 )*faceMask*rAUf*mesh.magSf()
34 );
35
37
38 // Update the pressure BCs to ensure flux consistency
40
41 tmp<fvScalarMatrix> p_rghEqnComp1;
42 tmp<fvScalarMatrix> p_rghEqnComp2;
43
44 if (pimple.transonic())
45 {
46 #include "rhofs.H"
47
48 surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
49 surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
50
52 pos(alpha1)
53 *(
54 (
55 fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
56 - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
57 )/rho1
58 - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
59 + (alpha1/rho1)
60 *correction
61 (
62 psi1*fvm::ddt(p_rgh)
63 + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
64 )
65 );
66 p_rghEqnComp1.ref().relax();
67
69 pos(alpha2)
70 *(
71 (
72 fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
73 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
74 )/rho2
75 - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
76 + (alpha2/rho2)
77 *correction
78 (
79 psi2*fvm::ddt(p_rgh)
80 + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
81 )
82 );
83 p_rghEqnComp2.ref().relax();
84 }
85 else
86 {
87 #include "rhofs.H"
88
90 pos(alpha1)
91 *(
92 (
93 fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
94 - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
95 )/rho1
96 - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
97 + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh))
98 );
99
101 pos(alpha2)
102 *(
103 (
104 fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
105 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
106 )/rho2
107 - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
108 + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh))
109 );
110 }
111
112 // Cache p_rgh prior to solve for density update
113 volScalarField p_rgh_0(p_rgh);
114
115 while (pimple.correctNonOrthogonal())
116 {
117 fvScalarMatrix p_rghEqnIncomp
118 (
119 fvc::div(phiHbyA)
120 - fvm::laplacian(rAUf, p_rgh)
121 );
122
123 solve
124 (
125 p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
126 mesh.solver(p_rgh.select(pimple.finalInnerIter()))
127 );
128
129 if (pimple.finalNonOrthogonalIter())
130 {
131 p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
132 p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
133
134 dgdt =
135 (
138 );
139
140 phi = phiHbyA + p_rghEqnIncomp.flux();
141
142 U =
143 cellMask*
144 (
145 HbyA
146 + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf)
147 );
148
149 U.correctBoundaryConditions();
150 fvOptions.correct(U);
151 }
152 }
153
154 {
155 Uf = fvc::interpolate(U);
156 surfaceVectorField n(mesh.Sf()/mesh.magSf());
157 Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
158 }
159
160 // Make the fluxes relative to the mesh motion
161 fvc::makeRelative(phi, U);
162
163 // Zero faces H-I for transport Eq after pEq
164 phi *= faceMask;
165
166 // Update densities from change in p_rgh
167 mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
168 mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
169
171
172 // Correct p_rgh for consistency with p and the updated densities
174 p_rgh.correctBoundaryConditions();
175
176 K = 0.5*magSqr(U);
177}
CGAL::Exact_predicates_exact_constructions_kernel K
label n
Y[inertIndex] max(0.0)
volScalarField & p_rgh
fv::options & fvOptions
surfaceScalarField & phi
const surfaceScalarField & ghf
IOMRFZoneList & MRF
const volScalarField & gh
pimpleControl & pimple
const volScalarField & alpha1
const volScalarField & psi2
volScalarField & rho2
const volScalarField & alpha2
const surfaceScalarField & alphaPhi1
const volScalarField & psi1
const dimensionedScalar & pMin
volScalarField & rho1
const surfaceScalarField & alphaPhi2
U
Definition: pEqn.H:72
volScalarField & p
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
fvVectorMatrix & UEqn
Definition: UEqn.H:13
phiHbyA
Definition: pcEqn.H:73
HbyA
Definition: pcEqn.H:74
surfaceScalarField rho2f(fvc::interpolate(rho2))
surfaceScalarField rho1f(fvc::interpolate(rho1))
surfaceScalarField faceMask(localMin< scalar >(mesh).interpolate(cellMask))
mesh interpolate(rAU)
ddtCorr
Definition: readControls.H:9
dynamicFvMesh & mesh
autoPtr< surfaceVectorField > Uf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
tmp< volScalarField > rAU
Definition: initCorrectPhi.H:1
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:29
volScalarField p_rgh_0(p_rgh)
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:30
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
CEqn solve()
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39