pEqn.H
Go to the documentation of this file.
2 bool compressible = (compressibility.value() > SMALL);
3 
4 rho = thermo.rho();
5 
6 // Thermodynamic density needs to be updated by psi*d(p) after the
7 // pressure solution
9 
10 volScalarField rAU(1.0/UEqn.A());
11 mesh.interpolate(rAU);
12 
15 
17 
19 (
20  "phiHbyA",
22 );
23 
24 if (ddtCorr)
25 {
26  surfaceScalarField faceMaskOld
27  (
28  localMin<scalar>(mesh).interpolate(cellMask.oldTime())
29  );
30 
31  phiHbyA +=
32  faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi));
33 }
34 
35 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
36 
37 // Update the pressure BCs to ensure flux consistency
39 
41 (
43  + fvc::div(phiHbyA)
44  ==
45  fvOptions(psi, p_rgh, rho.name())
46 );
47 
48 while (pimple.correctNonOrthogonal())
49 {
50  fvScalarMatrix p_rghEqn
51  (
54  );
55 
56  p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
57 
58  if (pimple.finalNonOrthogonalIter())
59  {
60  // Calculate the conservative fluxes
61  phi = phiHbyA + p_rghEqn.flux();
62 
63  // Explicitly relax pressure for momentum corrector
64  p_rgh.relax();
65 
66  // Correct the momentum source with the pressure gradient flux
67  // calculated from the relaxed pressure
68  U =
69  cellMask*
70  (
71  HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf)
72  );
73  U.correctBoundaryConditions();
74  fvOptions.correct(U);
75  K = 0.5*magSqr(U);
76  }
77 }
78 
79 p = p_rgh + rho*gh;
80 
81 #include "rhoEqn.H"
82 #include "compressibleContinuityErrs.H"
83 
84 if (p_rgh.needReference())
85 {
86  if (!compressible)
87  {
89  (
90  "p",
91  p.dimensions(),
93  );
94  }
95  else
96  {
99  thermo.correctRho(psi*p - psip0);
100  rho = thermo.rho();
101  p_rgh = p - rho*gh;
102  }
103 }
104 else
105 {
106  thermo.correctRho(psi*p - psip0);
107 }
108 
109 rho = thermo.rho();
110 
111 {
113 }
114 
115 if (thermo.dpdt())
116 {
117  dpdt = fvc::ddt(p);
118 
119  if (mesh.moving())
120  {
121  dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
122  }
123 }
124 
126 (
127  localMin<scalar>(mesh).interpolate(cellMask)
128 );
129 phi *= faceMask;
rhoUf
rhoUf
Definition: pEqn.H:89
Foam::fvc::reconstruct
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcReconstruct.C:56
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)
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:18
Foam::fvc::domainIntegrate
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcVolumeIntegrate.C:88
phiHbyA
phiHbyA
Definition: pEqn.H:20
faceMask
surfaceScalarField faceMask(localMin< scalar >(mesh).interpolate(cellMask))
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 > &)
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:17
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
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:23
rhorAUf
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
ddtCorr
ddtCorr
Definition: readControls.H:9
compressible
bool compressible
Definition: pEqn.H:2
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
phig
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
Foam::getRefCellValue
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
Definition: findRefCell.C:134
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
p_rghDDtEqn
fvScalarMatrix p_rghDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p_rgh))+fvc::div(phiHbyA)==fvOptions(psi, p_rgh, rho.name()))
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
initialMass
dimensionedScalar initialMass
Definition: createFields.H:57
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
dpdt
volScalarField & dpdt
Definition: setRegionFluidFields.H:32
compressibility
dimensionedScalar compressibility
Definition: pEqn.H:1
p_rgh
p_rgh
Definition: pEqn.H:139
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
interpolate
mesh interpolate(rAU)
pRefCell
const label pRefCell
Definition: setRegionFluidFields.H:36
constrainPressure
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
pRefValue
const scalar pRefValue
Definition: setRegionFluidFields.H:37