multiNormal Class Reference

Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of doubly-truncated univariate normal probability density functions: More...

Inheritance diagram for multiNormal:
[legend]
Collaboration diagram for multiNormal:
[legend]

Public Member Functions

 TypeName ("multiNormal")
 Runtime type information. More...
 
 multiNormal (const dictionary &dict, Random &rndGen)
 Construct from components. More...
 
 multiNormal (const multiNormal &p)
 Copy construct. More...
 
virtual autoPtr< distributionModelclone () const
 Construct and return a clone. More...
 
void operator= (const multiNormal &)=delete
 No copy assignment. More...
 
virtual ~multiNormal ()=default
 Destructor. More...
 
virtual scalar sample () const
 Sample the distribution. More...
 
scalar sample (const scalar mu, const scalar sigma) const
 Sample the normal distribution. More...
 
virtual scalar meanValue () const
 Return the theoretical mean of the distribution. More...
 
- Public Member Functions inherited from distributionModel
 TypeName ("distributionModel")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, distributionModel, dictionary,(const dictionary &dict, Random &rndGen),(dict, rndGen))
 Declare runtime constructor selection table. More...
 
 distributionModel (const word &name, const dictionary &dict, Random &rndGen)
 Construct from dictionary. More...
 
 distributionModel (const distributionModel &p)
 Copy construct. More...
 
virtual autoPtr< distributionModelclone () const =0
 Construct and return a clone. More...
 
virtual ~distributionModel ()=default
 Destructor. More...
 
virtual scalar sample () const =0
 Sample the distribution. More...
 
virtual scalar minValue () const
 Return the minimum of the distribution. More...
 
virtual scalar maxValue () const
 Return the maximum of the distribution. More...
 
virtual scalar meanValue () const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from distributionModel
static autoPtr< distributionModelNew (const dictionary &dict, Random &rndGen)
 Selector. More...
 
- Protected Member Functions inherited from distributionModel
virtual void check () const
 Check that the distribution model is valid. More...
 
- Protected Attributes inherited from distributionModel
const dictionary distributionModelDict_
 Coefficients dictionary. More...
 
RandomrndGen_
 Reference to the random number generator. More...
 
scalar minValue_
 Minimum of the distribution. More...
 
scalar maxValue_
 Maximum of the distribution. More...
 

Detailed Description

Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of doubly-truncated univariate normal probability density functions:

\[ g (\mathbf{x}; \mathbf{\mu}, \mathbf{\sigma}, A, B) = \sum_i w_i f(x_i; \mu_i, \sigma_i, A, B) \]

with for any distribution:

\[ f(x; \mu, \sigma, A, B) = \frac{1}{\sigma} \frac{ \phi \left( \frac{x - \mu}{\sigma} \right) }{ \Phi \left( \frac{B - \mu}{\sigma} \right) - \Phi \left( \frac{A - \mu}{\sigma} \right) } \]

where

\( f(x; \mu, \sigma, A, B) \) = Doubly-truncated univariate normal distribution
\( \mu \) = Mean of the parent general normal distribution
\( \sigma \) = Standard deviation of the parent general normal distribution
\( \phi(\cdot) \) = General normal probability density function
\( \Phi(\cdot) \) = General normal cumulative distribution function
\( x \) = Sample
\( A \) = Minimum of the distribution (the same for each distribution)
\( B \) = Maximum of the distribution (the same for each distribution)
\( w_i \) = Weighting factor

Constraints:

  • \( \infty > B > A > 0 \)
  • \( x \in [B,A] \)
  • \( \sigma^2 > 0 \)
  • \( w_i >= 0 \)

Random samples are generated by a combination of the inverse transform sampling technique and categorical sampling in three steps:

  • Draw a sample from the uniform probability density function on the unit interval \(u = (0, 1)\)
  • Find the interval among normalised cumulative weight intervals wherein \( u \) resides
  • Draw a sample from the distribution corresponding to the interval by using the quantile function of the doubly-truncated univariate normal probability density function by the following expressions (similar to distributionModels::normal):

\[ x = \mu + \sigma \sqrt{2} \, {erf}^{-1} \left( 2 p - 1 \right) \]

with

\[ p = u \, \left( \Phi\left( \frac{B - \mu}{\sigma} \right) - \Phi\left( \frac{A - \mu}{\sigma} \right) \right) + \Phi\left( \frac{A - \mu}{\sigma} \right) \]

\[ \Phi(\xi) = \frac{1}{2} \left( 1 + {erf}\left(\frac{\xi - \mu}{\sigma \sqrt{2} }\right) \right) \]

where \( u \) is another sample drawn from the uniform probability density function on the unit interval \( (0, 1) \).

Usage
Minimal example by using constant/<CloudProperties>:
subModels
{
    injectionModels
    {
        <name>
        {
            ...

            sizeDistribution
            {
                type        multiNormal;
                multiNormalDistribution
                {
                    minValue  <min>;
                    maxValue  <max>;
                    mu
                    (
                        <mean1>
                        <mean2>
                        ...
                    );
                    sigma
                    (
                        <standard deviation1>
                        <standard deviation2>
                        ...
                    );
                    weight
                    (
                        <weight1>
                        <weight2>
                        ...
                    );
                }
            }
        }
    }
}

where the entries mean:

Property Description Type Reqd Deflt
type Type name: multiNormal word yes -
multiNormalDistribution Distribution settings dict yes -
minValue Minimum of the distribution scalar yes -
maxValue Maximum of the distribution scalar yes -
mu

List of means of parent general normal

distributions

scalarList yes -
sigma

List of standard deviations of parent

general normal distributions

scalarList yes -
weight

List of weights of a given distribution in

the distribution mixture

scalarList yes -

Notes

  • The sum of normal distributions (i.e. a mixture distribution) should not be confused with the sum of normally-distributed random variables.
  • minValue and maxValue are the same for all distributions in the distribution mixture.
  • weight should always be input in a non-decreasing (i.e. monotonic) order.
Source files

Definition at line 285 of file multiNormal.H.

Constructor & Destructor Documentation

◆ multiNormal() [1/2]

multiNormal ( const dictionary dict,
Random rndGen 
)

Construct from components.

Definition at line 48 of file multiNormal.C.

◆ multiNormal() [2/2]

multiNormal ( const multiNormal p)

Copy construct.

Definition at line 120 of file multiNormal.C.

◆ ~multiNormal()

virtual ~multiNormal ( )
virtualdefault

Destructor.

Member Function Documentation

◆ TypeName()

TypeName ( "multiNormal"  )

Runtime type information.

◆ clone()

virtual autoPtr< distributionModel > clone ( ) const
inlinevirtual

Construct and return a clone.

Implements distributionModel.

Definition at line 317 of file multiNormal.H.

◆ operator=()

void operator= ( const multiNormal )
delete

No copy assignment.

◆ sample() [1/2]

Foam::scalar sample ( ) const
virtual

Sample the distribution.

Implements distributionModel.

Definition at line 131 of file multiNormal.C.

◆ sample() [2/2]

Foam::scalar sample ( const scalar  mu,
const scalar  sigma 
) const

Sample the normal distribution.

Definition at line 149 of file multiNormal.C.

References b, Foam::erf(), Foam::Math::erfInv(), Foam::max(), Foam::min(), mu, p, Foam::sqrt(), and x.

Here is the call graph for this function:

◆ meanValue()

Foam::scalar meanValue ( ) const
virtual

Return the theoretical mean of the distribution.

Implements distributionModel.

Definition at line 175 of file multiNormal.C.

References forAll.


The documentation for this class was generated from the following files: