pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
6  (
7  "phiHbyA",
9  + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi, Uf))
10  );
11  MRF.makeRelative(phiHbyA);
12 
14  (
15  (
16  mixture.surfaceTensionForce()
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
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 
39  p_rghEqnComp1 =
40  (
41  (
43  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
44  )/rho1
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 
54  p_rghEqnComp2 =
55  (
56  (
58  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
59  )/rho2
61  + (alpha2/rho2)
62  *correction
63  (
64  psi2*fvm::ddt(p_rgh)
65  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
66  )
67  );
68  }
69  else
70  {
71  #include "rhofs.H"
72 
73  p_rghEqnComp1 =
74  pos(alpha1)
75  *(
76  (
78  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
79  )/rho1
82  );
83 
84  p_rghEqnComp2 =
85  pos(alpha2)
86  *(
87  (
89  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
90  )/rho2
93  );
94  }
95 
96  if (mesh.moving())
97  {
98  p_rghEqnComp1.ref() += fvc::div(mesh.phi())*alpha1;
99  p_rghEqnComp2.ref() += fvc::div(mesh.phi())*alpha2;
100  }
101 
102  p_rghEqnComp1.ref() *= pos(alpha1);
103  p_rghEqnComp2.ref() *= pos(alpha2);
104 
105  if (pimple.transonic())
106  {
107  p_rghEqnComp1.ref().relax();
108  p_rghEqnComp2.ref().relax();
109  }
110 
111  // Cache p_rgh prior to solve for density update
113 
114  while (pimple.correctNonOrthogonal())
115  {
116  fvScalarMatrix p_rghEqnIncomp
117  (
120  );
121 
122  solve
123  (
124  p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
125  );
126 
127  if (pimple.finalNonOrthogonalIter())
128  {
129  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
130  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
131 
132  dgdt =
133  (
134  alpha1*(p_rghEqnComp2 & p_rgh)
135  - alpha2*(p_rghEqnComp1 & p_rgh)
136  );
137 
138  phi = phiHbyA + p_rghEqnIncomp.flux();
139 
140  U = HbyA
141  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
142  U.correctBoundaryConditions();
143  fvOptions.correct(U);
144  }
145  }
146 
147  // Correct Uf if the mesh is moving
149 
150  // Update densities from change in p_rgh
151  mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
152  mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
153 
155 
156  // Correct p_rgh for consistency with p and the updated densities
157  p_rgh = p - rho*gh;
158  p_rgh.correctBoundaryConditions();
159 
160  K = 0.5*magSqr(U);
161 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
rAU
Definition: pEqn.H:1
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
fv::options & fvOptions
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
p
Definition: pEqn.H:50
IOMRFZoneList & MRF
surfaceScalarField rho1f(fvc::interpolate(rho1))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
volScalarField p_rgh_0(p_rgh)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:170
p_rgh
Definition: pEqn.H:140
const surfaceScalarField & alphaPhi1
rhoEqn solve()
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:58
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
CGAL::Exact_predicates_exact_constructions_kernel K
alpha2
Definition: alphaEqn.H:115
phi
Definition: pEqn.H:104
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dimensionedScalar pos(const dimensionedScalar &ds)
surfaceScalarField rho2f(fvc::interpolate(rho2))
dynamicFvMesh & mesh
volScalarField & alpha1(mixture.alpha1())
void correctUf(autoPtr< surfaceVectorField > &Uf, const volVectorField &U, const surfaceScalarField &phi)
Definition: fvcMeshPhi.C:223
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:34
autoPtr< surfaceVectorField > Uf
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:27
dimensionedScalar pMin("pMin", dimPressure, fluid)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const surfaceScalarField & ghf
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
phiHbyA
Definition: pEqn.H:32
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:188
U
Definition: pEqn.H:72
volVectorField & HbyA
Definition: pEqn.H:13
fvVectorMatrix & UEqn
Definition: UEqn.H:11
surfaceScalarField alphaPhi2("alphaPhi2", phi - alphaPhi1)
const volScalarField & gh
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
const dimensionedScalar & rho2
Definition: createFields.H:44
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition: fvcFlux.C:32
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
phaseChangeTwoPhaseMixture & mixture
Definition: createFields.H:38
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:26
const dimensionedScalar & rho1
Definition: createFields.H:43
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
zeroField Sp
Definition: alphaSuSp.H:2