32 #include "surfaceInterpolate.H" 44 namespace functionObjects
78 const auto& pRef = this->pRef();
89 Info<<
"Performing hydrostatic pressure initialisation";
90 if (!mesh_.regionName().empty())
92 Info<<
" region=" << mesh_.name();
96 if (
thermo.incompressible())
104 p = ph_rgh +
rho*
gh + pRef;
111 p = ph_rgh +
rho*
gh + pRef;
115 for (label i=0; i<nCorrectors_; ++i)
137 p = ph_rgh +
rho*
gh + pRef;
141 Info<<
"Hydrostatic pressure variation " 142 << (
max(ph_rgh) -
min(ph_rgh)).value() <<
endl;
147 Log <<
" writing field " << ph_rgh.
name() <<
nl;
151 Log <<
" writing field " <<
rho.name() <<
nl;
154 Log <<
" writing field " <<
p_rgh.name() <<
nl;
157 Log <<
" writing field " <<
p.name() <<
nl;
173 ph_rghName_(
"ph_rgh"),
202 bool reInitialise =
dict.getOrDefault(
"reInitialise",
false);
204 if (
runTime.timeIndex() == 0 || reInitialise)
218 dict.readIfPresent(
"p_rgh", p_rghName_);
219 dict.readIfPresent(
"ph_rgh", ph_rghName_);
220 dict.readIfPresent(
"pRef", pRefName_);
221 dict.readIfPresent(
"rho", rhoName_);
222 dict.readIfPresent(
"U", UName_);
223 dict.readIfPresent(
"gh", ghName_);
224 dict.readIfPresent(
"ghf", ghfName_);
225 dict.readIfPresent(
"nCorrectors", nCorrectors_);
228 if (pRefName_ ==
"pInf")
230 pRefValue_ =
dict.get<scalar>(
"pRefValue");
word dictName() const
The local dictionary name (final part of scoped name)
defineTypeNameAndDebug(ObukhovLength, 0)
fvMatrix< scalar > fvScalarMatrix
word pRefName_
Name of uniform pressure reference field, default is "pRef".
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
virtual bool execute()
Calculate the p_rgh field.
Abstract base-class for fluid and solid thermodynamic properties.
word ph_rghName_
Name of p_hydrostatic - rho*g*h field, default is "ph_rgh".
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const word & name() const noexcept
Return the object name.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
constexpr char nl
The newline '\n' character (0x0a)
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool write()
Write the p_rgh and derived fields.
Calculate the matrix for the laplacian of the field.
bool store()
Register object with its registry and transfer ownership to the registry.
Calculate the snGrad of the given volField.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
psiReactionThermo & thermo
hydrostaticPressure(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
scalar pRefValue_
Reference pressure if pRefName is set to "pInf".
void calculateAndWrite()
Calculate the fields and write.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
const dimensionSet dimPressure
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Calculate the divergence of the given field.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void constrainPressure(volScalarField &p, const RhoType &rho, const volVectorField &U, const surfaceScalarField &phiHbyA, const RAUType &rhorAU, const MRFType &MRF)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
virtual bool read(const dictionary &dict)
Read the hydrostaticPressure data.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
dimensionedScalar pRef() const
Helper function to return the reference pressure.
Automatically write from objectRegistry::writeObject()
const volScalarField & gh
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)"))
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
static constexpr const zero Zero
Global zero (0)