38namespace distributionModels
56 distributionModelDict_.getCompat<scalar>
59 {{
"expectation", 2106}}
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);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Particle-size distribution model wherein random samples are drawn from the doubly-truncated univariat...
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
virtual scalar sample() const
Sample the distribution.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar erfInv(const scalar y)
Inverse error function of a real-number argument.
constexpr scalar pi(M_PI)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar erf(const dimensionedScalar &ds)
static void check(const int retVal, const char *what)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)