Loading...
Searching...
No Matches
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
13 MRF.makeRelative(phiHbyA);
14
15 surfaceScalarField phig
16 (
17 (
18 mixture.surfaceTensionForce()
19 - ghf*fvc::snGrad(rho)
20 )*faceMask*rAUf*mesh.magSf()
21 );
22
24
25 // Update the pressure BCs to ensure flux consistency
27
28 tmp<fvScalarMatrix> p_rghEqnComp1;
29 tmp<fvScalarMatrix> p_rghEqnComp2;
30
31 if (pimple.transonic())
32 {
33 #include "rhofs.H"
34
35 surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
36 surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
37
39 pos(alpha1)
40 *(
41 (
42 fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
43 - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
44 )/rho1
45 - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
46 + (alpha1/rho1)
47 *correction
48 (
49 psi1*fvm::ddt(p_rgh)
50 + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
51 )
52 );
53 p_rghEqnComp1.ref().relax();
54
56 pos(alpha2)
57 *(
58 (
59 fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
60 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
61 )/rho2
62 - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
63 + (alpha2/rho2)
64 *correction
65 (
66 psi2*fvm::ddt(p_rgh)
67 + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
68 )
69 );
70 p_rghEqnComp2.ref().relax();
71 }
72 else
73 {
74 #include "rhofs.H"
75
77 pos(alpha1)
78 *(
79 (
80 fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
81 - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
82 )/rho1
83 - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
84 + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh))
85 );
86
88 pos(alpha2)
89 *(
90 (
91 fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
92 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
93 )/rho2
94 - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
95 + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh))
96 );
97 }
98
99 // Cache p_rgh prior to solve for density update
100 volScalarField p_rgh_0(p_rgh);
101
102 while (pimple.correctNonOrthogonal())
103 {
104 fvScalarMatrix p_rghEqnIncomp
105 (
106 fvc::div(phiHbyA)
107 - fvm::laplacian(rAUf, p_rgh)
108 );
109
110 solve
111 (
112 p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
113 p_rgh.select(pimple.finalInnerIter())
114 );
115
116 if (pimple.finalNonOrthogonalIter())
117 {
118 p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
119 p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
120
121 dgdt =
122 (
125 );
126
127 phi = phiHbyA + p_rghEqnIncomp.flux();
128
129 U =
130 cellMask*
131 (
132 HbyA
133 + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf)
134 );
135
136 U.correctBoundaryConditions();
137 fvOptions.correct(U);
138 }
139 }
140
141 {
142 Uf = fvc::interpolate(U);
143 surfaceVectorField n(mesh.Sf()/mesh.magSf());
144 Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
145 }
146
147 // Make the fluxes relative to the mesh motion
148 fvc::makeRelative(phi, U);
149
150 // Zero faces H-I for transport Eq after pEq
151 phi *= faceMask;
152
153 // Update densities from change in p_rgh
154 mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
155 mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
156
158
159 // Correct p_rgh for consistency with p and the updated densities
161 p_rgh.correctBoundaryConditions();
162
163 K = 0.5*magSqr(U);
164}
CGAL::Exact_predicates_exact_constructions_kernel K
label n
volScalarField & p_rgh
fv::options & fvOptions
const surfaceScalarField & ghf
IOMRFZoneList & MRF
const volScalarField & gh
pimpleControl & pimple
const volScalarField & alpha1
const auto & alphaPhi2
const auto & alphaPhi1
const volScalarField & psi2
volScalarField & rho2
const volScalarField & alpha2
const volScalarField & psi1
const dimensionedScalar & pMin
volScalarField & rho1
U
Definition pEqn.H:72
volScalarField & p
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
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 rho1f(fvc::interpolate(rho1))
dynamicFvMesh & mesh
autoPtr< surfaceVectorField > Uf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
tmp< volScalarField > rAU
tmp< fvScalarMatrix > p_rghEqnComp1
Definition pEqn.H:29
volScalarField p_rgh_0(p_rgh)
tmp< fvScalarMatrix > p_rghEqnComp2
Definition pEqn.H:30
surfaceScalarField rho2f(fvc::interpolate(rho2))
GeometricField< scalar, fvPatchField, volMesh > volScalarField
faceMask
Definition setCellMask.H:43
CEqn solve()
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture