Go to the documentation of this file.
35 namespace distributionModels
51 minValue_(distributionModelDict_.get<scalar>(
"minValue")),
52 maxValue_(distributionModelDict_.get<scalar>(
"maxValue")),
53 range_(maxValue_ - minValue_),
54 expectation_(distributionModelDict_.lookup(
"expectation")),
55 variance_(distributionModelDict_.lookup(
"variance")),
56 strength_(distributionModelDict_.lookup(
"strength"))
61 label
n = strength_.size();
62 for (label i=0; i<
n; i++)
64 scalar
x = expectation_[i];
65 scalar
s = strength_[i];
66 for (label j=0; j<
n; j++)
70 scalar x2 = (
x - expectation_[j])/variance_[j];
71 scalar
y =
exp(-0.5*x2*x2);
79 for (label i=0; i<
n; i++)
89 minValue_(
p.minValue_),
90 maxValue_(
p.maxValue_),
92 expectation_(
p.expectation_),
93 variance_(
p.variance_),
94 strength_(
p.strength_)
110 label
n = expectation_.size();
115 x = minValue_ + range_*rndGen_.sample01<scalar>();
116 y = rndGen_.sample01<scalar>();
119 for (label i=0; i<
n; i++)
121 scalar
nu = expectation_[i];
122 scalar
sigma = variance_[i];
123 scalar
s = strength_[i];
125 p +=
s*
exp(-0.5*v*v);
155 mean += strength_[i]*expectation_[i];
virtual ~multiNormal()
Destructor.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual scalar maxValue() const
Return the maximum value.
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
dimensionedScalar exp(const dimensionedScalar &ds)
A library of runtime-selectable distribution models.
#define forAll(list, i)
Loop across all elements in list.
A multiNormal distribution model.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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.
virtual scalar minValue() const
Return the minimum value.
defineTypeNameAndDebug(binned, 0)
virtual scalar meanValue() const
Return the mean value.
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
virtual scalar sample() const
Sample the distributionModel.
multiNormal(const dictionary &dict, Random &rndGen)
Construct from components.