pEqn.H
Go to the documentation of this file.
1 if (!pimple.SIMPLErho())
2 {
3  rho = thermo.rho();
4 }
5 // Thermodynamic density needs to be updated by psi*d(p) after the
6 // pressure solution
8 
9 volScalarField rAU("rAU", 1.0/UEqn.A());
10 mesh.interpolate(rAU);
11 
13 volVectorField HbyA("HbyA", U);
14 
16 
17 if (pimple.nCorrPISO() <= 1)
18 {
19  tUEqn.clear();
20 }
21 
23 (
24  "phiHbyA",
26 );
27 
28 if (ddtCorr)
29 {
30  surfaceScalarField faceMaskOld
31  (
32  localMin<scalar>(mesh).interpolate(cellMask.oldTime())
33  );
34 
35  phiHbyA +=
36  faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf));
37 }
38 
40 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
41 
42 // Update the pressure BCs to ensure flux consistency
44 
45 if (pimple.transonic())
46 {
48  (
49  "phid",
51  );
52 
54 
56  (
59  ==
60  fvOptions(psi, p, rho.name())
61  );
62 
63  while (pimple.correctNonOrthogonal())
64  {
66 
67  // Relax the pressure equation to ensure diagonal-dominance
68  pEqn.relax();
69 
70  pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
71 
72  if (pimple.finalNonOrthogonalIter())
73  {
74  phi = phiHbyA + pEqn.flux();
75  }
76  }
77 }
78 else
79 {
81  (
83  + fvc::div(phiHbyA)
84  ==
85  fvOptions(psi, p, rho.name())
86  );
87 
88  while (pimple.correctNonOrthogonal())
89  {
91 
92  pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
93 
94  if (pimple.finalNonOrthogonalIter())
95  {
96  phi = phiHbyA + pEqn.flux();
97  }
98  }
99 }
100 
101 #include "rhoEqn.H"
103 
104 // Explicitly relax pressure for momentum corrector
105 p.relax();
106 
108 //mesh.interpolate(gradP);
109 U = cellMask*(HbyA - rAU*gradP);
110 U.correctBoundaryConditions();
111 fvOptions.correct(U);
112 K = 0.5*magSqr(U);
113 
114 if (pressureControl.limit(p))
115 {
116  p.correctBoundaryConditions();
117 }
118 
119 thermo.correctRho(psi*p - psip0, rhoMin, rhoMax) ;
120 rho = thermo.rho();
121 
122 {
123  // Correct rhoUf if the mesh is moving
125 }
126 
127 if (thermo.dpdt())
128 {
129  dpdt = fvc::ddt(p);
130 
131  if (mesh.moving())
132  {
133  dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
134  }
135 }
136 
138 (
139  localMin<scalar>(mesh).interpolate(cellMask)
140 );
141 phi *= faceMask;
rhoUf
rhoUf
Definition: pEqn.H:89
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)
phid
surfaceScalarField phid("phid", fvc::interpolate(psi) *(fvc::flux(HbyA)+MRF.zeroFilter(rhorAUf *fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho))))
gradP
volVectorField gradP(fvc::grad(p))
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
phiHbyA
phiHbyA
Definition: pEqn.H:20
faceMask
surfaceScalarField faceMask(localMin< scalar >(mesh).interpolate(cellMask))
Foam::fac::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::fvc::meshPhi
tmp< surfaceScalarField > meshPhi(const volVectorField &U)
Definition: fvcMeshPhi.C:36
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
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
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
HbyA
HbyA
Definition: pEqn.H:4
tUEqn
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
compressibleContinuityErrs.H
Calculates and prints the continuity errors.
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::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
makeRelative
MRF makeRelative(fvc::interpolate(rho), phiHbyA)
ddtCorr
ddtCorr
Definition: readControls.H:9
p
p
Definition: pEqn.H:50
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
rAU
volScalarField rAU(1.0/UEqn.A())
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
U
U
Definition: pEqn.H:72
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
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
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
dpdt
volScalarField & dpdt
Definition: setRegionFluidFields.H:32
Foam::fac::laplacian
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:47
Foam::fvc::correctRhoUf
void correctRhoUf(autoPtr< surfaceVectorField > &rhoUf, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi)
Definition: fvcMeshPhi.C:243
psi
const volScalarField & psi
Definition: createFieldRefs.H:1
rho
rho
Definition: pEqn.H:1
pDDtEqn
fvScalarMatrix pDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p))+fvc::div(phiHbyA)==fvOptions(psi, p, rho.name()))
interpolate
mesh interpolate(rAU)
constrainPressure
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)