41namespace functionObjects
62 const bool isNew = !result1;
152 resultName1_(
"ObukhovLength"),
153 resultName2_(
"Ustar"),
161 dict.getCheckOrDefault<scalar>
165 [&](const scalar
x){
return x > SMALL; }
186 UName_ =
dict.getOrDefault<
word>(
"U",
"U");
187 resultName1_ =
dict.getOrDefault<
word>(
"ObukhovLength",
"ObukhovLength");
188 resultName2_ =
dict.getOrDefault<
word>(
"Ustar",
"Ustar");
190 if (UName_ !=
"U" && resultName1_ ==
"ObukhovLength")
192 resultName1_ +=
'(' + UName_ +
')';
195 if (UName_ !=
"U" && resultName1_ ==
"Ustar")
197 resultName2_ +=
'(' + UName_ +
')';
200 rhoRef_ =
dict.getOrDefault<scalar>(
"rhoRef", 1.0);
201 kappa_ =
dict.getOrDefault<scalar>(
"kappa", 0.4);
202 beta_.value() =
dict.getOrDefault<scalar>(
"beta", 3
e-3);
216 if (isNew)
Log <<
" (new)" <<
nl <<
endl;
224 const auto* ioptr1 = mesh_.cfindObject<
regIOobject>(resultName1_);
225 const auto* ioptr2 = mesh_.cfindObject<
regIOobject>(resultName2_);
230 <<
" writing field " << ioptr1->name() <<
nl
231 <<
" writing field " << ioptr2->
name() <<
endl;
243 mesh_.thisDb().checkOut(resultName1_);
244 mesh_.thisDb().checkOut(resultName2_);
250 if (&mpm.
mesh() == &mesh_)
252 removeObukhovLength();
261 removeObukhovLength();
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dimensionSet & dimensions() const
Return const reference to dimensions.
Abstract base-class for Time/database function objects.
Computes the Obukhov length field and associated friction velocity field.
scalar rhoRef_
Reference density (to convert from kinematic to static pressure)
scalar kappa_
von Kármán constant [-]
word UName_
Name of velocity field.
void removeObukhovLength()
Remove (checkOut) the output fields from the object registry.
word resultName2_
Name of the output field for Ustar.
const dimensionedVector g_
Gravitational acceleration vector [m/s2].
word resultName1_
Name of the output field for ObukhovLength.
bool calcOL()
Hard-coded Obukhov length field and friction velocity.
virtual bool execute()
Calculate the output fields.
virtual bool write()
Write the output fields.
dimensionedScalar beta_
Thermal expansion coefficient [1/K].
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
Computes the magnitude of the square of an input field.
Computes the magnitude of an input field.
const Time & time() const
Return the top-level database.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
void movePoints()
Update for new mesh geometry.
void updateMesh()
Update for new mesh topology.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type & lookupObject(const word &name, const bool recursive=false) const
Type * getObjectPtr(const word &name, const bool recursive=false) const
Mesh consisting of general polyhedral cells.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool write(const bool valid=true) const
Write using setting from DB.
A class for handling words, derived from Foam::string.
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
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.
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
const dimensionSet dimless
Dimensionless.
bool read(const char *buf, int32_t &val)
Same as readInt32.
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensionedScalar sqrt(const dimensionedScalar &ds)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)
Info<< "Reading mechanical properties\n"<< endl;IOdictionary mechanicalProperties(IOobject("mechanicalProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));const dictionary &rhoDict(mechanicalProperties.subDict("rho"));word rhoType(rhoDict.get< word >("type"));autoPtr< volScalarField > rhoPtr