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 clamp(
x, minValue_, maxValue_);
180 mean += weight_[i]*mu_[i];
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of d...
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
multiNormal(const dictionary &dict, Random &rndGen)
Construct from components.
dimensionedScalar sqrt(const dimensionedScalar &ds)
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
scalar erfInv(const scalar y)
Inverse error function of a real-number argument.
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
defineTypeNameAndDebug(binned, 0)
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
dimensionedScalar erf(const dimensionedScalar &ds)
static void check(const int retVal, const char *what)
const dimensionedScalar mu
Atomic mass unit.
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
virtual scalar sample() const
Sample the distribution.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)