pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
3 
6 
8  (
9  "phiHbyA",
11  );
12 
13  MRF.makeRelative(phiHbyA);
14 
16  (
17  (
18  mixture.surfaceTensionForce()
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 
37 
39  pos(alpha1)
40  *(
41  (
43  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
44  )/rho1
46  + (alpha1/rho1)
47  *correction
48  (
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  (
60  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
61  )/rho2
63  + (alpha2/rho2)
64  *correction
65  (
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  (
81  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
82  )/rho1
85  );
86 
88  pos(alpha2)
89  *(
90  (
92  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
93  )/rho2
96  );
97  }
98 
99  // Cache p_rgh prior to solve for density update
101 
102  while (pimple.correctNonOrthogonal())
103  {
104  fvScalarMatrix p_rghEqnIncomp
105  (
108  );
109 
110  solve
111  (
112  p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
113  mesh.solver(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
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
160  p_rgh = p - rho*gh;
161  p_rgh.correctBoundaryConditions();
162 
163  K = 0.5*magSqr(U);
164 }
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:30
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:37
rho
Definition: pEqn.H:1
p
Definition: pEqn.H:50
volScalarField rAU(1.0/UEqn.A())
const dimensionedScalar & pMin
surfaceScalarField rho1f(fvc::interpolate(rho1))
phiHbyA
Definition: pEqn.H:20
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
volScalarField & rho1
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< GeometricField< Type, faPatchField, areaMesh > > div(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facDiv.C:43
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
const volScalarField & alpha2
tmp< GeometricField< Type, faPatchField, areaMesh > > ddt(const dimensioned< Type > dt, const faMesh &mesh)
Definition: facDdt.C:40
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:82
CGAL::Exact_predicates_exact_constructions_kernel K
const surfaceScalarField & alphaPhi2
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:29
fv::options & fvOptions
CEqn solve()
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
dimensionedScalar pos(const dimensionedScalar &ds)
surfaceScalarField rho2f(fvc::interpolate(rho2))
dynamicFvMesh & mesh
const volScalarField & psi2
IOMRFZoneList & MRF
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:40
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:28
HbyA
Definition: pEqn.H:4
faceMask
Definition: setCellMask.H:43
p_rgh
Definition: pEqn.H:139
pimpleControl & pimple
const volScalarField & psi1
volScalarField & rho2
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
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:183
U
Definition: pEqn.H:72
mesh interpolate(rAU)
fvVectorMatrix & UEqn
Definition: UEqn.H:13
const volScalarField & gh
surfaceVectorField n(mesh.Sf()/mesh.magSf())
volScalarField p_rgh_0(p_rgh)
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
phi
Definition: pEqn.H:18
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const surfaceScalarField & alphaPhi1
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:40
Uf
Definition: pEqn.H:64
zeroField Sp
Definition: alphaSuSp.H:2
const volScalarField & alpha1