phrghEqn.H
Go to the documentation of this file.
1 if (pimple.dict().getOrDefault("hydrostaticInitialization", false))
2 {
3  volScalarField& ph_rgh = regIOobject::store
4  (
6  (
7  IOobject
8  (
9  "ph_rgh",
10  "0",
11  mesh,
12  IOobject::MUST_READ,
13  IOobject::NO_WRITE,
14  IOobject::REGISTER
15  ),
16  mesh
17  )
18  );
19 
20  if (equal(runTime.value(), 0))
21  {
22  p = ph_rgh + rho*gh + pRef;
23  thermo.correct();
24  rho = thermo.rho();
25 
26  label nCorr
27  (
28  pimple.dict().getOrDefault<label>("nHydrostaticCorrectors", 5)
29  );
30 
31  for (label i=0; i<nCorr; i++)
32  {
34 
36  (
37  "phig",
38  -rhof*ghf*fvc::snGrad(rho)*mesh.magSf()
39  );
40 
41  // Update the pressure BCs to ensure flux consistency
42  constrainPressure(ph_rgh, rho, U, phig, rhof);
43 
44  fvScalarMatrix ph_rghEqn
45  (
46  fvm::laplacian(rhof, ph_rgh) == fvc::div(phig)
47  );
48 
49  ph_rghEqn.solve();
50 
51  p = ph_rgh + rho*gh + pRef;
52  thermo.correct();
53  rho = thermo.rho();
54 
55  Info<< "Hydrostatic pressure variation "
56  << (max(ph_rgh) - min(ph_rgh)).value() << endl;
57  }
58 
59  ph_rgh.write();
60 
61  p_rgh = ph_rgh;
62  }
63 }
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:37
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< GeometricField< Type, faPatchField, areaMesh > > div(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facDiv.C:43
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
bool equal(const Matrix< Form1, Type > &A, const Matrix< Form2, Type > &B, const bool verbose=false, const label maxDiffs=10, const scalar relTol=1e-5, const scalar absTol=1e-8)
Compare matrix elements for absolute or relative equality.
Definition: MatrixTools.C:27
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
psiReactionThermo & thermo
Definition: createFields.H:28
dynamicFvMesh & mesh
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:40
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
pimpleControl & pimple
void constrainPressure(volScalarField &p, const RhoType &rho, const volVectorField &U, const surfaceScalarField &phiHbyA, const RAUType &rhorAU, const MRFType &MRF)
U
Definition: pEqn.H:72
const volScalarField & gh
messageStream Info
Information stream (stdout output on master, null elsewhere)
volScalarField & p
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)"))
volScalarField & p_rgh
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:40