34 namespace distributions
41 const Foam::scalar Foam::distributions::standardNormal::a_ = 0.147;
60 const scalar l =
log(1 -
y*
y),
b = 2/(
pi*a_) + l/2;
99 static const scalar sqrt2 =
sqrt(scalar(2));
100 const scalar
s = rndGen_.sample01<scalar>();
101 return approxErfInv(2*
s - 1)*sqrt2;
126 const scalar x0 = approxErfInv(1 - rootSmall);
127 const scalar x1 = approxErfInv(rootSmall - 1);
134 const scalar
f = scalar(i)/(
n - 1);
135 result[i] = (1 -
f)*x0 +
f*x1;
147 static const scalar sqrt2Pi =
sqrt(2*
pi);
148 return exp(-
sqr(
x)/2)/sqrt2Pi;
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Base class for statistical distributions.
Standard normal distribution. Not selectable.
static tmp< scalarField > approxErf(const scalarField &x)
Approximate error function.
virtual scalar min() const
Return the minimum value.
virtual ~standardNormal()
Destructor.
virtual scalar sample() const
Sample the distribution.
virtual tmp< scalarField > PDF(const scalarField &x) const
Return the distribution probability density function.
virtual tmp< scalarField > x(const label n) const
Return coordinates to plot across the range of the distribution.
static scalar approxErfInv(const scalar y)
Approximate error function inverse.
standardNormal(randomGenerator &&rndGen)
Construct from a random generator.
virtual scalar max() const
Return the maximum value.
virtual scalar mean() const
Return the mean value.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
defineTypeNameAndDebug(exponential, 0)
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
dimensionedScalar sqrt(const dimensionedScalar &ds)
randomGenerator rndGen(653213)