Loading...
Searching...
No Matches
extractEulerianParticles.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) 2015-2020 OpenCFD Ltd.
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::extractEulerianParticles
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Generates particle size information from Eulerian calculations, e.g. \c VoF.
34
35 Operands:
36 \table
37 Operand | Type | Location
38 input | - | -
39 output file | - | -
40 output field 1 | scalarField | $OUTPUT/d
41 output field 2 | scalarField | $OUTPUT/soi
42 output field 3 | labelField | $OUTPUT/tag
43 output field 4 | vectorField | $OUTPUT/U
44 \endtable
45
46 where \c $OUTPUT=<time>/lagrangian/eulerianParticleCloud
47
48Usage
49 Minimal example by using \c system/controlDict.functions:
50 \verbatim
51 extractEulerianParticlesFO
52 {
53 // Mandatory entries
54 type extractEulerianParticles;
55 libs (fieldFunctionObjects);
56 faceZone <word>; // f0;
57 alpha <word>; // alpha.water;
58
59 // Optional entries
60 alphaThreshold <scalar>;
61 nLocations <label>;
62 U <word>;
63 rho <word>;
64 phi <word>;
65 minDiameter <scalar>;
66 maxDiameter <scalar>;
67
68 // Inherited entries
69 ...
70 }
71 \endverbatim
72
73 where the entries mean:
74 \table
75 Property | Description | Type | Reqd | Deflt
76 type | Type name: extractEulerianParticles | word | yes | -
77 libs | Library name: fieldFunctionObjects | word | yes | -
78 faceZone | Name of faceZone used as collection surface | word | yes | -
79 alpha | Name of phase indicator field | word | yes | -
80 alphaThreshold | Threshold for alpha field | scalar | no | 0.1
81 nLocations | Number of injection bins to generate | label | no | 0
82 U | Name of velocity field | word | no | U
83 rho | Name of density field | word | no | rho
84 phi | Name of flux field | word | no | phi
85 minDiameter | Minimum diameter | scalar | no | SMALL
86 maxDiameter | Maximum diameter | scalar | no | GREAT
87 \endtable
88
89 The inherited entries are elaborated in:
90 - \link functionObject.H \endlink
91 - \link writeFile.H \endlink
92
93SourceFiles
94 extractEulerianParticles.C
95 extractEulerianParticlesTemplates.C
96
97\*---------------------------------------------------------------------------*/
98
99#ifndef Foam_functionObjects_extractEulerianParticles_H
100#define Foam_functionObjects_extractEulerianParticles_H
101
102#include "fvMeshFunctionObject.H"
103#include "writeFile.H"
105#include "polyMesh.H"
106#include "surfaceFieldsFwd.H"
107#include "globalIndex.H"
108#include "eulerianParticle.H"
110
111// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112
113namespace Foam
114{
115namespace functionObjects
116{
117/*---------------------------------------------------------------------------*\
118 Class extractEulerianParticlesFunctionObject Declaration
119\*---------------------------------------------------------------------------*/
120
122:
124 public writeFile
125{
126protected:
127
128 // Protected Data
129
130 //- Storage for collected particles
131 injectedParticleCloud cloud_;
132
133
134 // Face-zone data
135
136 //- Name of faceZone to sample
137 word faceZoneName_;
138
139 //- Index of the faceZone
140 label zoneID_;
141
142 //- Patch indices where faceZone face intersect patch
144
145 //- Patch face indices where faceZone face intersect patch
147
148
149 // Field names
150
151 //- Name of phase fraction field
152 word alphaName_;
153
154 //- Value of phase fraction used to identify particle boundaries
155 scalar alphaThreshold_;
156
157 //- Name of the velocity field, default = U
158 word UName_;
159
160 //- Name of the density field, default = rho
161 word rhoName_;
162
163 //- Name of the flux field, default ="rho"
164 word phiName_;
165
166
167 // Agglomeration
168
169 //- Number of sample locations to generate
171
172 //- Agglomeration addressing from fine to coarse (local proc only)
174
175 //- Global coarse face addressing
176 globalIndex globalCoarseFaces_;
177
178
179 // Particle collection info
180
181 //- Region indices in faceZone faces from last iteration
183
184 //- Particle properties (partial, being accumulated)
185 List<eulerianParticle> particles_;
186
187 //- Map from region to index in particles_ list
188 Map<label> regionToParticleMap_;
189
190 //- Minimum diameter (optional)
191 // Can be used to filter out 'small' particles
192 scalar minDiameter_;
193
194 //- Maximum diameter (optional)
195 // Can be used to filter out 'large' particles
196 scalar maxDiameter_;
197
198
199 // Statistics
200
201 //- Total number of collected particles
203
204 //- Total collected volume [m3]
205 scalar collectedVolume_;
206
207 //- Total number of discarded particles
209
210 //- Total discarded volume [m3]
211 scalar discardedVolume_;
212
213
214 // Protected Member Functions
215
216 //- Check that the faceZone is valid
217 virtual void checkFaceZone();
218
219 //- Initialise the particle collection bins
220 virtual void initialiseBins();
221
222 //- Return the volumetric flux
223 virtual tmp<surfaceScalarField> phiU() const;
224
225 //- Set the blocked faces, i.e. where alpha > alpha threshold value
226 virtual void setBlockedFaces
227 (
228 const surfaceScalarField& alphaf,
229 const faceZone& fz,
230 boolList& blockedFaces
231 );
232
233 //- Calculate the addressing between regions between iterations
234 //- Returns the number of active regions (particles)
235 virtual void calculateAddressing
237 const label nRegionsNew,
238 const scalar time,
239 labelList& regionFaceIDs
240 );
242 //- Collect particles that have passed through the faceZone
243 virtual void collectParticle
244 (
245 const scalar time,
246 const label regioni
247 );
248
249 //- Process latest region information
250 virtual void accumulateParticleInfo
252 const surfaceScalarField& alphaf,
253 const surfaceScalarField& phi,
254 const labelList& regionFaceIDs,
255 const faceZone& fz
256 );
257
258 template<class Type>
259 inline Type faceValue
260 (
262 const label localFaceI,
263 const label globalFaceI
264 ) const;
265
266
267public:
268
269 //- Runtime type information
270 TypeName("extractEulerianParticles");
271
272
273 // Constructors
275 //- Construct from components
277 (
278 const word& name,
279 const Time& runTime,
280 const dictionary& dict
281 );
282
283 //- No copy construct
285
286 //- No copy assignment
287 void operator=(const extractEulerianParticles&) = delete;
288
289
290 //- Destructor
291 virtual ~extractEulerianParticles() = default;
293
294 // Member Functions
295
296 //- Read the function-object dictionary
297 virtual bool read(const dictionary& dict);
298
299 //- Execute the function-object operations
300 virtual bool execute();
301
302 //- Write the function-object results
303 virtual bool write();
304};
306
307// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308
309} // End namespace functionObjects
310} // End namespace Foam
311
312// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313
314#ifdef NoRepository
316#endif
317
318// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
319
320#endif
321
322// ************************************************************************* //
Generic GeometricField class.
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 HashTable to objects of type <T> with a label key.
Definition Map.H:54
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A subset of mesh faces organised as a primitive patch.
Definition faceZone.H:63
Generates particle size information from Eulerian calculations, e.g. VoF.
virtual void accumulateParticleInfo(const surfaceScalarField &alphaf, const surfaceScalarField &phi, const labelList &regionFaceIDs, const faceZone &fz)
Process latest region information.
virtual tmp< surfaceScalarField > phiU() const
Return the volumetric flux.
label nDiscardedParticles_
Total number of discarded particles.
label nInjectorLocations_
Number of sample locations to generate.
scalar alphaThreshold_
Value of phase fraction used to identify particle boundaries.
virtual void setBlockedFaces(const surfaceScalarField &alphaf, const faceZone &fz, boolList &blockedFaces)
Set the blocked faces, i.e. where alpha > alpha threshold value.
word UName_
Name of the velocity field, default = U.
globalIndex globalCoarseFaces_
Global coarse face addressing.
label nCollectedParticles_
Total number of collected particles.
Type faceValue(const GeometricField< Type, fvsPatchField, surfaceMesh > &field, const label localFaceI, const label globalFaceI) const
TypeName("extractEulerianParticles")
Runtime type information.
virtual void collectParticle(const scalar time, const label regioni)
Collect particles that have passed through the faceZone.
labelList patchFaceIDs_
Patch face indices where faceZone face intersect patch.
extractEulerianParticles(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
virtual ~extractEulerianParticles()=default
Destructor.
injectedParticleCloud cloud_
Storage for collected particles.
Map< label > regionToParticleMap_
Map from region to index in particles_ list.
labelList regions0_
Region indices in faceZone faces from last iteration.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
word phiName_
Name of the flux field, default ="rho".
word rhoName_
Name of the density field, default = rho.
List< eulerianParticle > particles_
Particle properties (partial, being accumulated).
virtual void initialiseBins()
Initialise the particle collection bins.
virtual void checkFaceZone()
Check that the faceZone is valid.
labelList fineToCoarseAddr_
Agglomeration addressing from fine to coarse (local proc only).
virtual bool execute()
Execute the function-object operations.
extractEulerianParticles(const extractEulerianParticles &)=delete
No copy construct.
void operator=(const extractEulerianParticles &)=delete
No copy assignment.
virtual bool write()
Write the function-object results.
labelList patchIDs_
Patch indices where faceZone face intersect patch.
virtual void calculateAddressing(const label nRegionsNew, const scalar time, labelList &regionFaceIDs)
Calculate the addressing between regions between iterations Returns the number of active regions (par...
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const Time & time() const
Return time database.
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
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
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.
List< label > labelList
A List of labels.
Definition List.H:62
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
List< bool > boolList
A List of bools.
Definition List.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
Macros to ease declaration of run-time selection tables.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68