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  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 
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  {
78 
82  }
83 
84  // Cache p_rgh prior to solve for density update
86 
87  while (pimple.correctNonOrthogonal())
88  {
89  fvScalarMatrix p_rghEqnIncomp
90  (
93  );
94 
95  solve
96  (
97  (
98  (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
99  + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
100  )
101  + p_rghEqnIncomp,
102  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
103  );
104 
105  if (pimple.finalNonOrthogonalIter())
106  {
107  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
108  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
109 
110  dgdt =
111  (
114  );
115 
116  phi = phiHbyA + p_rghEqnIncomp.flux();
117 
118  U = HbyA
119  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
120  U.correctBoundaryConditions();
121  fvOptions.correct(U);
122  }
123  }
124 
125  {
126  Uf = fvc::interpolate(U);
127  surfaceVectorField n(mesh.Sf()/mesh.magSf());
128  Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
129  }
130 
131  // Update densities from change in p_rgh
132  mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
133  mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
134 
136 
137  // Correct p_rgh for consistency with p and the updated densities
138  p = max(p_rgh + rho*gh, pMin);
139  p_rgh = p - rho*gh;
140  p_rgh.correctBoundaryConditions();
141 
142 
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
makeRelative
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
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
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
Uf
Uf
Definition: pEqn.H:107
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
Foam::surfaceVectorField
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Definition: surfaceFieldsFwd.H:59
rho
rho
Definition: pEqn.H:1
mixture
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
Foam::fvc::absolute
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:190
interpolate
mesh interpolate(rAU)
n
surfaceVectorField n(mesh.Sf()/mesh.magSf())
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