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-2024 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 
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 zero effective size
108  // exponent and given x-coordinates
109  virtual tmp<scalarField> PhiForZeroQ(const scalarField& x) const;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("RosinRammler");
116 
117 
118  // Constructors
119 
120  //- Construct from a dictionary
122  (
123  const unitConversion& units,
124  const dictionary& dict,
125  const label sampleQ,
127  );
128 
129  //- Construct copy
130  RosinRammler(const RosinRammler& d, const label sampleQ);
131 
132  //- Construct and return a clone
133  virtual autoPtr<distribution> clone(const label sampleQ) const
134  {
135  return autoPtr<distribution>(new RosinRammler(*this, sampleQ));
136  }
137 
138 
139  //- Destructor
140  virtual ~RosinRammler();
141 
142 
143  // Member Functions
144 
145  //- Sample the distribution for zero effective size exponent
146  virtual scalar sampleForZeroQ() const;
147 
148  //- Sample the distribution
150 
151  //- Return the minimum value
152  virtual scalar min() const;
153 
154  //- Return the maximum value
155  virtual scalar max() const;
156 
157  //- Write to a stream
158  virtual void write(Ostream& os, const unitConversion& units) const;
159 
160  //- Return coordinates to plot across the range of the distribution
161  virtual tmp<scalarField> plotX(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
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Rosin-Rammler distribution, scaled so that it spans between a specified minimum and maximum value,...
Definition: RosinRammler.H:77
virtual autoPtr< distribution > clone(const label sampleQ) const
Construct and return a clone.
Definition: RosinRammler.H:131
TypeName("RosinRammler")
Runtime type information.
virtual scalar min() const
Return the minimum value.
Definition: RosinRammler.C:123
RosinRammler(const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen)
Construct from a dictionary.
Definition: RosinRammler.C:66
virtual ~RosinRammler()
Destructor.
Definition: RosinRammler.C:108
virtual void write(Ostream &os, const unitConversion &units) const
Write to a stream.
Definition: RosinRammler.C:136
virtual scalar sampleForZeroQ() const
Sample the distribution for zero effective size exponent.
Definition: RosinRammler.C:114
virtual scalar max() const
Return the maximum value.
Definition: RosinRammler.C:129
virtual tmp< scalarField > plotX(const label n) const
Return coordinates to plot across the range of the distribution.
Definition: RosinRammler.C:151
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
virtual tmp< scalarField > PhiForZeroQ(const scalarField &x) const
Return values of the un-normalised CDF for zero effective size.
Definition: RosinRammler.C:55
Random number generator.
A class for managing temporary objects.
Definition: tmp.H:55
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
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
const HashTable< unitConversion > & units()
Get the table of unit conversions.
dictionary dict
randomGenerator rndGen(653213)