PatchParticleHistogram.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 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::PatchParticleHistogram
28
29Description
30 Computes a histogram for the distribution of particle diameters
31 and corresponding number of particles hitting on a given list of patches.
32
33 Operands:
34 \table
35 Operand | Type | Location
36 input | - | -
37 output file | dat | $FOAM_CASE/postProcessing/<FO>/<time>/<file>
38 output field | - | -
39 \endtable
40
41 The output file contains two columns, the first is the bin edges of
42 the particle diameter (i.e. \c d), and the second is the number of
43 particles whose diameter falling into the corresponding bin
44 (i.e. \c nParticles).
45
46Usage
47 Minimal example by using
48 \c constant/reactingCloud1Properties.cloudFunctions:
49 \verbatim
50 patchParticleHistogram1
51 {
52 // Mandatory entries (unmodifiable)
53 type patchParticleHistogram;
54 patches (<patch1> <patch2> ... <patchN>);
55 nBins 10;
56 min 0.1;
57 max 10.0;
58 maxStoredParcels 20;
59 }
60 \endverbatim
61
62 where the entries mean:
63 \table
64 Property | Description | Type | Reqd | Dflt
65 type | Type name: patchParticleHistogram | word | yes | -
66 patches | Names of operand patches | wordList | yes | -
67 nBins | Number of histogram bins | label | yes | -
68 max | Maximum value of histogram data | scalar | yes | -
69 min | Minimum value of histogram data | scalar | yes | -
70 maxStoredParcels | Maximum number of parcels to process | label | yes | -
71 \endtable
72
73Note
74 - The underlying type of \c maxStoredParcels is set as a scalar for I/O.
75
76SourceFiles
77 PatchParticleHistogram.C
78
79\*---------------------------------------------------------------------------*/
80
81#ifndef PatchParticleHistogram_H
82#define PatchParticleHistogram_H
83
84#include "CloudFunctionObject.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90
91/*---------------------------------------------------------------------------*\
92 Class PatchParticleHistogram Declaration
93\*---------------------------------------------------------------------------*/
94
95template<class CloudType>
96class PatchParticleHistogram
97:
98 public CloudFunctionObject<CloudType>
99{
100 // Private Data
101
102 //- Convenience typedef for parcel type
103 typedef typename CloudType::particleType parcelType;
104
105 //- Number of data bins
106 const label nBins_;
107
108 //- Minimum value of histogram data
109 const scalar min_;
110
111 //- Maximum value of histogram data
112 const scalar max_;
113
114 //- Bin width of histogram
115 const scalar delta_;
116
117 //- Maximum number of parcels to store - set as a scalar for I/O
118 const scalar maxStoredParcels_;
119
120 //- Bin edges of histogram
121 scalarField binEdges_;
122
123 //- List of patch indices to post-process
124 labelList patchIDs_;
125
126 //- Accumulated number of particles per patch
127 //- binned according to the histogram settings
128 List<List<scalar>> nParticlesCumulative_;
129
130 //- List of time for each data record
131 List<DynamicList<scalar>> times_;
132
133 // List of patch-hit particle diameters
134 List<DynamicList<scalar>> patchDiameters_;
135
136 // List of number of patch-hit particles
137 List<DynamicList<scalar>> patchParticles_;
138
139
140 // Private Member Functions
141
142 //- Return local patchi if patch is in patchIds_ list
143 label applyToPatch(const label globalPatchi) const;
144
145
146protected:
147
148 // Protected Member Functions
149
150 //- Write post-processing info
151 void write();
152
154public:
155
156 //- Runtime type information
157 TypeName("patchParticleHistogram");
158
159
160 // Constructors
161
162 //- No default construct
163 PatchParticleHistogram() = delete;
164
165 //- Construct from dictionary
167 (
168 const dictionary& dict,
170 const word& modelName
171 );
172
173 //- Copy construct
175
176 //- No copy assignment
177 void operator=(const PatchParticleHistogram<CloudType>&) = delete;
178
179 //- Construct and return a clone
181 {
183 (
185 );
186 }
187
188
189 //- Destructor
190 virtual ~PatchParticleHistogram() = default;
191
192
193 // Member Functions
194
195 // Evaluation
196
197 //- Post-patch hook
198 virtual void postPatch
199 (
200 const parcelType& p,
201 const polyPatch& pp,
202 bool& keepParticle
203 );
204};
205
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209} // End namespace Foam
210
211
212// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213
214#ifdef NoRepository
215 #include "PatchParticleHistogram.C"
216#endif
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220#endif
221
222// ************************************************************************* //
Templated cloud function object base class.
const CloudType & owner() const
Return const access to the owner cloud.
ParticleType particleType
Definition: Cloud.H:114
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
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.
TypeName("patchParticleHistogram")
Runtime type information.
void operator=(const PatchParticleHistogram< CloudType > &)=delete
No copy assignment.
virtual void postPatch(const parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
virtual ~PatchParticleHistogram()=default
Destructor.
void write()
Write post-processing info.
PatchParticleHistogram()=delete
No default construct.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73