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;
180 mean += weight_[i]*mu_[i];
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Minimal example by using system/controlDict.functions:
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...
const dictionary distributionModelDict_
Coefficients dictionary.
Random & rndGen_
Reference to the random number generator.
scalar minValue_
Minimum of the distribution.
scalar maxValue_
Maximum of the distribution.
distributionModel(const word &name, const dictionary &dict, Random &rndGen)
Construct from dictionary.
Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of d...
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
multiNormal(const dictionary &dict, Random &rndGen)
Construct from components.
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.
A namespace for various probability distribution model implementations.
dimensionedScalar erf(const dimensionedScalar &ds)
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
static void check(const int retVal, const char *what)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
#define forAll(list, i)
Loop across all elements in list.