Loading...
Searching...
No Matches
sizeDistribution.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) 2017-2019 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionObjects::sizeDistribution
28
29Description
30 This function object calculates and outputs information about the size
31 distribution of the dispersed phase, such as the number density function or
32 its moments. It is designed to be used exclusively with the population
33 balance modeling functionality of the reactingEulerFoam solvers. It can be
34 applied to a specific cellZone or the entire domain.
35
36Usage
37 Minimal example by using \c system/controlDict.functions:
38 \verbatim
39 sizeDistributionFO
40 {
41 // Mandatory entries
42 type sizeDistribution;
43 libs (reactingEulerFoamFunctionObjects);
44 selectionMode <word>;
45 functionType <word>;
46 abszissaType <word>;
47 populationBalance <word>;
48
49 // Conditional entries
50
51 // when 'selectionMode' is 'cellZone'
52 cellZone <word>;
53
54 // Optional entries
55 writeVolume <bool>;
56 momentOrder <label>;
57 normalize <bool>;
58
59 // Inherited entries
60 ...
61 }
62 \endverbatim
63
64 where the entries mean:
65 \table
66 Property | Description | Type | Reqd | Deflt
67 type | Type name: sizeDistribution | word | yes | -
68 libs | Library name: reactingEulerFoamFunctionObjects | word | yes | -
69 selectionMode | Evaluate for cellZone or entire mesh | word | yes | -
70 functionType | Name of the function type | word | yes | -
71 abszissaType | Name of the abszissa type | word | yes | -
72 populationBalance | Name of the model | word | yes | -
73 momentOrder | Write the moment up to given order | label | no | 0
74 normalize | Flag to normalize the results | bool | no | false
75 cellZone | Name of the cell zone | word | conditional | -
76 \endtable
77
78 Options for the \c selectionMode entry:
79 \verbatim
80 cellZone | Select the specified cell zone
81 all | Select all the cells
82 \endverbatim
83
84 Options for the \c functionType entry:
85 \verbatim
86 numberDensity | Calculates the number density function (NDF)
87 volumeDensity | Calculates the volume density function (VDF)
88 numberConcentration | Calculates the number concentration
89 moments | Calculates the moments of the distribution
90 \endverbatim
91
92 Options for the \c abszissaType entry:
93 \verbatim
94 diameter | Use particle diameter as abscissa
95 volume | Use particle volume as abscissa
96 \endverbatim
97
98 The inherited entries are elaborated in:
99 - \link functionObject.H \endlink
100 - \link writeFile.H \endlink
101 - \link populationBalanceModel.H \endlink
102
103Note
104 The choice of \c abszissaType determines whether the distribution and
105 its moments are calculated with respect to particle diameter or particle
106 volume.
107
108SourceFiles
109 sizeDistribution.C
110
111\*---------------------------------------------------------------------------*/
112
113#ifndef Foam_functionObjects_sizeDistribution_H
114#define Foam_functionObjects_sizeDistribution_H
115
116#include "fvMeshFunctionObject.H"
117#include "writeFile.H"
119#include "Enum.H"
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123namespace Foam
124{
125
126// Forward declaration of classes
127class fvMesh;
128
129namespace functionObjects
130{
131
132/*---------------------------------------------------------------------------*\
133 Class sizeDistribution Declaration
134\*---------------------------------------------------------------------------*/
135
137:
139 public writeFile
140{
141public:
142
143 // Public Enumerations
144
145 //- Selection mode type enumeration
147 {
149 rtAll
150 };
151
152 //- Selection mode type names
153 static const Enum<selectionModeTypes> selectionModeTypeNames_;
154
155
156 //- Function type enumeration
157 enum functionTypes
158 {
159 ftNdf,
160 ftVdf,
161 ftNc,
162 ftMom
163 };
164
165 //- Function type names
166 static const Enum<functionTypes> functionTypeNames_;
167
168
169 //- Abszissa type enumeration
170 enum abszissaTypes
171 {
173 atVolume,
174 };
175
176 //- Abszissa type names
177 static const Enum<abszissaTypes> abszissaTypeNames_;
178
179
180protected:
181
182 // Protected Data
183
184 //- Construction dictionary
186
187 //- Selection mode type
189
190 //- Name of selection
192
193 //- Function type
195
196 //- Abszissa type
198
199 //- Global number of cells
200 label nCells_;
201
202 //- Local list of cell IDs
204
205 //- Total volume of the evaluated selection
206 scalar volume_;
207
208 //- Optionally write the volume of the sizeDistribution
209 bool writeVolume_;
210
211 //- PopulationBalance
213
214 //- Number concentrations
216
217 //- Write moments up to specified order with respect to abszissaType
219
220 //- Normalization switch
223 //- Sum of number concentrations
224 scalar sumN_;
225
226 //- Volumertic sum
227 scalar sumV_;
228
230 // Protected Member Functions
231
232 //- Initialise, e.g. cell addressing
233 void initialise(const dictionary& dict);
234
235 //- Set cells to evaluate based on a cell zone
236 void setCellZoneCells();
238 //- Calculate and return volume of the evaluated cell zone
239 scalar volume() const;
240
241 //- Combine fields from all processor domains into single field
243
244 //- Filter field according to cellIds
246
247 //- Output file header information
248 void writeFileHeader(const label i = 0);
249
250
251public:
252
253 //- Runtime type information
254 TypeName("sizeDistribution");
255
256
257 // Constructors
258
259 //- Construct from name, Time and dictionary
261 (
262 const word& name,
263 const Time& runTime,
265 );
266
267
268 //- Destructor
270
271
272 // Member Functions
273
274 //- Return the reference to the construction dictionary
275 const dictionary& dict() const
276 {
277 return dict_;
278 }
280 //- Return the local list of cell IDs
281 const labelList& cellId() const
282 {
283 return cellId_;
285
286 //- Helper function to return the reference to the mesh
287 const fvMesh& mesh() const
288 {
290 }
291
292 // I-O
293
294 //- Read the function-object dictionary
295 virtual bool read(const dictionary& dict);
296
297 //- Execute the function-object operations
298 virtual bool execute();
300 //- Write the function-object results
301 virtual bool write();
302};
303
305// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306
307} // End namespace functionObjects
308} // End namespace Foam
310// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311
312#endif
313
314// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Class that solves the univariate population balance equation by means of a class method (also called ...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const objectRegistry & obr_
Reference to the region objectRegistry.
This function object calculates and outputs information about the size distribution of the dispersed ...
label nCells_
Global number of cells.
TypeName("sizeDistribution")
Runtime type information.
scalar sumN_
Sum of number concentrations.
selectionModeTypes
Selection mode type enumeration.
selectionModeTypes selectionModeType_
Selection mode type.
void setCellZoneCells()
Set cells to evaluate based on a cell zone.
dictionary dict_
Construction dictionary.
scalar volume() const
Calculate and return volume of the evaluated cell zone.
abszissaTypes abszissaType_
Abszissa type.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
functionTypes functionType_
Function type.
bool writeVolume_
Optionally write the volume of the sizeDistribution.
static const Enum< selectionModeTypes > selectionModeTypeNames_
Selection mode type names.
List< scalar > N_
Number concentrations.
const fvMesh & mesh() const
Helper function to return the reference to the mesh.
const Switch normalize_
Normalization switch.
const dictionary & dict() const
Return the reference to the construction dictionary.
void writeFileHeader(const label i=0)
Output file header information.
static const Enum< abszissaTypes > abszissaTypeNames_
Abszissa type names.
static const Enum< functionTypes > functionTypeNames_
Function type names.
sizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
const labelList & cellId() const
Return the local list of cell IDs.
label momentOrder_
Write moments up to specified order with respect to abszissaType.
void combineFields(scalarField &field)
Combine fields from all processor domains into single field.
const Foam::diameterModels::populationBalanceModel & popBal_
PopulationBalance.
tmp< scalarField > filterField(const scalarField &field) const
Filter field according to cellIds.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
scalar volume_
Total volume of the evaluated selection.
labelList cellId_
Local list of cell IDs.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68