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 
38 
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  (
57  (
59  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
60  )/rho2
62  + (alpha2/rho2)
63  *correction
64  (
66  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
67  )
68  );
69  p_rghEqnComp2.ref().relax();
70  }
71  else
72  {
73  #include "rhofs.H"
74 
76  pos(alpha1)
77  *(
78  (
80  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
81  )/rho1
84  );
85 
87  pos(alpha2)
88  *(
89  (
91  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
92  )/rho2
95  );
96  }
97 
98  if (mesh.moving())
99  {
100  p_rghEqnComp1.ref() += fvc::div(mesh.phi())*alpha1;
101  p_rghEqnComp2.ref() += fvc::div(mesh.phi())*alpha2;
102  }
103 
104  p_rghEqnComp1.ref() *= pos(alpha1);
105  p_rghEqnComp2.ref() *= pos(alpha2);
106 
107  if (pimple.transonic())
108  {
109  p_rghEqnComp1.ref().relax();
110  p_rghEqnComp2.ref().relax();
111  }
112 
113  // Cache p_rgh prior to solve for density update
115 
116  while (pimple.correctNonOrthogonal())
117  {
118  fvScalarMatrix p_rghEqnIncomp
119  (
122  );
123 
124  solve
125  (
126  p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
127  p_rgh.select(pimple.finalInnerIter())
128  );
129 
130  if (pimple.finalNonOrthogonalIter())
131  {
132  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
133  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
134 
135  dgdt =
136  (
139  );
140 
141  phi = phiHbyA + p_rghEqnIncomp.flux();
142 
143  U = HbyA
144  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
145  U.correctBoundaryConditions();
146  fvOptions.correct(U);
147  }
148  }
149 
150  // Correct Uf if the mesh is moving
151  {
152  Uf = fvc::interpolate(U);
153  surfaceVectorField n(mesh.Sf()/mesh.magSf());
154  Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
155  }
156 
157 
158  // Update densities from change in p_rgh
159  mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
160  mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
161 
163 
164  // Correct p_rgh for consistency with p and the updated densities
165  p_rgh = p - rho*gh;
166  p_rgh.correctBoundaryConditions();
167 
168  K = 0.5*magSqr(U);
169 }
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< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:165
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:76
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:72
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
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