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  tmp<fvScalarMatrix> p_rghDDtEqn
40  (
42  );
43 
44  {
45  if (compressible)
46  {
47  p_rghDDtEqn =
48  (
50  ==
51  fvOptions(psi, p_rgh, rho.name())
52  );
53  }
54 
55  // Thermodynamic density needs to be updated by psi*d(p) after the
56  // pressure solution - done in 2 parts. Part 1:
57  thermo.rho() -= psi*p_rgh;
58 
59  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
60  {
61  fvScalarMatrix p_rghEqn
62  (
64  + fvc::div(phiHbyA)
66  );
67 
68  p_rghEqn.solve
69  (
70  mesh.solver
71  (
72  p_rgh.select
73  (
74  (
75  oCorr == nOuterCorr-1
76  && corr == nCorr-1
77  && nonOrth == nNonOrthCorr
78  )
79  )
80  )
81  );
82 
83  if (nonOrth == nNonOrthCorr)
84  {
85  phi = phiHbyA + p_rghEqn.flux();
86  U = HbyA
87  + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
88  U.correctBoundaryConditions();
89  fvOptions.correct(U);
90  K = 0.5*magSqr(U);
91  }
92  }
93 
94  // Second part of thermodynamic density update
95  thermo.rho() += psi*p_rgh;
96  }
97 
98  p = p_rgh + rho*gh;
99 
100  // Update pressure time derivative if needed
101  if (thermo.dpdt())
102  {
103  dpdt = fvc::ddt(p);
104  }
105 
107  {
108  // Solve continuity
109  #include "rhoEqn.H"
110  }
111 
112  // Update continuity errors
114 
115  // For closed-volume cases adjust the pressure and density levels
116  // to obey overall mass continuity
118  {
121  rho = thermo.rho();
122  p_rgh = p - rho*gh;
123  }
124 }
Foam::fvc::reconstruct
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcReconstruct.C:54
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
p
p
Definition: pEqn.H:62
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:35
Foam::fvc::domainIntegrate
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcVolumeIntegrate.C:86
phig
surfaceScalarField phig(-rAUf *ghf *fvc::snGrad(rhok) *mesh.magSf())
nCorr
const int nCorr
Definition: readFluidMultiRegionPIMPLEControls.H:3
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
setSnGrad< fixedFluxPressureFvPatchScalarField >
setSnGrad< fixedFluxPressureFvPatchScalarField >(p_rgh.boundaryField(),(phiHbyA.boundaryField() - MRF.relative(mesh.Sf().boundaryField() &U.boundaryField()))/(mesh.magSf().boundaryField() *rAUf.boundaryField()))
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
dpdt
volScalarField & dpdt
Definition: setRegionFluidFields.H:12
phi
phi
Definition: pEqn.H:20
A
simpleMatrix< scalar > A(Nc)
U
U
Definition: pEqn.H:46
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:56
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
compressibleContinuityErrors.H
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Foam::fvc::ddtCorr
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
UEqn
tmp< fvVectorMatrix > UEqn(fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
MRF
IOMRFZoneList & MRF
Definition: setRegionFluidFields.H:15
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:34
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
rhorAUf
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
p_rghDDtEqn
tmp< fvScalarMatrix > p_rghDDtEqn(new fvScalarMatrix(p_rgh, dimMass/dimTime))
rho
rho
Definition: pEqn.H:3
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
rAU
volScalarField rAU("rAU", 1.0/UEqn().A())
HbyA
HbyA
Definition: pEqn.H:4
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
nNonOrthCorr
const int nNonOrthCorr
Definition: readFluidMultiRegionSIMPLEControls.H:3
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
nOuterCorr
const int nOuterCorr
Definition: readPIMPLEControls.H:7
compressible
bool compressible
Definition: pEqn.H:40
closedVolume
bool closedVolume
Definition: pEqn.H:24
initialMass
dimensionedScalar initialMass
Definition: createFields.H:83
phiHbyA
phiHbyA
Definition: pEqn.H:21
Foam::fvc::ddt
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
compressibility
dimensionedScalar compressibility
Definition: pEqn.H:39
p_rgh
volScalarField & p_rgh
Definition: setRegionFluidFields.H:31
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:16