Go to the documentation of this file.
38 namespace distributionModels
56 distributionModelDict_.getCompat<scalar>
59 {{
"expectation", 2112}}
64 distributionModelDict_.getCompat<scalar>
74 <<
"Standard deviation cannot be zero." <<
nl
75 <<
" sigma = " << sigma_ <<
nl
95 const scalar a = (minValue_ - mu_)/sigma_;
96 const scalar
b = (maxValue_ - mu_)/sigma_;
98 const scalar aPhi = 0.5*(scalar(1) +
erf(a/
Foam::sqrt(scalar(2))));
99 const scalar bPhi = 0.5*(scalar(1) +
erf(
b/
Foam::sqrt(scalar(2))));
101 const scalar u = rndGen_.sample01<scalar>();
102 const scalar
p = u*(bPhi - aPhi) + aPhi;
111 return min(
max(
x, minValue_), maxValue_);
117 const scalar a = (minValue_ - mu_)/sigma_;
118 const scalar
b = (maxValue_ - mu_)/sigma_;
129 const scalar aPhi = 0.5*(scalar(1) +
erf(a/
Foam::sqrt(scalar(2))));
130 const scalar bPhi = 0.5*(scalar(1) +
erf(
b/
Foam::sqrt(scalar(2))));
133 return mu_ - sigma_*(bphi - aphi)/(bPhi - aPhi + VSMALL);
normal(const dictionary &dict, Random &rndGen)
Construct from components.
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
dimensionedScalar exp(const dimensionedScalar &ds)
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.
static void check(const int retVal, const char *what)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Particle-size distribution model wherein random samples are drawn from the doubly-truncated univariat...
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.
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
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 sample() const
Sample the distribution.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr scalar pi(M_PI)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
defineTypeNameAndDebug(binned, 0)