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, 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 
37  surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
38 
39  p_rghEqnComp1 =
40  pos(alpha1)
41  *(
42  (
44  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
45  )/rho1
47  + (alpha1/rho1)
48  *correction
49  (
51  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
52  )
53  );
54  p_rghEqnComp1.ref().relax();
55 
56  p_rghEqnComp2 =
57  pos(alpha2)
58  *(
59  (
61  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
62  )/rho2
64  + (alpha2/rho2)
65  *correction
66  (
68  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
69  )
70  );
71  p_rghEqnComp2.ref().relax();
72  }
73  else
74  {
75  #include "rhofs.H"
76 
77  p_rghEqnComp1 =
78  pos(alpha1)
79  *(
80  (
82  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
83  )/rho1
85  + fvc::div(mesh.phi())*alpha1
87  );
88 
89  p_rghEqnComp2 =
90  pos(alpha2)
91  *(
92  (
94  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
95  )/rho2
97  + fvc::div(mesh.phi())*alpha2
99  );
100  }
101 
102  // Cache p_rgh prior to solve for density update
104 
105  while (pimple.correctNonOrthogonal())
106  {
107  fvScalarMatrix p_rghEqnIncomp
108  (
111  );
112 
113  solve
114  (
115  p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
116  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
117  );
118 
119  if (pimple.finalNonOrthogonalIter())
120  {
121  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
122  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
123 
124  dgdt =
125  (
126  alpha1*(p_rghEqnComp2 & p_rgh)
127  - alpha2*(p_rghEqnComp1 & p_rgh)
128  );
129 
130  phi = phiHbyA + p_rghEqnIncomp.flux();
131 
132  U = HbyA
133  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
134  U.correctBoundaryConditions();
135  fvOptions.correct(U);
136  }
137  }
138 
139  {
140  Uf = fvc::interpolate(U);
141  surfaceVectorField n(mesh.Sf()/mesh.magSf());
142  Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
143  }
144 
145  // Update densities from change in p_rgh
146  mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
147  mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
148 
150 
151  // Correct p_rgh for consistency with p and the updated densities
152  p_rgh = p - rho*gh;
153  p_rgh.correctBoundaryConditions();
154 
155  K = 0.5*magSqr(U);
156 }
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:30
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
psi2
Definition: TEqns.H:35
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Uf
Definition: pEqn.H:142
const surfaceScalarField & alphaPhi2
fv::options & fvOptions
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
p
Definition: pEqn.H:50
volScalarField rAU(1.0/UEqn.A())
IOMRFZoneList & MRF
surfaceScalarField rho1f(fvc::interpolate(rho1))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
phiHbyA
Definition: pEqn.H:20
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
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
const surfaceScalarField & alphaPhi1
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
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
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:29
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:52
dimensionedScalar pos(const dimensionedScalar &ds)
surfaceScalarField rho2f(fvc::interpolate(rho2))
dynamicFvMesh & mesh
const volScalarField & alpha1
rhoEqn solve()
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:33
alpha2
Definition: alphaEqn.H:115
p_rgh
Definition: pEqn.H:152
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const surfaceScalarField & ghf
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
dimensionedScalar pMin("pMin", dimPressure, fluid)
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.
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
psi1
Definition: TEqns.H:34
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:13
volScalarField p_rgh_0(p_rgh)
const volScalarField & gh
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
const dimensionedScalar & rho2
Definition: createFields.H:40
phi
Definition: pEqn.H:18
surfaceVectorField n(mesh.Sf()/mesh.magSf())
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
const dimensionedScalar & rho1
Definition: createFields.H:39
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