34 namespace distributionModels
50 minValue_(
readScalar(distributionModelDict_.lookup(
"minValue"))),
51 maxValue_(
readScalar(distributionModelDict_.lookup(
"maxValue"))),
52 expectation_(
readScalar(distributionModelDict_.lookup(
"expectation"))),
53 variance_(
readScalar(distributionModelDict_.lookup(
"variance"))),
59 <<
"Minimum value must be greater than zero. " 60 <<
"Supplied minValue = " << minValue_
64 if (maxValue_ < minValue_)
67 <<
"Maximum value is smaller than the minimum value:" 68 <<
" maxValue = " << maxValue_ <<
", minValue = " << minValue_
77 minValue_(p.minValue_),
78 maxValue_(p.maxValue_),
79 expectation_(p.expectation_),
80 variance_(p.variance_),
96 scalar a =
erf((minValue_ - expectation_)/variance_);
97 scalar
b =
erf((maxValue_ - expectation_)/variance_);
100 scalar
x =
erfInv(y*(b - a) + a)*variance_ + expectation_;
105 x =
min(
max(x, minValue_), maxValue_);
132 scalar
h =
log(1.0 - y*y)/a_;
A normal distribution model.
virtual scalar sample() const
Sample the distributionModel.
dimensionedScalar log(const dimensionedScalar &ds)
Random & rndGen_
Reference to the random number generator.
virtual scalar minValue() const
Return the minimum value.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual scalar erfInv(const scalar y) const
dimensionedScalar sqrt(const dimensionedScalar &ds)
label k
Boltzmann constant.
Macros for easy insertion into run-time selection tables.
virtual scalar maxValue() const
Return the maximum value.
Type sample01()
Advance the state and return a sample of a given type from a.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
virtual scalar meanValue() const
Return the mean value.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
virtual ~normal()
Destructor.
errorManip< error > abort(error &err)
normal(const dictionary &dict, Random &rndGen)
Construct from components.
defineTypeNameAndDebug(exponential, 0)
dimensionedScalar erf(const dimensionedScalar &ds)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
volScalarField & h
Planck constant.
A library of runtime-selectable distribution models.
addToRunTimeSelectionTable(distributionModel, exponential, dictionary)