Go to the documentation of this file.
36 namespace distributionModels
52 minValue_(distributionModelDict_.get<scalar>(
"minValue")),
53 maxValue_(distributionModelDict_.get<scalar>(
"maxValue")),
54 expectation_(distributionModelDict_.get<scalar>(
"expectation")),
55 variance_(distributionModelDict_.get<scalar>(
"variance")),
61 <<
"Minimum value must be greater than zero. "
62 <<
"Supplied minValue = " << minValue_
66 if (maxValue_ < minValue_)
69 <<
"Maximum value is smaller than the minimum value:"
70 <<
" maxValue = " << maxValue_ <<
", minValue = " << minValue_
79 minValue_(
p.minValue_),
80 maxValue_(
p.maxValue_),
81 expectation_(
p.expectation_),
82 variance_(
p.variance_),
98 scalar a =
erf((minValue_ - expectation_)/variance_);
99 scalar
b =
erf((maxValue_ - expectation_)/variance_);
101 scalar
y = rndGen_.sample01<scalar>();
102 scalar
x = erfInv(
y*(
b - a) + a)*variance_ + expectation_;
107 x =
min(
max(
x, minValue_), maxValue_);
134 scalar
h =
log(1.0 -
y*
y)/a_;
normal(const dictionary &dict, Random &rndGen)
Construct from components.
virtual scalar erfInv(const scalar y) const
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
A library of runtime-selectable distribution models.
dimensionedScalar erf(const dimensionedScalar &ds)
virtual ~normal()
Destructor.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
A normal distribution model.
const dimensionedScalar h
Planck constant.
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 mean value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dimensionedScalar log(const dimensionedScalar &ds)
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
virtual scalar sample() const
Sample the distributionModel.
virtual scalar minValue() const
Return the minimum value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr scalar pi(M_PI)
dimensionedScalar sqrt(const dimensionedScalar &ds)
defineTypeNameAndDebug(binned, 0)
label k
Boltzmann constant.
virtual scalar maxValue() const
Return the maximum value.