pEqn.H
Go to the documentation of this file.
1{
2 volScalarField rAU("rAU", 1.0/UEqn.A());
3 surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
4 volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
5 surfaceScalarField phiHbyA
6 (
7 "phiHbyA",
8 fvc::flux(HbyA)
9 + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf))
10 );
11 MRF.makeRelative(phiHbyA);
12
13 surfaceScalarField phig
14 (
15 (
16 mixture.surfaceTensionForce()
17 - ghf*fvc::snGrad(rho)
18 )*rAUf*mesh.magSf()
19 );
20
22
23 // Update the pressure BCs to ensure flux consistency
25
26 // Make the fluxes relative to the mesh motion
27 fvc::makeRelative(phiHbyA, U);
28
29 tmp<fvScalarMatrix> p_rghEqnComp1;
30 tmp<fvScalarMatrix> p_rghEqnComp2;
31
32 if (pimple.transonic())
33 {
34 #include "rhofs.H"
35
36 surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
37 surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
38
40 pos(alpha1)
41 *(
42 (
43 fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
44 - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
45 )/rho1
46 - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
47 + (alpha1/rho1)
48 *correction
49 (
50 psi1*fvm::ddt(p_rgh)
51 + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
52 )
53 );
54 p_rghEqnComp1.ref().relax();
55
57 pos(alpha2)
58 *(
59 (
60 fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
61 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
62 )/rho2
63 - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
64 + (alpha2/rho2)
65 *correction
66 (
67 psi2*fvm::ddt(p_rgh)
68 + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
69 )
70 );
71 p_rghEqnComp2.ref().relax();
72 }
73 else
74 {
76 fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh))
77 + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1);
78
80 fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh))
81 + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2);
82 }
83
84 // Cache p_rgh prior to solve for density update
85 volScalarField p_rgh_0(p_rgh);
86
87 while (pimple.correctNonOrthogonal())
88 {
89 fvScalarMatrix p_rghEqnIncomp
90 (
91 fvc::div(phiHbyA)
92 - fvm::laplacian(rAUf, p_rgh)
93 );
94
95 solve
96 (
97 (
98 (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
99 + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
100 )
101 + p_rghEqnIncomp,
102 mesh.solver(p_rgh.select(pimple.finalInnerIter()))
103 );
104
105 if (pimple.finalNonOrthogonalIter())
106 {
107 p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
108 p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
109
110 dgdt =
111 (
113 - pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
114 );
115
116 phi = phiHbyA + p_rghEqnIncomp.flux();
117
118 U = HbyA
119 + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
120 U.correctBoundaryConditions();
121 fvOptions.correct(U);
122 }
123 }
124
125 {
126 Uf = fvc::interpolate(U);
127 surfaceVectorField n(mesh.Sf()/mesh.magSf());
128 Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
129 }
130
131 // Update densities from change in p_rgh
132 mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
133 mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
134
136
137 // Correct p_rgh for consistency with p and the updated densities
140 p_rgh.correctBoundaryConditions();
141
142
143
144 K = 0.5*magSqr(U);
145}
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))
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