pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
4 
5  volVectorField HbyA("HbyA", U);
6  HbyA = rAU*UEqn.H();
7 
9  (
10  "phiHbyA",
11  (fvc::interpolate(HbyA) & mesh.Sf())
13  );
14 
16  (
17  (
18  interface.surfaceTensionForce()
20  )*rAUf*mesh.magSf()
21  );
22 
24 
25  // Update the fixedFluxPressure BCs to ensure flux consistency
27  (
28  p_rgh.boundaryField(),
29  (
30  phiHbyA.boundaryField()
31  - (mesh.Sf().boundaryField() & U.boundaryField())
32  )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
33  );
34 
35  tmp<fvScalarMatrix> p_rghEqnComp1;
36  tmp<fvScalarMatrix> p_rghEqnComp2;
37 
38  if (pimple.transonic())
39  {
41  surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
42 
43  p_rghEqnComp1 =
44  fvc::ddt(rho1) + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1)
45  + correction
46  (
48  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
49  );
50  deleteDemandDrivenData(p_rghEqnComp1().faceFluxCorrectionPtr());
51  p_rghEqnComp1().relax();
52 
53  p_rghEqnComp2 =
54  fvc::ddt(rho2) + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2)
55  + correction
56  (
58  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
59  );
60  deleteDemandDrivenData(p_rghEqnComp2().faceFluxCorrectionPtr());
61  p_rghEqnComp2().relax();
62  }
63  else
64  {
65  p_rghEqnComp1 =
68 
69  p_rghEqnComp2 =
71  + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2);
72  }
73 
74  // Cache p_rgh prior to solve for density update
76 
77  while (pimple.correctNonOrthogonal())
78  {
79  fvScalarMatrix p_rghEqnIncomp
80  (
83  );
84 
85  solve
86  (
87  (
88  (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
89  + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
90  )
91  + p_rghEqnIncomp,
92  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
93  );
94 
95  if (pimple.finalNonOrthogonalIter())
96  {
97  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
98  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
99 
100  dgdt =
101  (
102  pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
103  - pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
104  );
105 
106  phi = phiHbyA + p_rghEqnIncomp.flux();
107 
108  U = HbyA
109  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
110  U.correctBoundaryConditions();
111  }
112  }
113 
114  // p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
115 
116  // Update densities from change in p_rgh
118  rho2 += psi2*(p_rgh - p_rgh_0);
119 
121 
122  K = 0.5*magSqr(U);
123 
124  Info<< "max(U) " << max(mag(U)).value() << endl;
125  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
126 }
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:39
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
phi
Definition: pEqn.H:20
dimensioned< scalar > mag(const dimensioned< Type > &)
CGAL::Exact_predicates_exact_constructions_kernel K
setSnGrad< fixedFluxPressureFvPatchScalarField >(p_rgh.boundaryField(),( phiHbyA.boundaryField() -MRF.relative(mesh.Sf().boundaryField()&U.boundaryField()) *rho.boundaryField() )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()))
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
dimensioned< scalar > magSqr(const dimensioned< Type > &)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
void deleteDemandDrivenData(DataPtr &dataPtr)
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:155
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
psi2
Definition: TEqns.H:35
volScalarField & p_rgh
messageStream Info
tmp< surfaceScalarField > interpolate(const RhoType &rho)
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
dynamicFvMesh & mesh
surfaceScalarField phig(-rhorAUf *ghf *fvc::snGrad(rho)*mesh.magSf())
const dictionary & pimple
p
Definition: pEqn.H:59
rhoEqn solve()
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvVectorMatrix UEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:38
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
rho1
Definition: pEqn.H:124
volScalarField p_rgh_0(p_rgh)
phiHbyA
Definition: pEqn.H:21
rho2
Definition: pEqn.H:125
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
volScalarField & alpha1
Definition: createFields.H:15
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
alpha2
Definition: alphaEqn.H:112
volScalarField rAU(1.0/UEqn.A())
psi1
Definition: TEqns.H:34
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
dimensionedScalar pos(const dimensionedScalar &ds)
rho
Definition: pEqn.H:1
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
interfaceProperties interface(alpha1, U, mixture())
dimensionedScalar pMin("pMin", dimPressure, fluid)
U
Definition: pEqn.H:82
const surfaceScalarField & ghf
HbyA
Definition: pEqn.H:7
const volScalarField & gh