RosinRammler.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::distributions::RosinRammler
26 
27 Description
28  Rosin-Rammler distribution, scaled so that it spans between a specified
29  minimum and maximum value, rather than from zero to infinity
30 
31  \f[
32  PDF(x) = \left( \frac{n}{d} \right) \left( \frac{x}{d} \right)^{n-1} \\
33  \exp \left( - \left(\frac{x}{d} \right)^n \right)
34  \f]
35  \f[
36  CDF(x) = 1 - \exp \left( - \left( \frac{x}{d} \right)^n \right)
37  \f]
38 
39 Usage
40  Example usage:
41  \verbatim
42  {
43  type RosinRammler;
44  Q 0;
45  min 0.00001;
46  max 0.00015;
47  d 0.00014;
48  n 2;
49  }
50  \endverbatim
51 
52 SourceFiles
53  RosinRammler.C
54 
55 See also
56  Foam::distribution
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef RosinRammler_H
61 #define RosinRammler_H
62 
63 #include "unintegrable.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace distributions
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class RosinRammler Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class RosinRammler
77 :
78  public FieldDistribution<unintegrableForNonZeroQ, RosinRammler>
79 {
80  // Private Data
81 
82  //- Minimum value
83  const scalar min_;
84 
85  //- Maximum value
86  const scalar max_;
87 
88  //- Scale parameter
89  const scalar d_;
90 
91  //- Shape parameter
92  const scalar n_;
93 
94 
95 protected:
96 
97  // Protected Member Functions
98 
99  //- Return values of the un-normalised PDF for the given size exponent
100  // and x-coordinates.
101  virtual tmp<scalarField> phi
102  (
103  const label q,
104  const scalarField& x
105  ) const;
106 
107  //- Return values of the un-normalised CDF for the given size exponent
108  // and x-coordinates.
109  virtual tmp<scalarField> Phi
110  (
111  const label q,
112  const scalarField& x
113  ) const;
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("RosinRammler");
120 
121 
122  // Constructors
123 
124  //- Construct from a dictionary
126  (
127  const dictionary& dict,
128  Random& rndGen,
129  const label sampleQ
130  );
131 
132  //- Construct copy
133  RosinRammler(const RosinRammler& d, const label sampleQ);
134 
135  //- Construct and return a clone
136  virtual autoPtr<distribution> clone(const label sampleQ) const
137  {
138  return autoPtr<distribution>(new RosinRammler(*this, sampleQ));
139  }
140 
141 
142  //- Destructor
143  virtual ~RosinRammler();
144 
145 
146  // Member Functions
147 
148  //- Sample the distribution
149  virtual scalar sample() const;
150 
151  //- Sample the distribution
153 
154  //- Return the minimum value
155  virtual scalar min() const;
156 
157  //- Return the maximum value
158  virtual scalar max() const;
159 
160  //- Return coordinates to plot across the range of the distribution
161  virtual tmp<scalarField> x(const label n) const;
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace distributions
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
label n
Random number generator.
Definition: Random.H:58
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Rosin-Rammler distribution, scaled so that it spans between a specified minimum and maximum value,...
Definition: RosinRammler.H:77
virtual tmp< scalarField > Phi(const label q, const scalarField &x) const
Return values of the un-normalised CDF for the given size exponent.
Definition: RosinRammler.C:56
virtual autoPtr< distribution > clone(const label sampleQ) const
Construct and return a clone.
Definition: RosinRammler.H:134
TypeName("RosinRammler")
Runtime type information.
virtual scalar min() const
Return the minimum value.
Definition: RosinRammler.C:138
virtual scalar sample() const
Sample the distribution.
Definition: RosinRammler.C:122
virtual tmp< scalarField > x(const label n) const
Return coordinates to plot across the range of the distribution.
Definition: RosinRammler.C:151
virtual ~RosinRammler()
Destructor.
Definition: RosinRammler.C:116
RosinRammler(const dictionary &dict, Random &rndGen, const label sampleQ)
Construct from a dictionary.
Definition: RosinRammler.C:75
virtual scalar max() const
Return the maximum value.
Definition: RosinRammler.C:144
virtual tmp< scalarField > phi(const label q, const scalarField &x) const
Return values of the un-normalised PDF for the given size exponent.
Definition: RosinRammler.C:44
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict
Random rndGen(label(0))