Go to the documentation of this file.
38 namespace functionObjects
49 bool Foam::functionObjects::randomise::calcTemplate()
51 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
53 const auto* fieldPtr = cfindObject<VolFieldType>(
fieldName_);
57 const auto&
field = *fieldPtr;
62 auto& rfield = trfield.ref();
66 auto applyPerturbation = [&](Type& cellval)
69 rng.randomise01(rndPert);
70 rndPert = 2.0*rndPert - pTraits<Type>::one;
71 rndPert /=
mag(rndPert);
73 cellval += magPerturbation_*rndPert;
78 for (Type& cellval : rfield)
80 applyPerturbation(cellval);
85 for (
const label celli :
cellIDs())
87 applyPerturbation(rfield[celli]);
108 calcTemplate<scalar>()
109 || calcTemplate<vector>()
110 || calcTemplate<sphericalTensor>()
111 || calcTemplate<symmTensor>()
112 || calcTemplate<tensor>()
140 dict.readEntry(
"magPerturbation", magPerturbation_);
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
Volume (cell) region selection class.
randomise(const randomise &)=delete
bool read(const char *buf, int32_t &val)
virtual bool read(const dictionary &dict)
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
virtual bool read(const dictionary &dict)
virtual bool read(const dictionary &dict)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
bool useAllCells() const noexcept
word scopedName(const word &name) const
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const labelList & cellIDs() const
static tmp< T > New(Args &&... args)
defineTypeNameAndDebug(ObukhovLength, 0)
word name(const expressions::valueTypeCode typeCode)