32#include "surfaceInterpolate.H"
44namespace 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"),
199 mesh_.objectRegistry::store(ph_rghPtr);
217 dict.readIfPresent(
"p_rgh", p_rghName_);
218 dict.readIfPresent(
"ph_rgh", ph_rghName_);
219 dict.readIfPresent(
"pRef", pRefName_);
220 dict.readIfPresent(
"rho", rhoName_);
221 dict.readIfPresent(
"U", UName_);
222 dict.readIfPresent(
"gh", ghName_);
223 dict.readIfPresent(
"ghf", ghfName_);
224 dict.readIfPresent(
"nCorrectors", nCorrectors_);
227 if (pRefName_ ==
"pInf")
229 pRefValue_ =
dict.get<scalar>(
"pRefValue");
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const surfaceScalarField & ghf
const volScalarField & gh
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
virtual bool read()
Re-read model coefficients if they have changed.
label timeIndex() const noexcept
Return current time index.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
Abstract base-class for fluid and solid thermodynamic properties.
static const word dictName
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Abstract base-class for Time/database function objects.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
Calculates and outputs the pressure fields p_rgh and ph_rgh.
void calculateAndWrite()
Calculate the fields and write.
word ph_rghName_
Name of p_hydrostatic - rho*g*h field, default is "ph_rgh".
word pRefName_
Name of uniform pressure reference field, default is "pRef".
virtual bool read(const dictionary &dict)
Read the hydrostaticPressure data.
dimensionedScalar pRef() const
Helper function to return the reference pressure.
scalar pRefValue_
Reference pressure if pRefName is set to "pInf".
virtual bool execute()
Calculate the p_rgh field.
virtual bool write()
Write the p_rgh and derived fields.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
const Type & lookupObject(const word &name, const bool recursive=false) const
virtual bool write(const bool valid=true) const
Write using setting from DB.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
Calculate the divergence of the given field.
Calculate the snGrad of the given volField.
Calculate the matrix for the laplacian of the field.
surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)"))
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.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
const dimensionSet dimPressure
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)