pEqn.H
Go to the documentation of this file.
1 rho = thermo.rho();
2 rho.relax();
3 
4 // Thermodynamic density needs to be updated by psi*d(p) after the
5 // pressure solution
7 
8 const volScalarField rAU("rAU", 1.0/UEqn.A());
11 
12 if (pimple.nCorrPiso() <= 1)
13 {
14  tUEqn.clear();
15 }
16 
18 (
19  "phiHbyA",
21  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf))
22 );
23 
24 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
25 
26 bool adjustMass = mesh.schemes().steady() && adjustPhi(phiHbyA, U, p_rgh);
27 
29 
31 
32 // Update the pressure BCs to ensure flux consistency
34 
36 
38 
39 if (pimple.transonic())
40 {
41  const surfaceScalarField phid
42  (
43  "phid",
45  );
46 
47  const fvScalarMatrix divPhidp(fvm::div(phid, p));
48  phiHbyA -= divPhidp.flux();
49 
50  fvScalarMatrix p_rghDDtEqn
51  (
53  + fvc::div(phiHbyA) + divPhidp
54  ==
55  fvModels.source(psi, p_rgh, rho.name())
56  );
57 
58  while (pimple.correctNonOrthogonal())
59  {
60  p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh);
61 
62  // Relax the pressure equation to ensure diagonal-dominance
63  p_rghEqn.relax();
64 
65  p_rghEqn.setReference
66  (
67  pressureReference.refCell(),
68  pressureReference.refValue()
69  );
70 
71  p_rghEqn.solve();
72  }
73 }
74 else
75 {
76  fvScalarMatrix p_rghDDtEqn
77  (
79  + fvc::div(phiHbyA)
80  ==
81  fvModels.source(psi, p_rgh, rho.name())
82  );
83 
84  while (pimple.correctNonOrthogonal())
85  {
86  p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh);
87 
88  p_rghEqn.setReference
89  (
90  pressureReference.refCell(),
91  pressureReference.refValue()
92  );
93 
94  p_rghEqn.solve();
95  }
96 }
97 
98 phi = phiHbyA + p_rghEqn.flux();
99 
100 if (mesh.schemes().steady())
101 {
103 }
104 else
105 {
106  p = p_rgh + rho*gh + pRef;
107 
108  const bool constrained = fvConstraints.constrain(p);
109 
110  // Thermodynamic density update
111  thermo.correctRho(psi*p - psip0);
112 
113  if (constrained)
114  {
115  rho = thermo.rho();
116  }
117 
118  #include "rhoEqn.H"
120 }
121 
122 // Explicitly relax pressure for momentum corrector
123 p_rgh.relax();
124 
125 p = p_rgh + rho*gh + pRef;
126 
127 // Correct the momentum source with the pressure gradient flux
128 // calculated from the relaxed pressure
130 U.correctBoundaryConditions();
132 K = 0.5*magSqr(U);
133 
134 if (mesh.schemes().steady())
135 {
137  {
138  p_rgh = p - rho*gh - pRef;
139  p_rgh.correctBoundaryConditions();
140  }
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 {
149  p_rgh = p - rho*gh - pRef;
150  p_rgh.correctBoundaryConditions();
151 }
152 
153 if (mesh.schemes().steady() || pimple.simpleRho() || adjustMass)
154 {
155  rho = thermo.rho();
156 }
157 
158 if (mesh.schemes().steady() || pimple.simpleRho())
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
pressureReference & pressureReference
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
fluidReactionThermo & thermo
Definition: createFields.H:28
pimpleNoLoopControl & pimple
dimensionedScalar initialMass
Definition: createFields.H:68
p_rgh
Definition: pEqn.H:160
U
Definition: pEqn.H:72
mixture MRF().makeRelative(phiHbyA)
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
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
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
Calculates and prints the continuity errors.
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:59
fvMesh & mesh
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
p
Definition: pEqn.H:125
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:58
volScalarField & dpdt
const dimensionSet dimTime
phiHbyA
Definition: pEqn.H:30
Foam::fvConstraints & fvConstraints
bool adjustMass
Definition: pEqn.H:49
const volScalarField & psi
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:6
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevTau(U)==fvModels.source(rho, U))
const dimensionSet dimMass
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.
bool constrain(fvMatrix< Type > &eqn) const
Apply constraints to an equation.
fvScalarMatrix p_rghEqn(p_rgh, dimMass/dimTime)
Foam::fvModels & fvModels
phi
Definition: pEqn.H:98
adjustPhi(phiHbyA, Urel, p)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
void correctRhoUf(autoPtr< surfaceVectorField > &rhoUf, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const MRFType &MRF)
volVectorField & HbyA
Definition: pEqn.H:13
const surfaceScalarField phig(-rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< surfaceScalarField > meshPhi(const volVectorField &U)
Definition: fvcMeshPhi.C:34
Calculates and prints the continuity errors.
const volScalarField & gh
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
autoPtr< surfaceVectorField > rhoUf
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF)
rho
Definition: pEqn.H:1
fvVectorMatrix & UEqn
Definition: UEqn.H:13