34 namespace distributions
41 const Foam::scalar Foam::distributions::standardNormal::a_ = 0.147;
99 static const scalar sqrt2 =
sqrt(scalar(2));
100 const scalar
s = rndGen_.sample01<scalar>();
101 return approxErfInv(2*
s - 1)*sqrt2;
133 static const scalar sqrt2 =
sqrt(scalar(2));
134 return (1 + approxErf(
x/sqrt2))/2;
141 const scalar x0 = approxErfInv(1 - rootSmall);
142 const scalar x1 = approxErfInv(rootSmall - 1);
149 const scalar
f = scalar(i)/(
n - 1);
150 result[i] = (1 -
f)*x0 +
f*x1;
162 static const scalar sqrt2Pi =
sqrt(2*
pi);
163 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 tmp< scalarField > integralPDFxPow(const scalarField &x, const label e, const bool consistent=false) const
Return the integral of the PDF multiplied by an integer power of x.
virtual scalar min() const
Return the minimum value.
virtual ~standardNormal()
Destructor.
virtual scalar sample() const
Sample the distribution.
static scalar approxErfInv(const scalar y)
Approximate error function inverse.
virtual tmp< scalarField > plotPDF(const scalarField &x) const
Return values to plot the probability density function.
standardNormal(randomGenerator &&rndGen)
Construct from a random generator.
virtual scalar max() const
Return the maximum value.
virtual scalar mean() const
Return the mean value.
virtual tmp< scalarField > plotX(const label n) const
Return coordinates to plot across the range of the distribution.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
randomGenerator rndGen(653213)