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  ),
15  mesh
16  )
17  );
18 
19  if (equal(runTime.value(), 0))
20  {
21  p = ph_rgh + rho*gh + pRef;
22  thermo.correct();
23  rho = thermo.rho();
24 
25  label nCorr
26  (
27  pimple.dict().getOrDefault<label>("nHydrostaticCorrectors", 5)
28  );
29 
30  for (label i=0; i<nCorr; i++)
31  {
33 
35  (
36  "phig",
37  -rhof*ghf*fvc::snGrad(rho)*mesh.magSf()
38  );
39 
40  // Update the pressure BCs to ensure flux consistency
41  constrainPressure(ph_rgh, rho, U, phig, rhof);
42 
43  fvScalarMatrix ph_rghEqn
44  (
45  fvm::laplacian(rhof, ph_rgh) == fvc::div(phig)
46  );
47 
48  ph_rghEqn.solve();
49 
50  p = ph_rgh + rho*gh + pRef;
51  thermo.correct();
52  rho = thermo.rho();
53 
54  Info<< "Hydrostatic pressure variation "
55  << (max(ph_rgh) - min(ph_rgh)).value() << endl;
56  }
57 
58  ph_rgh.write();
59 
60  p_rgh = ph_rgh;
61  }
62 }
Foam::constrainPressure
void constrainPressure(volScalarField &p, const RhoType &rho, const volVectorField &U, const surfaceScalarField &phiHbyA, const RAUType &rhorAU, const MRFType &MRF)
Definition: constrainPressure.C:39
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
p
volScalarField & p
Definition: createFieldRefs.H:8
nCorr
const int nCorr
Definition: readFluidMultiRegionPIMPLEControls.H:3
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:18
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::MatrixTools::equal
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:34
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
rho
rho
Definition: readInitialConditions.H:88
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
p_rgh
volScalarField & p_rgh
Definition: setRegionFluidFields.H:15
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::Ostream::write
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
U
U
Definition: pEqn.H:72
phig
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::fac::laplacian
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:47
rhof
surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)"))
Foam::fac::interpolate
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.