general Class Reference

Particle-size distribution model wherein random samples are drawn from a given arbitrary probability density function or cumulative distribution function. Input distributions are specified as pairs of (size, probability) (i.e. (point, value) ). More...

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

Public Member Functions

 TypeName ("general")
 Runtime type information. More...
 
 general (const dictionary &dict, Random &rndGen)
 Construct from components. More...
 
 general (const UList< scalar > &sampleData, const scalar binWidth, Random &rndGen)
 Construct from components. More...
 
 general (const general &p)
 Copy construct. More...
 
virtual autoPtr< distributionModelclone () const
 Construct and return a clone. More...
 
void operator= (const general &)=delete
 No copy assignment. More...
 
virtual ~general ()=default
 Destructor. More...
 
virtual tmp< scalarFieldx () const
 Bin boundaries. More...
 
virtual tmp< scalarFieldy () const
 Probabilities. More...
 
virtual scalar sample () const
 Sample the distribution. More...
 
virtual scalar meanValue () const
 Return the arithmetic mean of the distribution data. More...
 
virtual void writeData (Ostream &os) const
 Write data to stream. More...
 
virtual void readData (Istream &os)
 Read data from stream. More...
 
virtual dictionary writeDict (const word &dictName) const
 Write data in dictionary format. More...
 
virtual void readDict (const dictionary &dict)
 Read data from dictionary. 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 given arbitrary probability density function or cumulative distribution function. Input distributions are specified as pairs of (size, probability) (i.e. (point, value) ).

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

            sizeDistribution
            {
                type        general;
                generalDistribution
                {
                    cumulative      false;

                    distribution
                    (
                        (<size1>    <probability1>)
                        (<size2>    <probability2>)
                        ...
                        (<sizeN>    <probabilityN>)
                    );
                }
            }
        }
    }
}

where the entries mean:

Property Description Type Reqd Deflt
type Type name: general word yes -
generalDistribution Distribution settings dict yes -
distribution <size>-<probability> pairs dict yes -
<size> Particle size scalar yes -
<probability> Volume fraction/probability scalar yes -
cumulative

Flag to determine if input distribution is specified

as cumulative or as density

bool no false
Note
  • An example for a pair within distribution subdictionary can be given as follows: "(1e-07 1.3)" means 1.3% of particles are modelled with a particle diameter of "1e-7" [m], and so on.
  • Variation between input pairs is assumed to be linear.
  • Elements in the second column (i.e. probability) are normalised.
  • Elements in the second column for cumulative distribution functions must start from zero and must be non-decreasing (i.e. monotonic).
  • Elements in the first column (i.e. size) must be specified in an ascending order.
  • Input pairs cannot contain any negative element.
Source files

Definition at line 173 of file general.H.

Constructor & Destructor Documentation

◆ general() [1/3]

general ( const dictionary dict,
Random rndGen 
)

Construct from components.

Definition at line 96 of file general.C.

References distributionModel::check(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, distributionModel::maxValue_, distributionModel::minValue_, Foam::nl, and Foam::type().

Here is the call graph for this function:

◆ general() [2/3]

general ( const UList< scalar > &  sampleData,
const scalar  binWidth,
Random rndGen 
)

Construct from components.

Allows negative entries

Definition at line 166 of file general.C.

References Foam::endl(), forAll, Foam::max(), distributionModel::maxValue_, Foam::min(), distributionModel::minValue_, Foam::nl, and WarningInFunction.

Here is the call graph for this function:

◆ general() [3/3]

general ( const general p)

Copy construct.

Definition at line 223 of file general.C.

◆ ~general()

virtual ~general ( )
virtualdefault

Destructor.

Member Function Documentation

◆ TypeName()

TypeName ( "general"  )

Runtime type information.

◆ clone()

virtual autoPtr< distributionModel > clone ( ) const
inlinevirtual

Construct and return a clone.

Implements distributionModel.

Definition at line 227 of file general.H.

◆ operator=()

void operator= ( const general )
delete

No copy assignment.

◆ x()

Foam::tmp< Foam::Field< Foam::scalar > > x ( ) const
virtual

Bin boundaries.

Definition at line 334 of file general.C.

References forAll, Time::New(), and x.

Here is the call graph for this function:

◆ y()

Foam::tmp< Foam::Field< Foam::scalar > > y ( ) const
virtual

Probabilities.

Definition at line 348 of file general.C.

References forAll, Time::New(), and y.

Here is the call graph for this function:

◆ sample()

Foam::scalar sample ( ) const
virtual

Sample the distribution.

Implements distributionModel.

Definition at line 236 of file general.C.

References alpha, k, Foam::mag(), n, p, and Foam::sqrt().

Here is the call graph for this function:

◆ meanValue()

Foam::scalar meanValue ( ) const
virtual

Return the arithmetic mean of the distribution data.

Implements distributionModel.

Definition at line 281 of file general.C.

◆ writeData()

void writeData ( Ostream os) const
virtual

Write data to stream.

Definition at line 295 of file general.C.

References os(), and general::writeData().

Referenced by general::writeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readData()

void readData ( Istream os)
virtual

Read data from stream.

Definition at line 287 of file general.C.

◆ writeDict()

Foam::dictionary writeDict ( const word dictName) const
virtual

Write data in dictionary format.

Definition at line 302 of file general.C.

References dict, dictName(), x, and y.

Referenced by InjectedParticleDistributionInjection< CloudType >::info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readDict()

void readDict ( const dictionary dict)
virtual

Read data from dictionary.

Definition at line 316 of file general.C.

References dict, forAll, general::readDict(), x, and y.

Referenced by general::readDict().

Here is the call graph for this function:
Here is the caller graph for this function:

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