pEqn.H
Go to the documentation of this file.
1 if ((!mesh.steady() && !pimple.simpleRho()) || pimple.consistent())
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));
12 
13 tmp<volScalarField> rAtU
14 (
15  pimple.consistent()
16  ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1()))
17  : tmp<volScalarField>(nullptr)
18 );
19 tmp<surfaceScalarField> rhorAtUf
20 (
21  pimple.consistent()
23  : tmp<surfaceScalarField>(nullptr)
24 );
25 
26 const volScalarField& rAAtU = pimple.consistent() ? rAtU() : rAU;
27 const surfaceScalarField& rhorAAtUf =
28  pimple.consistent() ? rhorAtUf() : rhorAUf;
29 
31 
32 if (pimple.nCorrPiso() <= 1)
33 {
34  tUEqn.clear();
35 }
36 
38 (
39  "phiHbyA",
41  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf))
42 );
43 
45 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
46 
47 bool adjustMass = false;
48 
49 // Update the pressure BCs to ensure flux consistency
50 constrainPressure(p, rho, U, phiHbyA, rhorAAtUf, MRF);
51 
52 if (pimple.transonic())
53 {
55  (
56  "phid",
58  );
59 
60  phiHbyA -= fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho);
61 
62  if (pimple.consistent())
63  {
64  phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf();
65  HbyA += (rAAtU - rAU)*fvc::grad(p);
66  }
67 
68  fvScalarMatrix pDDtEqn
69  (
71  + fvc::div(phiHbyA) + fvm::div(phid, p)
72  ==
73  fvOptions(psi, p, rho.name())
74  );
75 
76  while (pimple.correctNonOrthogonal())
77  {
78  fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p));
79 
80  // Relax the pressure equation to ensure diagonal-dominance
81  pEqn.relax();
82 
83  pEqn.setReference
84  (
85  pressureControl.refCell(),
86  pressureControl.refValue()
87  );
88 
89  pEqn.solve();
90 
91  if (pimple.finalNonOrthogonalIter())
92  {
93  phi = phiHbyA + pEqn.flux();
94  }
95  }
96 }
97 else
98 {
99  if (mesh.steady())
100  {
101  adjustMass = adjustPhi(phiHbyA, U, p);
102  }
103 
104  if (pimple.consistent())
105  {
106  phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf();
107  HbyA += (rAAtU - rAU)*fvc::grad(p);
108  }
109 
110  fvScalarMatrix pDDtEqn
111  (
113  + fvc::div(phiHbyA)
114  ==
115  fvOptions(psi, p, rho.name())
116  );
117 
118  while (pimple.correctNonOrthogonal())
119  {
120  fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p));
121 
122  pEqn.setReference
123  (
124  pressureControl.refCell(),
125  pressureControl.refValue()
126  );
127 
128  pEqn.solve();
129 
130  if (pimple.finalNonOrthogonalIter())
131  {
132  phi = phiHbyA + pEqn.flux();
133  }
134  }
135 }
136 
137 if (mesh.steady())
138 {
140 }
141 else
142 {
143  const bool limitedp = pressureControl.limit(p);
144 
145  // Thermodynamic density update
146  thermo.correctRho(psi*p - psip0);
147 
148  if (limitedp)
149  {
150  rho = thermo.rho();
151  }
152 
153  #include "rhoEqn.H"
155 }
156 
157 // Explicitly relax pressure for momentum corrector
158 p.relax();
159 
160 U = HbyA - rAAtU*fvc::grad(p);
161 U.correctBoundaryConditions();
162 fvOptions.correct(U);
163 K = 0.5*magSqr(U);
164 
165 if (mesh.steady())
166 {
167  pressureControl.limit(p);
168 }
169 
170 // For steady compressible closed-volume cases adjust the pressure level
171 // to obey overall mass continuity
172 if (adjustMass && !thermo.incompressible())
173 {
174  p += (initialMass - fvc::domainIntegrate(thermo.rho()))
176  p.correctBoundaryConditions();
177 }
178 
179 if (mesh.steady() || pimple.simpleRho() || adjustMass)
180 {
181  rho = thermo.rho();
182 }
183 
184 // Correct rhoUf if the mesh is moving
186 
187 if ((mesh.steady() || pimple.simpleRho()) && !pimple.transonic())
188 {
189  rho.relax();
190 }
191 
192 if (thermo.dpdt())
193 {
194  dpdt = fvc::ddt(p);
195 
196  if (mesh.moving())
197  {
198  dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
199  }
200 }
tmp< surfaceScalarField > rhorAtUf(pimple.consistent() ? surfaceScalarField::New("rhoRAtUf", fvc::interpolate(rho *rAtU())) :tmp< surfaceScalarField >(nullptr))
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
rAU
Definition: pEqn.H:1
tmp< volScalarField > rAtU(pimple.consistent() ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1())) :tmp< volScalarField >(nullptr))
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
fv::options & fvOptions
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
dimensionedScalar initialMass
Definition: createFields.H:69
p
Definition: pEqn.H:50
IOMRFZoneList & MRF
rhoUf
Definition: pEqn.H:94
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
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
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
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
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 > &)
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)
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
Calculates and prints the continuity errors.
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
const volScalarField & psi
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