pEqn.H
Go to the documentation of this file.
1 if (!mesh.steady() && !pimple.simpleRho())
2 {
3  rho = thermo.rho();
4 }
5 
6 // Thermodynamic density needs to be updated by psi*d(p) after the
7 // pressure solution
8 const volScalarField psip0(psi*p);
9 
10 const volScalarField rAU("rAU", 1.0/UEqn.A());
11 const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
13 
14 if (pimple.nCorrPiso() <= 1)
15 {
16  tUEqn.clear();
17 }
18 
20 (
21  "phiHbyA",
23  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf))
24 );
25 
26 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
27 
28 bool adjustMass = pimple.transonic() ? false : adjustPhi(phiHbyA, U, p_rgh);
29 
30 surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
31 
33 
34 // Update the pressure BCs to ensure flux consistency
35 constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
36 
38 
40 
41 if (pimple.transonic())
42 {
44  (
45  "phid",
47  );
48 
49  phiHbyA -= fvc::interpolate(psi*p_rgh)*phiHbyA/fvc::interpolate(rho);
50 
52  (
54  + fvc::div(phiHbyA) + fvm::div(phid, p_rgh)
55  ==
56  fvOptions(psi, p_rgh, rho.name())
57  );
58 
59  while (pimple.correctNonOrthogonal())
60  {
61  p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh);
62 
63  // Relax the pressure equation to ensure diagonal-dominance
64  p_rghEqn.relax();
65 
66  p_rghEqn.setReference
67  (
68  pressureControl.refCell(),
69  pressureControl.refValue()
70  );
71 
72  p_rghEqn.solve();
73  }
74 }
75 else
76 {
77  if (mesh.steady())
78  {
79  adjustMass = adjustPhi(phiHbyA, U, p_rgh);
80  }
81 
83  (
85  + fvc::div(phiHbyA)
86  ==
87  fvOptions(psi, p_rgh, rho.name())
88  );
89 
90  while (pimple.correctNonOrthogonal())
91  {
92  p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh);
93 
94  p_rghEqn.setReference
95  (
96  pressureControl.refCell(),
97  pressureControl.refValue()
98  );
99 
100  p_rghEqn.solve();
101  }
102 }
103 
104 phi = phiHbyA + p_rghEqn.flux();
105 
106 p = p_rgh + rho*gh + pRef;
107 
108 if (mesh.steady())
109 {
111 }
112 else
113 {
114  const bool limitedp = pressureControl.limit(p);
115 
116  // Thermodynamic density update
117  thermo.correctRho(psi*p - psip0);
118 
119  if (limitedp)
120  {
121  rho = thermo.rho();
122  }
123 
124  #include "rhoEqn.H"
126 }
127 
128 // Explicitly relax pressure for momentum corrector
129 p_rgh.relax();
130 
131 // Correct the momentum source with the pressure gradient flux
132 // calculated from the relaxed pressure
133 U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
134 U.correctBoundaryConditions();
135 fvOptions.correct(U);
136 K = 0.5*magSqr(U);
137 
138 if (mesh.steady())
139 {
140  pressureControl.limit(p);
141 }
142 
143 // For steady closed-volume compressible cases adjust the pressure level
144 // to obey overall mass continuity
145 if (adjustMass && !thermo.incompressible())
146 {
147  p += (initialMass - fvc::domainIntegrate(thermo.rho()))
149  p_rgh = p - rho*gh - pRef;
150  p.correctBoundaryConditions();
151 }
152 
153 if (mesh.steady() || pimple.simpleRho() || adjustMass)
154 {
155  rho = thermo.rho();
156 }
157 
158 if ((mesh.steady() || pimple.simpleRho()) && !pimple.transonic())
159 {
160  rho.relax();
161 }
162 
163 // Correct rhoUf if the mesh is moving
165 
166 if (thermo.dpdt())
167 {
168  dpdt = fvc::ddt(p);
169 
170  if (mesh.moving())
171  {
172  dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
173  }
174 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
rAU
Definition: pEqn.H:1
fvScalarMatrix p_rghDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p_rgh))+fvc::div(phiHbyA)==parcels.Srho()+surfaceFilm.Srho()+fvOptions(psi, p_rgh, rho.name()))
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
fv::options & fvOptions
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
dimensionedScalar initialMass
Definition: createFields.H:69
IOMRFZoneList & MRF
rhoUf
Definition: pEqn.H:94
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
fvScalarMatrix p_rghEqn(p_rgh, dimMass/dimTime)
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:170
p_rgh
Definition: pEqn.H:140
Calculates and prints the continuity errors.
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
rhoReactionThermo & thermo
Definition: createFields.H:28
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:58
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
CGAL::Exact_predicates_exact_constructions_kernel K
phi
Definition: pEqn.H:104
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
volScalarField & dpdt
dynamicFvMesh & mesh
pressureControl & pressureControl
bool adjustMass
Definition: pEqn.H:47
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:34
const volScalarField psip0(psi *p)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const surfaceScalarField & ghf
scalar pRef
Definition: createFields.H:19
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevTau(U)==fvOptions(rho, U))
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
phiHbyA
Definition: pEqn.H:32
adjustPhi(phiHbyA, Urel, p)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
U
Definition: pEqn.H:72
volVectorField & HbyA
Definition: pEqn.H:13
fvVectorMatrix & UEqn
Definition: UEqn.H:11
tmp< surfaceScalarField > meshPhi(const volVectorField &U)
Definition: fvcMeshPhi.C:34
void correctRhoUf(autoPtr< surfaceVectorField > &rhoUf, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi)
Definition: fvcMeshPhi.C:241
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Calculates and prints the continuity errors.
const volScalarField & gh
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
const volScalarField & psi
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition: fvcFlux.C:32
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45