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))
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  tmp<fvScalarMatrix> p_rghEqnComp1;
27  tmp<fvScalarMatrix> p_rghEqnComp2;
28 
29  if (pimple.transonic())
30  {
31  #include "rhofs.H"
32 
35 
37  pos(alpha1)
38  *(
39  (
41  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
42  )/rho1
44  + (alpha1/rho1)
45  *correction
46  (
48  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
49  )
50  );
51  p_rghEqnComp1.ref().relax();
52 
54  pos(alpha2)
55  *(
56  (
58  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
59  )/rho2
61  + (alpha2/rho2)
62  *correction
63  (
65  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
66  )
67  );
68  p_rghEqnComp2.ref().relax();
69  }
70  else
71  {
72  #include "rhofs.H"
73 
75  pos(alpha1)
76  *(
77  (
79  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
80  )/rho1
83  );
84 
86  pos(alpha2)
87  *(
88  (
90  - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
91  )/rho2
94  );
95  }
96 
97  // Cache p_rgh prior to solve for density update
99 
100  while (pimple.correctNonOrthogonal())
101  {
102  fvScalarMatrix p_rghEqnIncomp
103  (
106  );
107 
108  solve
109  (
110  p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
111  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
112  );
113 
114  if (pimple.finalNonOrthogonalIter())
115  {
116  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
117  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
118 
119  dgdt =
120  (
123  );
124 
125  phi = phiHbyA + p_rghEqnIncomp.flux();
126 
127  U = HbyA
128  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
129  U.correctBoundaryConditions();
130  fvOptions.correct(U);
131  }
132  }
133 
134  // Update densities from change in p_rgh
135  mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
136  mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
137 
139 
140  // Correct p_rgh for consistency with p and the updated densities
141  p_rgh = p - rho*gh;
142  p_rgh.correctBoundaryConditions();
143 
144  K = 0.5*magSqr(U);
145 }
Foam::fvc::reconstruct
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcReconstruct.C:56
Foam::constrainHbyA
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:35
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:18
pMin
const dimensionedScalar & pMin
Definition: setRegionFluidFields.H:58
alpha2
const volScalarField & alpha2
Definition: setRegionFluidFields.H:9
p_rghEqnComp1
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:29
phiHbyA
phiHbyA
Definition: pEqn.H:20
Sp
zeroField Sp
Definition: alphaSuSp.H:2
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:17
Foam::fac::div
tmp< GeometricField< Type, faPatchField, areaMesh > > div(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facDiv.C:50
psi2
const volScalarField & psi2
Definition: setRegionFluidFields.H:31
rho2f
surfaceScalarField rho2f(fvc::interpolate(rho2))
solve
CEqn solve()
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
MRF
IOMRFZoneList & MRF
Definition: setRegionFluidFields.H:22
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
HbyA
HbyA
Definition: pEqn.H:4
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:23
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
ddtCorr
ddtCorr
Definition: readControls.H:9
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
p
p
Definition: pEqn.H:50
rho1f
surfaceScalarField rho1f(fvc::interpolate(rho1))
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
alphaPhi1
const surfaceScalarField & alphaPhi1
Definition: setRegionFluidFields.H:13
psi1
const volScalarField & psi1
Definition: setRegionFluidFields.H:28
rAU
volScalarField rAU(1.0/UEqn.A())
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
rhofs.H
U
U
Definition: pEqn.H:72
phig
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
p_rgh_0
volScalarField p_rgh_0(p_rgh)
p_rghEqnComp2
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:30
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::fac::ddt
tmp< GeometricField< Type, faPatchField, areaMesh > > ddt(const dimensioned< Type > dt, const faMesh &mesh)
Definition: facDdt.C:47
phi
phi
Definition: pEqn.H:18
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
p_rgh
p_rgh
Definition: pEqn.H:139
Foam::fac::laplacian
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:47
rho
rho
Definition: pEqn.H:1
mixture
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
interpolate
mesh interpolate(rAU)
alphaPhi2
const surfaceScalarField & alphaPhi2
Definition: setRegionFluidFields.H:17
constrainPressure
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
rAUf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177