64 const bool isNew = !result1;
146 mesh_.time().timeName(),
156 for (
auto& pfld : denom.boundaryFieldRef())
160 isA<coupledFvPatchField<scalar>>(pfld)
161 && !
isA<processorFvPatchField<scalar>>(pfld)
164 pfld = pfld.patchInternalField();
193 resultName1_(
"ObukhovLength"),
194 resultName2_(
"Ustar"),
202 dict.getCheckOrDefault<scalar>
206 [&](const scalar
x){
return x > SMALL; }
227 UName_ =
dict.getOrDefault<
word>(
"U",
"U");
228 resultName1_ =
dict.getOrDefault<
word>(
"ObukhovLength",
"ObukhovLength");
229 resultName2_ =
dict.getOrDefault<
word>(
"Ustar",
"Ustar");
231 if (UName_ !=
"U" && resultName1_ ==
"ObukhovLength")
233 resultName1_ +=
'(' + UName_ +
')';
236 if (UName_ !=
"U" && resultName1_ ==
"Ustar")
238 resultName2_ +=
'(' + UName_ +
')';
241 rhoRef_ =
dict.getOrDefault<scalar>(
"rhoRef", 1.0);
243 beta_.value() =
dict.getOrDefault<scalar>(
"beta", 3
e-3);
257 if (isNew)
Log <<
" (new)" <<
nl <<
endl;
265 const auto* ioptr1 = mesh_.cfindObject<
regIOobject>(resultName1_);
266 const auto* ioptr2 = mesh_.cfindObject<
regIOobject>(resultName2_);
271 <<
" writing field " << ioptr1->name() <<
nl
272 <<
" writing field " << ioptr2->
name() <<
endl;
302 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.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing 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.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Abstract base class for coupled patches.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
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.
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.
virtual void movePoints(const polyMesh &m)
Update for mesh point-motion.
virtual bool read(const dictionary &dict)
Read the data.
ObukhovLength(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
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.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const Time & time() const
Return the top-level database.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const noexcept
Return polyMesh.
static const gravity & New(const word &name, const Time &runTime)
Return named gravity field cached or construct on Time.
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
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
Mesh consisting of general polyhedral cells.
This boundary condition enables processor communication across patches.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
GeometricField< vector, fvPatchField, volMesh > volVectorField
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)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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 expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
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