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
36 Example of function object specification:
37 \verbatim
38 box.all.numberDensity.volume.bubbles
39 {
40 type sizeDistribution;
41 libs (reactingEulerFoamFunctionObjects);
42 writeControl outputTime;
43 writeInterval 1;
44 log true;
45 ...
46 functionType numberDensity;
47 abszissaType volume;
48 selectionMode all;
49 populationBalanceModel bubbles;
50 normalize true;
51 }
52 \endverbatim
53
54Usage
55 \table
56 Property | Description | Required | Default value
57 type | type name: sizeDistribution | yes |
58 functionType | numberDensity, volumeDensity, numberConcentration,
59 moments | yes |
60 abszissaType | volume, diameter | yes |
61 momentOrder | Write moment up to given order | no | 0
62 selectionMode | Evaluate for cellZone or entire mesh | yes |
63 cellZone | Required if selectionMode is cellZone | |
64 populationBalanceModel | Respective populationBalanceModel | yes |
65 normalize | Normalization | no |
66 \endtable
67
68See also
69 Foam::diameterModels::populationBalanceModel
70 Foam::functionObject
71 Foam::functionObjects::fvMeshFunctionObject
72 Foam::functionObjects::writeFile
73
74SourceFiles
75 sizeDistribution.C
76
77\*---------------------------------------------------------------------------*/
78
79#ifndef functionObjects_sizeDistribution_H
80#define functionObjects_sizeDistribution_H
81
83#include "writeFile.H"
85#include "Enum.H"
86
87// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88
89namespace Foam
90{
91
92// Forward declaration of classes
93class fvMesh;
94
95namespace functionObjects
96{
97
98/*---------------------------------------------------------------------------*\
99 Class sizeDistribution Declaration
100\*---------------------------------------------------------------------------*/
101
102class sizeDistribution
103:
104 public fvMeshFunctionObject,
105 public writeFile
106{
107
108public:
109
110 // Public data types
111
112 //- Selection mode type enumeration
114 {
116 rtAll
117 };
118
119 //- Selection mode type names
120 static const Enum<selectionModeTypes> selectionModeTypeNames_;
121
122
123 //- Function type enumeration
124 enum functionTypes
125 {
126 ftNdf,
127 ftVdf,
128 ftNc,
129 ftMom
130 };
131
132 //- Function type names
133 static const Enum<functionTypes> functionTypeNames_;
134
135
136 //- abszissa type enumeration
137 enum abszissaTypes
138 {
140 atVolume,
141 };
142
143 //- Abszissa type names
144 static const Enum<abszissaTypes> abszissaTypeNames_;
145
146
147protected:
149 // Protected data
150
151 //- Construction dictionary
153
154 //- Selection mode type
156
157 //- Name of selection
160 //- Function type
162
163 //- Abszissa type
165
166 //- Global number of cells
167 label nCells_;
168
169 //- Local list of cell IDs
171
172 //- Total volume of the evaluated selection
173 scalar volume_;
175 //- Optionally write the volume of the sizeDistribution
177
178 //- PopulationBalance
180
181 //- Number concentrations
184 //- Write moments up to specified order with respect to abszissaType
187 //- Normalization switch
188 const Switch normalize_;
189
190 //- Sum of number concentrations
191 scalar sumN_;
192
193 //- Volumertic sum
194 scalar sumV_;
195
196
197 // Protected Member Functions
199 //- Initialise, e.g. cell addressing
200 void initialise(const dictionary& dict);
202 //- Set cells to evaluate based on a cell zone
203 void setCellZoneCells();
205 //- Calculate and return volume of the evaluated cell zone
206 scalar volume() const;
208 //- Combine fields from all processor domains into single field
211 //- Filter field according to cellIds
214 //- Output file header information
215 void writeFileHeader(const label i = 0);
217
218public:
220 //- Runtime type information
221 TypeName("sizeDistribution");
223
224 // Constructors
226 //- Construct from Time and dictionary
229 const word& name,
230 const Time& runTime,
232 );
233
235 //- Destructor
236 virtual ~sizeDistribution();
238
239 // Member Functions
241 //- Return the reference to the construction dictionary
242 const dictionary& dict() const
243 {
244 return dict_;
245 }
246
247 //- Return the local list of cell IDs
248 const labelList& cellId() const
249 {
250 return cellId_;
251 }
252
253 //- Helper function to return the reference to the mesh
254 const fvMesh& mesh() const
255 {
256 return refCast<const fvMesh>(obr_);
257 }
258
259 //- Read from dictionary
260 virtual bool read(const dictionary& dict);
261
262 //- Execute
263 virtual bool execute();
264
265 //- Write
266 virtual bool write();
268
269
270// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271
272} // End namespace functionObjects
273} // End namespace Foam
274
275// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277#endif
278
279// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
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:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
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.
word selectionModeTypeName_
Name of selection.
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 from 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.
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.
scalar volume_
Total volume of the evaluated selection.
functionTypes
Function type enumeration.
labelList cellId_
Local list of cell IDs.
Base class for writing single files from the function objects.
Definition: writeFile.H:120
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
engineTime & runTime
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73