pEqn.H
Go to the documentation of this file.
1 {
2  bool closedVolume = p_rgh.needReference();
3 
5  bool compressible = (compressibility.value() > SMALL);
6 
7  rho = thermo.rho();
8 
9  // Thermodynamic density needs to be updated by psi*d(p) after the
10  // pressure solution - done in 2 parts. Part 1:
11  thermo.rho() -= psi*p_rgh;
12 
13  volScalarField rAU(1.0/UEqn.A());
15 
16  volVectorField HbyA("HbyA", U);
17  HbyA = rAU*UEqn.H();
18 
20 
22  (
23  "phiHbyA",
24  (
25  (fvc::interpolate(rho*HbyA) & mesh.Sf())
27  )
28  + phig
29  );
30 
31  MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
32 
33  // Update the fixedFluxPressure BCs to ensure flux consistency
35  (
36  p_rgh.boundaryField(),
37  (
38  phiHbyA.boundaryField()
39  - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField())
40  *rho.boundaryField()
41  )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
42  );
43 
44  tmp<fvScalarMatrix> p_rghDDtEqn
45  (
47  );
48 
50  {
51  p_rghDDtEqn =
52  (
54  ==
55  fvOptions(psi, p_rgh, rho.name())
56  );
57  }
58 
59  while (pimple.correctNonOrthogonal())
60  {
61  fvScalarMatrix p_rghEqn
62  (
63  p_rghDDtEqn()
64  + fvc::div(phiHbyA)
66  );
67 
68  p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
69 
70  if (pimple.finalNonOrthogonalIter())
71  {
72  // Calculate the conservative fluxes
73  phi = phiHbyA + p_rghEqn.flux();
74 
75  // Explicitly relax pressure for momentum corrector
76  p_rgh.relax();
77 
78  // Correct the momentum source with the pressure gradient flux
79  // calculated from the relaxed pressure
80  U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
81  U.correctBoundaryConditions();
82  fvOptions.correct(U);
83  K = 0.5*magSqr(U);
84  }
85  }
86 
87  p = p_rgh + rho*gh;
88 
89  // Second part of thermodynamic density update
90  thermo.rho() += psi*p_rgh;
91 
92  if (thermo.dpdt())
93  {
94  dpdt = fvc::ddt(p);
95  }
96 
97  if (compressible)
98  {
99  #include "rhoEqn.H"
100  }
101  #include "compressibleContinuityErrs.H"
102 
104  {
105  if (!compressible)
106  {
108  (
109  "p",
110  p.dimensions(),
112  );
113  }
114  else
115  {
118  rho = thermo.rho();
119  }
120  p_rgh = p - rho*gh;
121  }
122 
123  Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
124  << endl;
125 }
Foam::fvc::reconstruct
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcReconstruct.C:54
pRefCell
const label pRefCell
Definition: setRegionFluidFields.H:27
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
p
p
Definition: pEqn.H:62
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:35
Foam::fvc::domainIntegrate
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcVolumeIntegrate.C:86
phig
surfaceScalarField phig(-rAUf *ghf *fvc::snGrad(rhok) *mesh.magSf())
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
setSnGrad< fixedFluxPressureFvPatchScalarField >
setSnGrad< fixedFluxPressureFvPatchScalarField >(p_rgh.boundaryField(),(phiHbyA.boundaryField() - MRF.relative(mesh.Sf().boundaryField() &U.boundaryField()))/(mesh.magSf().boundaryField() *rAUf.boundaryField()))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
dpdt
volScalarField & dpdt
Definition: setRegionFluidFields.H:12
phi
phi
Definition: pEqn.H:20
U
U
Definition: pEqn.H:46
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:56
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Foam::Info
messageStream Info
Foam::fvc::ddtCorr
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:155
UEqn
tmp< fvVectorMatrix > UEqn(fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
MRF
IOMRFZoneList & MRF
Definition: setRegionFluidFields.H:15
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:34
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
p_rghDDtEqn
tmp< fvScalarMatrix > p_rghDDtEqn(new fvScalarMatrix(p_rgh, dimMass/dimTime))
rho
rho
Definition: pEqn.H:3
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
rAU
volScalarField rAU("rAU", 1.0/UEqn().A())
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::getRefCellValue
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
Definition: findRefCell.C:130
HbyA
HbyA
Definition: pEqn.H:4
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
compressible
bool compressible
Definition: pEqn.H:40
closedVolume
bool closedVolume
Definition: pEqn.H:24
initialMass
dimensionedScalar initialMass
Definition: createFields.H:83
pimple
const dictionary & pimple
Definition: readFluidMultiRegionPIMPLEControls.H:1
phiHbyA
phiHbyA
Definition: pEqn.H:21
Foam::fvc::ddt
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
compressibility
dimensionedScalar compressibility
Definition: pEqn.H:39
pRefValue
const scalar pRefValue
Definition: setRegionFluidFields.H:28
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
p_rgh
volScalarField & p_rgh
Definition: setRegionFluidFields.H:31
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:16
rAUf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))