pEqn.H
Go to the documentation of this file.
1 bool closedVolume = p_rgh.needReference();
3 bool compressible = (compressibility.value() > SMALL);
4 
5 rho = thermo.rho();
6 
7 // Thermodynamic density needs to be updated by psi*d(p) after the
8 // pressure solution
10 
11 volScalarField rAU("rAU", 1.0/UEqn.A());
14 
16 
18 (
19  "phiHbyA",
20  (
22  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
23  )
24  + phig
25 );
26 
27 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
28 
29 // Update the pressure BCs to ensure flux consistency
31 
32 {
34  (
36  + fvc::div(phiHbyA)
37  );
38 
39  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
40  {
41  fvScalarMatrix p_rghEqn
42  (
45  );
46 
47  p_rghEqn.setReference
48  (
49  pRefCell,
51  );
52 
53  p_rghEqn.solve
54  (
55  mesh.solver
56  (
57  p_rgh.select
58  (
59  (
60  oCorr == nOuterCorr-1
61  && corr == nCorr-1
62  && nonOrth == nNonOrthCorr
63  )
64  )
65  )
66  );
67 
68  if (nonOrth == nNonOrthCorr)
69  {
70  phi = phiHbyA + p_rghEqn.flux();
71 
72  p_rgh.relax();
73 
74  U = HbyA
75  + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
76  U.correctBoundaryConditions();
77  fvOptions.correct(U);
78  K = 0.5*magSqr(U);
79  }
80  }
81 
82  p = p_rgh + rho*gh;
83 
84 }
85 
86 pressureControl.limit(p);
87 
88 // For closed-volume cases adjust the pressure and density levels
89 // to obey overall mass continuity
91 {
92  if (!compressible)
93  {
95  (
96  "p",
97  p.dimensions(),
99  );
100  }
101  else
102  {
105  thermo.correctRho(psi*p - psip0, rhoMin, rhoMax);
106  rho = thermo.rho();
107  p_rgh = p - rho*gh;
108  p_rgh.correctBoundaryConditions();
109  }
110 }
111 else
112 {
113  thermo.correctRho(psi*p - psip0, rhoMin, rhoMax);
114 }
115 
116 #include "rhoEqn.H"
118 
119 rho = thermo.rho();
120 
121 // Update pressure time derivative if needed
122 if (thermo.dpdt())
123 {
124  dpdt = fvc::ddt(p);
125 }
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
psip0
const volScalarField psip0(psi *p)
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
nCorr
const int nCorr
Definition: readFluidMultiRegionPIMPLEControls.H:3
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
Foam::fvc::domainIntegrate
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcVolumeIntegrate.C:88
phiHbyA
phiHbyA
Definition: pEqn.H:20
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
compressibleContinuityErrors.H
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
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
HbyA
HbyA
Definition: pEqn.H:4
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:23
rhorAUf
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
rhoMin
const dimensionedScalar rhoMin
Definition: setRegionFluidFields.H:67
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
ddtCorr
ddtCorr
Definition: readControls.H:9
compressible
bool compressible
Definition: pEqn.H:2
p
p
Definition: pEqn.H:50
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
nOuterCorr
const int nOuterCorr
Definition: readPIMPLEControls.H:7
rAU
volScalarField rAU(1.0/UEqn.A())
nNonOrthCorr
const int nNonOrthCorr
Definition: readFluidMultiRegionSIMPLEControls.H:3
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())
Foam::getRefCellValue
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
Definition: findRefCell.C:134
pressureControl
const pressureControl & pressureControl
Definition: setRegionFluidFields.H:69
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
rhoMax
const dimensionedScalar rhoMax
Definition: setRegionFluidFields.H:66
p_rghDDtEqn
fvScalarMatrix p_rghDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p_rgh))+fvc::div(phiHbyA)==fvOptions(psi, p_rgh, rho.name()))
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
initialMass
dimensionedScalar initialMass
Definition: createFields.H:57
closedVolume
bool closedVolume
Definition: pEqn.H:10
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
dpdt
volScalarField & dpdt
Definition: setRegionFluidFields.H:32
compressibility
dimensionedScalar compressibility
Definition: pEqn.H:1
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
psi
const volScalarField & psi
Definition: createFieldRefs.H:1
rho
rho
Definition: pEqn.H:1
interpolate
mesh interpolate(rAU)
pRefCell
const label pRefCell
Definition: setRegionFluidFields.H:36
constrainPressure
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
pRefValue
const scalar pRefValue
Definition: setRegionFluidFields.H:37