pEqn.H
Go to the documentation of this file.
1 if (!mesh.steady() && !pimple.simpleRho())
2 {
3  rho = thermo.rho();
4 }
5 
6 volScalarField rAU("rAU", 1.0/UEqn.A());
9 if (pimple.nCorrPISO() <= 1)
10 {
11  tUEqn.clear();
12 }
13 
14 surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
15 
17 (
18  "phiHbyA",
19  fvc::flux(rho*HbyA)
20  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
21 );
22 
23 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
24 
25 const bool closedVolume = adjustPhi(phiHbyA, U, p_rgh);
26 const bool adjustMass = closedVolume && !thermo.incompressible();
27 
29 
30 // Update the pressure BCs to ensure flux consistency
31 constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
32 
33 {
34  fvScalarMatrix p_rghEqnComp
35  (
37  );
38 
39  if (pimple.transonic())
40  {
42  (
43  "phid",
45  );
46 
47  phiHbyA -= fvc::interpolate(psi*p_rgh)*phiHbyA/fvc::interpolate(rho);
48 
49  p_rghEqnComp += fvm::div(phid, p_rgh);
50  }
51 
52  // Thermodynamic density needs to be updated by psi*d(p) after the
53  // pressure solution
54  tmp<volScalarField> psip0(mesh.steady() ? tmp<volScalarField>() : psi*p);
55 
56  while (pimple.correctNonOrthogonal())
57  {
58  fvScalarMatrix p_rghEqnIncomp
59  (
61  - fvm::laplacian(rhorAUf, p_rgh)
62  );
63 
64  fvScalarMatrix p_rghEqn(p_rghEqnComp + p_rghEqnIncomp);
65 
66  p_rghEqn.setReference
67  (
68  pressureControl.refCell(),
69  pressureControl.refValue()
70  );
71 
72  p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
73 
74  if (pimple.finalNonOrthogonalIter())
75  {
76  // Calculate the conservative fluxes
77  phi = phiHbyA + p_rghEqn.flux();
78 
79  // Explicitly relax pressure for momentum corrector
80  p_rgh.relax();
81 
82  // Correct the momentum source with the pressure gradient flux
83  // calculated from the relaxed pressure
84  U = HbyA
85  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rhorAUf);
86  U.correctBoundaryConditions();
87  fvOptions.correct(U);
88  K = 0.5*magSqr(U);
89  }
90  }
91 
92  p = p_rgh + rho*gh;
93 
94  // Thermodynamic density update
95  if (!mesh.steady())
96  {
97  thermo.correctRho(psi*p - psip0);
98  }
99 }
100 
101 // Update pressure time derivative if needed
102 if (thermo.dpdt())
103 {
104  dpdt = fvc::ddt(p);
105 }
106 
107 // Solve continuity
108 if (!mesh.steady())
109 {
110  #include "rhoEqn.H"
111  #include "compressibleContinuityErrs.H"
112 }
113 else
114 {
116 }
117 
118 // Pressure limiting
119 const bool pLimited = pressureControl.limit(p);
120 
121 // For closed-volume compressible cases adjust the pressure level
122 // to obey overall mass continuity
123 if (adjustMass)
124 {
125  p += (initialMass - fvc::domainIntegrate(thermo.rho()))
127  p_rgh = p - rho*gh;
128 }
129 
130 if (adjustMass || pLimited)
131 {
132  p.correctBoundaryConditions();
133 }
134 
135 // Density updates
136 if (adjustMass || pLimited || mesh.steady() || pimple.simpleRho())
137 {
138  rho = thermo.rho();
139 }
140 
141 if (mesh.steady() && !pimple.transonic())
142 {
143  rho.relax();
144 }
145 
146 Info<< "Min/max rho:" << min(rho).value() << ' '
147  << max(rho).value() << endl;
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
fv::options & fvOptions
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
dimensionedScalar initialMass
Definition: createFields.H:57
volScalarField rAU(1.0/UEqn.A())
IOMRFZoneList & MRF
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
phiHbyA
Definition: pEqn.H:20
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
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:55
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
surfaceScalarField phid("phid", fvc::interpolate(psi) *(fvc::flux(HbyA)+MRF.zeroFilter(rhorAUf *fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho))))
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:52
volScalarField & dpdt
dynamicFvMesh & mesh
pressureControl & pressureControl
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:33
p_rgh
Definition: pEqn.H:152
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const surfaceScalarField & ghf
adjustPhi(phiHbyA, U, p_rgh)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
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.
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:13
const volScalarField & gh
messageStream Info
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
phi
Definition: pEqn.H:18
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))
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
const volScalarField psip0(psi *p)