RosinRammler.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2020 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::distributionModels::RosinRammler
29 
30 Description
31  Particle-size distribution model wherein random samples are drawn
32  from the doubly-truncated two-parameter Rosin-Rammler (Weibull)
33  probability density function:
34 
35  \f[
36  f(x; \lambda, n, A, B) =
37  \frac{
38  \frac{n}{\lambda}
39  \left( \frac{x}{\lambda} \right)^{n-1}
40  \exp\{ -(\frac{x}{\lambda})^n \}
41  }{
42  \exp\{- (\frac{A}{\lambda})^n \}
43  - \exp\{- (\frac{B}{\lambda})^n \}
44  }
45  \f]
46  where
47 
48  \vartable
49  f(x; \lambda, n, A, B) | Rosin-Rammler probability density function
50  \lambda | Scale parameter
51  n | Shape parameter
52  x | Sample
53  A | Minimum of the distribution
54  B | Maximum of the distribution
55  \endvartable
56 
57  Constraints:
58  - \f$ \infty > B > A > 0\f$
59  - \f$ x \in [B,A] \f$
60  - \f$ \lambda > 0 \f$
61  - \f$ n > 0 \f$
62 
63  Random samples are generated by the inverse transform sampling technique
64  by using the quantile function of the doubly-truncated two-parameter
65  Rosin-Rammler (Weibull) probability density function:
66 
67  \f[
68  x = \lambda \left( q_{min} - \ln (1 - u r) \right)^{1/n}
69  \f]
70  with
71 
72  \f[
73  r = 1 - \exp(-q_{max} + q_{min})
74  \f]
75 
76  \f[
77  q_{min} = \left(\frac{A}{\lambda}\right)^n
78  \f]
79 
80  \f[
81  q_{max} = \left(\frac{B}{\lambda}\right)^n
82  \f]
83  where \f$ u \f$ is sample drawn from the uniform probability
84  density function on the unit interval \f$ (0, 1) \f$.
85 
86  Reference:
87  \verbatim
88  Doubly-truncated two-parameter Weibull distribution and its moments (tag:C):
89  Crénin, F. (2015).
90  Truncated Weibull Distribution Functions and Moments.
91  SSRN 2690255.
92  DOI:10.2139/ssrn.2690255
93  \endverbatim
94 
95 Usage
96  Minimal example by using \c constant/<CloudProperties>:
97  \verbatim
98  subModels
99  {
100  injectionModels
101  {
102  <name>
103  {
104  ...
105 
106  sizeDistribution
107  {
108  type RosinRammler;
109  RosinRammlerDistribution
110  {
111  lambda <scaleParameterValue>;
112  n <shapeParameterValue>;
113  minValue <minValue>;
114  maxValue <maxValue>;
115  }
116  }
117  }
118  }
119  }
120  \endverbatim
121 
122  where the entries mean:
123  \table
124  Property | Description | Type | Reqd | Deflt
125  type | Type name: RosinRammler | word | yes | -
126  RosinRammlerDistribution | Distribution settings | dict | yes | -
127  lambda | Scale parameter | scalar | yes | -
128  n | Shape parameter | scalar | yes | -
129  minValue | Minimum of the distribution | scalar | yes | -
130  maxValue | Maximum of the distribution | scalar | yes | -
131  \endtable
132 
133 SourceFiles
134  RosinRammler.C
135 
136 \*---------------------------------------------------------------------------*/
137 
138 #ifndef RosinRammler_H
139 #define RosinRammler_H
140 
141 #include "distributionModel.H"
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 namespace Foam
146 {
147 namespace distributionModels
148 {
149 
150 /*---------------------------------------------------------------------------*\
151  Class RosinRammler Declaration
152 \*---------------------------------------------------------------------------*/
153 
154 class RosinRammler
155 :
156  public distributionModel
157 {
158  // Private Data
159 
160  //- Scale parameter
161  scalar lambda_;
162 
163  //- Shape parameter
164  scalar n_;
165 
166 
167 public:
168 
169  //- Runtime type information
170  TypeName("RosinRammler");
171 
172 
173  // Constructors
174 
175  //- Construct from components
176  RosinRammler(const dictionary& dict, Random& rndGen);
177 
178  //- Copy construct
179  RosinRammler(const RosinRammler& p);
180 
181  //- Construct and return a clone
182  virtual autoPtr<distributionModel> clone() const
183  {
184  return autoPtr<distributionModel>(new RosinRammler(*this));
185  }
186 
187  //- No copy assignment
188  void operator=(const RosinRammler&) = delete;
189 
190 
191  //- Destructor
192  virtual ~RosinRammler() = default;
193 
194 
195  // Member Functions
196 
197  //- Sample the distribution
198  virtual scalar sample() const;
199 
200  //- Return the theoretical mean of the distribution
201  virtual scalar meanValue() const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace distributionModels
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::distributionModels::RosinRammler::meanValue
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
Definition: RosinRammler.C:100
Foam::distributionModels::RosinRammler::TypeName
TypeName("RosinRammler")
Runtime type information.
Foam::distributionModels::RosinRammler::sample
virtual scalar sample() const
Sample the distribution.
Definition: RosinRammler.C:90
Foam::distributionModels::RosinRammler::~RosinRammler
virtual ~RosinRammler()=default
Destructor.
Foam::distributionModels::RosinRammler::operator=
void operator=(const RosinRammler &)=delete
No copy assignment.
Foam::distributionModel
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Definition: distributionModel.H:72
Foam::distributionModels::RosinRammler
Particle-size distribution model wherein random samples are drawn from the doubly-truncated two-param...
Definition: RosinRammler.H:219
Foam::distributionModels::RosinRammler::RosinRammler
RosinRammler(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: RosinRammler.C:47
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::distributionModels::RosinRammler::clone
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: RosinRammler.H:247
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
rndGen
Random rndGen
Definition: createFields.H:23
distributionModel.H