Loading...
Searching...
No Matches
ParticleHistogram.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) 2020-2023 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::ParticleHistogram
28
29Description
30 Computes a histogram for the distribution of particle diameters
31 and corresponding number of particles hitting on a given list of
32 patches or face zones.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 input | - | -
38 output file | dat | <case>/postProcessing/<FO>/<time>/<file>
39 output field | - | -
40 \endtable
41
42 The output file contains four columns, from the first to the last:
43 \vartable
44 dEdge1 | Left bin-edge of particle diameter
45 dEdge2 | Right bin-edge of particle diameter
46 nParticles | Number of particles falling into the corresponding bin
47 nParticlesCumulative | Cumulative number of binned particles
48 \endvartable
49
50Usage
51 Minimal example by using
52 \c constant/reactingCloud1Properties.cloudFunctions:
53 \verbatim
54 particleHistogram1
55 {
56 // Mandatory entries
57 type particleHistogram;
58 nBins <label>;
59 min <scalar>;
60 max <scalar>;
61 maxStoredParcels <scalar>;
62
63 // Conditional entries
64
65 // Option-1
66 patches (<wordRes>);
67
68 // Option-2
69 faceZones (<wordRes>);
70
71 // Inherited entries
72 ...
73 }
74 \endverbatim
75
76 where the entries mean:
77 \table
78 Property | Description | Type | Reqd | Deflt
79 type | Type name: particleHistogram | word | yes | -
80 nBins | Number of histogram bins | label | yes | -
81 max | Maximum value of histogram data | scalar | yes | -
82 min | Minimum value of histogram data | scalar | yes | -
83 maxStoredParcels | Maximum number of parcels to process | label | yes | -
84 patches | Names of operand patches | wordRes | choice | -
85 faceZones | Names of operand face zones | wordRes | choice | -
86 \endtable
87
88 The inherited entries are elaborated in:
89 - \link CloudFunctionObject.H \endlink
90 - \link writeFile.H \endlink
91
92Note
93 - The underlying type of \c maxStoredParcels is set as a scalar for I/O.
94
95SourceFiles
96 ParticleHistogram.C
97
98\*---------------------------------------------------------------------------*/
99
100#ifndef Foam_ParticleHistogram_H
101#define Foam_ParticleHistogram_H
102
103#include "CloudFunctionObject.H"
104#include "writeFile.H"
105#include "MinMax.H"
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109
110namespace Foam
111{
112
113/*---------------------------------------------------------------------------*\
114 Class ParticleHistogram Declaration
115\*---------------------------------------------------------------------------*/
116
117template<class CloudType>
119:
120 public CloudFunctionObject<CloudType>,
122{
123 // Private Data
124
125 // Typedefs
126
127 //- Convenience typedef for parcel type
128 typedef typename CloudType::particleType parcelType;
129
130 //- Collector surfaces
131 cloudFunctionObjectTools::collector collector_;
132
133 //- Number of data bins
134 const label nBins_;
135
136 //- Maximum number of parcels to store - set as a scalar for I/O
137 const scalar maxStoredParcels_;
138
139 //- Min/Max value of histogram data
140 const scalarMinMax range_;
141
142 //- Bin edges of histogram
143 scalarField binEdges_;
144
145 //- Accumulated number of particles per surface
146 //- binned according to the histogram settings
147 List<scalarList> nParticlesCumulative_;
148
149 // List of surface-hit particle diameters
150 List<DynamicList<scalar>> dParticles_;
151
152 // List of number of surface-hit particles
153 List<DynamicList<scalar>> nParticles_;
154
155
156 // Private Member Functions
157
158 //- Write output file header
159 void writeFileHeader(Ostream& os) const;
160
161
162public:
163
164 //- Runtime type information
165 TypeName("particleHistogram");
166
167
168 // Constructors
169
170 //- Construct from dictionary
172 (
173 const dictionary& dict,
175 const word& modelName
176 );
177
178 //- Copy construct
180
181 //- No copy assignment
182 void operator=(const ParticleHistogram<CloudType>&) = delete;
183
184 //- Construct and return a clone
185 virtual autoPtr<CloudFunctionObject<CloudType>> clone() const
186 {
187 return autoPtr<CloudFunctionObject<CloudType>>
188 (
190 );
191 }
192
194 //- Destructor
195 virtual ~ParticleHistogram() = default;
196
197
198 // Member Functions
199
200 // Evaluation
201
202 //- Post-patch hook
203 virtual bool postPatch
204 (
205 const parcelType& p,
206 const polyPatch& pp,
207 const typename parcelType::trackingData& td
208 );
209
210 //- Post-face hook
211 virtual bool postFace
212 (
213 const parcelType& p,
214 const typename parcelType::trackingData& td
215 );
216
217
218 // I-O
219
220 //- Write post-processing info
221 virtual void write();
222};
223
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227} // End namespace Foam
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#ifdef NoRepository
233 #include "ParticleHistogram.C"
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#endif
239
240// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Templated cloud function object base class.
CloudFunctionObject(CloudType &owner)
Construct null from owner.
const CloudType & owner() const
Return const access to the owner cloud.
ParticleType particleType
Definition Cloud.H:130
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
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Computes a histogram for the distribution of particle diameters and corresponding number of particles...
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
ParticleHistogram(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
void operator=(const ParticleHistogram< CloudType > &)=delete
No copy assignment.
virtual void write()
Write post-processing info.
virtual ~ParticleHistogram()=default
Destructor.
virtual bool postFace(const parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
virtual bool postPatch(const parcelType &p, const polyPatch &pp, const typename parcelType::trackingData &td)
Post-patch hook.
TypeName("particleHistogram")
Runtime type information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Implementation of template-invariant tools for various function objects such as Foam::ParticleHistogr...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Base class for writing single files from the function objects.
Definition writeFile.H:113
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
const dictionary & dict() const
Return const access to the cloud dictionary.
const word & modelName() const
Return const access to the name of the sub-model.
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
DSMCCloud< dsmcParcel > CloudType
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition MinMax.H:97
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68