32 bool Foam::functionObjects::randomise::calcRandomised()
36 const VolField<Type>& field = lookupObject<VolField<Type>>(
fieldName_);
38 tmp<VolField<Type>> rfieldt(
new VolField<Type>(field));
39 VolField<Type>& rfield = rfieldt.ref();
41 randomGenerator
rndGen(1234567);
45 Type rndPert =
rndGen.sample01<Type>();
46 rndPert = 2.0*rndPert - pTraits<Type>::one;
47 rndPert /=
mag(rndPert);
48 rfield[celli] += magPerturbation_*rndPert;
#define forAll(list, i)
Loop across all elements in list.
word resultName_
Name of result field.
const word fieldName_
Name of field to process.
bool foundObject(const word &fieldName) const
Find field in the objectRegistry.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
dimensioned< scalar > mag(const dimensioned< Type > &)
randomGenerator rndGen(653213)