43 namespace functionObjects
64 const bool isNew = !result1;
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);
242 kappa_ =
dict.getOrDefault<scalar>(
"kappa", 0.4);
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;
284 mesh_.thisDb().checkOut(resultName1_);
285 mesh_.thisDb().checkOut(resultName2_);
293 removeObukhovLength();
302 removeObukhovLength();
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
dimensionedScalar sign(const dimensionedScalar &ds)
Computes the Obukhov length field and associated friction velocity field.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
defineTypeNameAndDebug(ObukhovLength, 0)
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...
const dimensionedVector g_
Gravitational acceleration vector [m/s2].
virtual bool read(const dictionary &dict)
Read the data.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
scalar rhoRef_
Reference density (to convert from kinematic to static pressure)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word resultName2_
Name of the output field for Ustar.
bool store()
Register object with its registry and transfer ownership to the registry.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
Abstract base-class for Time/database function objects.
void removeObukhovLength()
Remove (checkOut) the output fields from the object registry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
bool read(const char *buf, int32_t &val)
Same as readInt32.
virtual void movePoints(const polyMesh &m)
Update for mesh point-motion.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionedScalar e
Elementary charge.
scalar kappa_
von Kármán constant [-]
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
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...
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
word UName_
Name of velocity field.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
virtual bool write()
Write the output fields.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensionedScalar beta_
Thermal expansion coefficient [1/K].
ObukhovLength(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
static const gravity & New(const word &name, const Time &runTime)
Return named gravity field cached or construct on Time.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow3(const dimensionedScalar &ds)
Info<< "Reading mechanical properties\"<< 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
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const polyMesh & mesh() const
Return polyMesh.
virtual bool execute()
Calculate the output fields.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool read(const dictionary &dict)
Read optional controls.
word resultName1_
Name of the output field for ObukhovLength.
Mesh consisting of general polyhedral cells.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const Type * isA(const U &obj)
Check if dynamic_cast to Type is possible.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool calcOL()
Hard-coded Obukhov length field and friction velocity.
const dimensionSet dimVelocity