32#include "surfaceInterpolate.H"
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");
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
@ REGISTER
Request registration (bool: true).
@ MUST_READ
Reading required.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Abstract base-class for fluid and solid thermodynamic properties.
static const word dictName
The dictionary name ("thermophysicalProperties").
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
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 UName_
Name of velocity field, default is "ph_rgh".
word pRefName_
Name of uniform pressure reference field, default is "pRef".
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
word rhoName_
Name of density field, default is "rho".
dimensionedScalar pRef() const
Helper function to return the reference pressure.
word p_rghName_
Name of p - rho*g*h field, default is "p_rgh".
word ghfName_
Name of g*h surface field, default is "ghf".
scalar pRefValue_
Reference pressure if pRefName is set to "pInf".
virtual bool execute()
Execute the function-object operations.
label nCorrectors_
Number of correctors when solving for ph_rgh.
virtual bool write()
Write the function-object results.
hydrostaticPressure(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
word ghName_
Name of g*h volume field, default is "gh".
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
bool store()
Register object with its registry and transfer ownership to the registry.
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)"))
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
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
void constrainPressure(volScalarField &p, const RhoType &rho, const volVectorField &U, const surfaceScalarField &phiHbyA, const RAUType &rhorAU, const MRFType &MRF)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, fvPatchField, volMesh > volVectorField
fvMatrix< scalar > fvScalarMatrix
GeometricField< scalar, fvPatchField, volMesh > volScalarField
UniformDimensionedField< scalar > uniformDimensionedScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
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 expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
constexpr char nl
The newline '\n' character (0x0a).
psiReactionThermo & thermo