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  // Make the fluxes relative to the mesh motion
37 
38  tmp<fvScalarMatrix> p_rghEqnComp1;
39  tmp<fvScalarMatrix> p_rghEqnComp2;
40 
41  if (pimple.transonic())
42  {
44  surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
45 
46  p_rghEqnComp1 =
47  fvc::ddt(rho1) + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1)
48  + correction
49  (
51  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
52  );
53  deleteDemandDrivenData(p_rghEqnComp1().faceFluxCorrectionPtr());
54  p_rghEqnComp1().relax();
55 
56  p_rghEqnComp2 =
57  fvc::ddt(rho2) + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2)
58  + correction
59  (
61  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
62  );
63  deleteDemandDrivenData(p_rghEqnComp2().faceFluxCorrectionPtr());
64  p_rghEqnComp2().relax();
65  }
66  else
67  {
68  p_rghEqnComp1 =
71 
72  p_rghEqnComp2 =
74  + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2);
75  }
76 
77  // Cache p_rgh prior to solve for density update
79 
80  while (pimple.correctNonOrthogonal())
81  {
82  fvScalarMatrix p_rghEqnIncomp
83  (
86  );
87 
88  solve
89  (
90  (
91  (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
92  + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
93  )
94  + p_rghEqnIncomp,
95  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
96  );
97 
98  if (pimple.finalNonOrthogonalIter())
99  {
100  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
101  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
102 
103  dgdt =
104  (
105  pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
106  - pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
107  );
108 
109  phi = phiHbyA + p_rghEqnIncomp.flux();
110 
111  U = HbyA
112  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
113  U.correctBoundaryConditions();
114  }
115  }
116 
117  {
118  Uf = fvc::interpolate(U);
119  surfaceVectorField n(mesh.Sf()/mesh.magSf());
120  Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
121  }
122 
123  // Update densities from change in p_rgh
125  rho2 += psi2*(p_rgh - p_rgh_0);
126 
128 
129  K = 0.5*magSqr(U);
130 
131  Info<< "max(U) " << max(mag(U)).value() << endl;
132  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
133 }
Uf
Definition: pEqn.H:78
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
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:187
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
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
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())
surfaceVectorField n(mesh.Sf()/mesh.magSf())
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
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
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