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 
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 unitConversion& units,
128  const dictionary& dict,
129  const label sampleQ,
131  );
132 
133  //- Construct copy
134  RosinRammler(const RosinRammler& d, const label sampleQ);
135 
136  //- Construct and return a clone
137  virtual autoPtr<distribution> clone(const label sampleQ) const
138  {
139  return autoPtr<distribution>(new RosinRammler(*this, sampleQ));
140  }
141 
142 
143  //- Destructor
144  virtual ~RosinRammler();
145 
146 
147  // Member Functions
148 
149  //- Sample the distribution
150  virtual scalar sample() const;
151 
152  //- Sample the distribution
154 
155  //- Return the minimum value
156  virtual scalar min() const;
157 
158  //- Return the maximum value
159  virtual scalar max() const;
160 
161  //- Write to a stream
162  virtual void write(Ostream& os, const unitConversion& units) const;
163 
164  //- Return coordinates to plot across the range of the distribution
165  virtual tmp<scalarField> x(const label n) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace distributions
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
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:135
TypeName("RosinRammler")
Runtime type information.
virtual scalar min() const
Return the minimum value.
Definition: RosinRammler.C:139
virtual scalar sample() const
Sample the distribution.
Definition: RosinRammler.C:123
virtual tmp< scalarField > x(const label n) const
Return coordinates to plot across the range of the distribution.
Definition: RosinRammler.C:167
RosinRammler(const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen)
Construct from a dictionary.
Definition: RosinRammler.C:75
virtual ~RosinRammler()
Destructor.
Definition: RosinRammler.C:117
virtual void write(Ostream &os, const unitConversion &units) const
Write to a stream.
Definition: RosinRammler.C:152
virtual scalar max() const
Return the maximum value.
Definition: RosinRammler.C:145
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
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)