fixedValue.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-2016 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::fixedValue
29 
30 Description
31  Particle-size distribution model wherein samples are given fixed values.
32 
33 Usage
34  Minimal example by using \c constant/<CloudProperties>:
35  \verbatim
36  subModels
37  {
38  injectionModels
39  {
40  <name>
41  {
42  ...
43 
44  sizeDistribution
45  {
46  type fixedValue;
47  fixedValueDistribution
48  {
49  value <value>;
50  }
51  }
52  }
53  }
54  }
55  \endverbatim
56 
57  where the entries mean:
58  \table
59  Property | Description | Type | Reqd | Deflt
60  type | Type name: fixedValue | word | yes | -
61  fixedValueDistribution | Distribution settings | dict | yes | -
62  value | Fixed value for size | scalar | yes | -
63  \endtable
64 
65 SourceFiles
66  fixedValue.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef distributionModels_fixedValue_H
71 #define distributionModels_fixedValue_H
72 
73 #include "distributionModel.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 namespace distributionModels
80 {
81 /*---------------------------------------------------------------------------*\
82  Class fixedValue Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class fixedValue
86 :
87  public distributionModel
88 {
89  // Private Data
90 
91  //- Fixed value for size
92  scalar value_;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("fixedValue");
99 
100 
101  // Constructors
102 
103  //- Construct from components
104  fixedValue(const dictionary& dict, Random& rndGen);
105 
106  //- Copy construct
107  fixedValue(const fixedValue& p);
108 
109  //- Construct and return a clone
110  virtual autoPtr<distributionModel> clone() const
111  {
112  return autoPtr<distributionModel>(new fixedValue(*this));
113  }
114 
115  //- No copy assignment
116  void operator=(const fixedValue&) = delete;
117 
118 
119  //- Destructor
120  virtual ~fixedValue() = default;
121 
122 
123  // Member Functions
124 
125  //- Sample the distribution
126  virtual scalar sample() const;
127 
128  //- Return the minimum of the distribution
129  virtual scalar minValue() const;
130 
131  //- Return the maximum of the distribution
132  virtual scalar maxValue() const;
133 
134  //- Return the theoretical mean of the distribution
135  virtual scalar meanValue() const;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace distributionModels
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::distributionModels::fixedValue::~fixedValue
virtual ~fixedValue()=default
Destructor.
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::distributionModels::fixedValue::minValue
virtual scalar minValue() const
Return the minimum of the distribution.
Foam::distributionModels::fixedValue
Particle-size distribution model wherein samples are given fixed values.
Definition: fixedValue.H:108
Foam::distributionModels::fixedValue::TypeName
TypeName("fixedValue")
Runtime type information.
Foam::distributionModel
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Definition: distributionModel.H:72
Foam::distributionModels::fixedValue::operator=
void operator=(const fixedValue &)=delete
No copy assignment.
Foam::distributionModels::fixedValue::meanValue
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
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::fixedValue::maxValue
virtual scalar maxValue() const
Return the maximum of the distribution.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::distributionModels::fixedValue::clone
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: fixedValue.H:133
Foam::distributionModels::fixedValue::fixedValue
fixedValue(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: fixedValue.C:46
rndGen
Random rndGen
Definition: createFields.H:23
Foam::distributionModels::fixedValue::sample
virtual scalar sample() const
Sample the distribution.
distributionModel.H