Go to the documentation of this file.
39 namespace distributionModels
57 distributionModelDict_.lookupCompat
60 {{
"expectation", 2112}}
65 distributionModelDict_.lookupCompat
73 distributionModelDict_.lookupCompat
83 for (label i = 0; i < weight_.size(); ++i)
85 if (i > 0 && weight_[i] < weight_[i-1])
88 <<
type() <<
"distribution: "
89 <<
"Weights must be specified in a monotonic order." <<
nl
90 <<
"Please see the row i = " << i <<
nl
91 <<
"weight[i-1] = " << weight_[i-1] <<
nl
92 <<
"weight[i] = " << weight_[i]
102 <<
type() <<
"distribution: "
103 <<
"The sum of weights cannot be zero." <<
nl
104 <<
"weight = " << weight_
108 for (label i = 1; i < weight_.size(); ++i)
110 weight_[i] += weight_[i-1];
113 for (
auto& w : weight_)
133 const scalar u = rndGen_.sample01<scalar>();
135 for (label i = 0; i < weight_.size(); ++i)
139 return sample(mu_[i], sigma_[i]);
143 const label last = weight_.size() - 1;
145 return sample(mu_[last], sigma_[last]);
155 const scalar a = (minValue_ -
mu)/
sigma;
156 const scalar
b = (maxValue_ -
mu)/
sigma;
161 const scalar u = rndGen_.sample01<scalar>();
162 const scalar
p = u*(bPhi - aPhi) + aPhi;
171 return min(
max(
x, minValue_), maxValue_);
180 mean += weight_[i]*mu_[i];
const dimensionedScalar mu
Atomic mass unit.
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
dimensionedScalar erf(const dimensionedScalar &ds)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of d...
static void check(const int retVal, const char *what)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
scalar erfInv(const scalar y)
Inverse error function of a real-number argument.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar sqrt(const dimensionedScalar &ds)
defineTypeNameAndDebug(binned, 0)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
Various functions to operate on Lists.
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
virtual scalar sample() const
Sample the distribution.
multiNormal(const dictionary &dict, Random &rndGen)
Construct from components.
Minimal example by using system/controlDict.functions: