pEqn.H
Go to the documentation of this file.
1 {
2  bool closedVolume = p_rgh.needReference();
4  bool compressible = (compressibility.value() > SMALL);
5 
6  rho = thermo.rho();
7 
8  volScalarField rAU("rAU", 1.0/UEqn().A());
10 
11  volVectorField HbyA("HbyA", U);
12  HbyA = rAU*UEqn().H();
13 
15 
17  (
18  "phiHbyA",
19  (
20  (fvc::interpolate(rho*HbyA) & mesh.Sf())
22  )
23  + phig
24  );
25 
26  MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
27 
28  // Update the fixedFluxPressure BCs to ensure flux consistency
30  (
31  p_rgh.boundaryField(),
32  (
33  phiHbyA.boundaryField()
34  - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField())
35  *rho.boundaryField()
36  )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
37  );
38 
39  {
41  (
43  + fvc::div(phiHbyA)
44  );
45 
46  // Thermodynamic density needs to be updated by psi*d(p) after the
47  // pressure solution - done in 2 parts. Part 1:
48  thermo.rho() -= psi*p_rgh;
49 
50  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
51  {
52  fvScalarMatrix p_rghEqn
53  (
55  - fvm::laplacian(rhorAUf, p_rgh)
56  );
57 
58  p_rghEqn.solve
59  (
60  mesh.solver
61  (
62  p_rgh.select
63  (
64  (
65  oCorr == nOuterCorr-1
66  && corr == nCorr-1
67  && nonOrth == nNonOrthCorr
68  )
69  )
70  )
71  );
72 
73  if (nonOrth == nNonOrthCorr)
74  {
75  phi = phiHbyA + p_rghEqn.flux();
76  U = HbyA
77  + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
78  U.correctBoundaryConditions();
79  fvOptions.correct(U);
80  K = 0.5*magSqr(U);
81  }
82  }
83 
84  // Second part of thermodynamic density update
85  thermo.rho() += psi*p_rgh;
86  }
87 
88  p = p_rgh + rho*gh;
89 
90  // Update pressure time derivative if needed
91  if (thermo.dpdt())
92  {
93  dpdt = fvc::ddt(p);
94  }
95 
96  // Solve continuity
97  #include "rhoEqn.H"
98 
99  // Update continuity errors
101 
102  // For closed-volume cases adjust the pressure and density levels
103  // to obey overall mass continuity
104  if (closedVolume && compressible)
105  {
108  rho = thermo.rho();
109  p_rgh = p - rho*gh;
110  }
111 }
volScalarField & dpdt
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
phi
Definition: pEqn.H:20
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()))
dimensioned< scalar > magSqr(const dimensioned< Type > &)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensionedScalar compressibility
Definition: pEqn.H:39
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
const int nOuterCorr
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
volScalarField & p_rgh
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())
p
Definition: pEqn.H:59
const int nNonOrthCorr
fv::IOoptionList & fvOptions
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
IOMRFZoneList & MRF
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
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
const volScalarField & psi
Definition: createFields.H:24
phiHbyA
Definition: pEqn.H:21
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
fvScalarMatrix p_rghDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p_rgh))+fvc::div(phiHbyA)==fvOptions(psi, p_rgh, rho.name()))
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
volScalarField rAU(1.0/UEqn.A())
dimensionedScalar initialMass
Definition: createFields.H:83
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
rho
Definition: pEqn.H:1
psiReactionThermo & thermo
Definition: createFields.H:32
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
U
Definition: pEqn.H:82
const surfaceScalarField & ghf
HbyA
Definition: pEqn.H:7
const volScalarField & gh