Loading...
Searching...
No Matches
ParticlePostProcessing.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::ParticlePostProcessing
29
30Description
31 Writes out various standard Lagrangian data elements of
32 particles hitting on a given list of 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 columns depending on the \c fields entry.
43
44Usage
45 Minimal example by using
46 \c constant/reactingCloud1Properties.cloudFunctions:
47 \verbatim
48 ParticlePostProcessing1
49 {
50 // Mandatory entries
51 type particlePostProcessing;
52 maxStoredParcels <scalar>;
53
54 // Optional entries
55 fields (<wordRes>);
56
57 // Conditional entries
58
59 // Option-1
60 patches (<wordRes>);
61
62 // Option-2
63 faceZones (<wordRes>);
64
65 // Inherited entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Reqd | Deflt
73 type | Type name: particlePostProcessing | word | yes | -
74 maxStoredParcels | Maximum number of parcels to process | label | yes | -
75 fields | Names of standard Lagrangian fields | wordRes | no | all
76 patches | Names of operand patches | wordRes | choice | -
77 faceZones | Names of operand face zones | wordRes | choice | -
78 \endtable
79
80 The inherited entries are elaborated in:
81 - \link CloudFunctionObject.H \endlink
82 - \link writeFile.H \endlink
83
84Note
85 - The underlying type of \c maxStoredParcels is set as a scalar for I/O.
86 - Empty files indicate that no particles hit selected surfaces.
87
88SourceFiles
89 ParticlePostProcessing.C
90
91\*---------------------------------------------------------------------------*/
92
93#ifndef Foam_ParticlePostProcessing_H
94#define Foam_ParticlePostProcessing_H
95
96#include "CloudFunctionObject.H"
97#include "writeFile.H"
99
100// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
102namespace Foam
103{
104
105/*---------------------------------------------------------------------------*\
106 Class ParticlePostProcessing Declaration
107\*---------------------------------------------------------------------------*/
108
109template<class CloudType>
111:
112 public CloudFunctionObject<CloudType>,
114{
115 // Private Data
116
117 // Typedefs
118
119 //- Convenience typedef for parcel type
120 typedef typename CloudType::particleType parcelType;
121
122 //- Collector surfaces
123 cloudFunctionObjectTools::collector collector_;
124
125 //- Maximum number of parcels to store - set as a scalar for I/O
126 scalar maxStoredParcels_;
127
128 //- Field header
129 string header_;
130
131 //- Field name filters
132 wordRes fields_;
133
134 //- List of times for each data record
135 List<DynamicList<scalar>> times_;
136
137 //- List of output data per surface
138 List<DynamicList<string>> data_;
139
140
141 // Private Member Functions
142
143 //- Write output file header
144 void writeFileHeader(Ostream& os) const;
145
146
147public:
148
149 //- Runtime type information
150 TypeName("particlePostProcessing");
151
152
153 // Constructors
154
155 //- Construct from dictionary
158 const dictionary& dict,
160 const word& modelName
161 );
162
163 //- Copy construct
165
166 //- No copy assignment
167 void operator=(const ParticlePostProcessing<CloudType>&) = delete;
168
169 //- Construct and return a clone
171 {
173 (
175 );
176 }
177
178
179 //- Destructor
180 virtual ~ParticlePostProcessing() = default;
181
182
183 // Member Functions
184
185 // Access
186
187 //- Return maximum number of parcels to store per surface
188 label maxStoredParcels() const noexcept { return maxStoredParcels_; }
189
190
191 // Evaluation
192
193 //- Post-patch hook
194 virtual bool postPatch
195 (
196 const parcelType& p,
197 const polyPatch& pp,
198 const typename parcelType::trackingData& td
199 );
200
201 //- Post-face hook
202 virtual bool postFace
203 (
204 const parcelType& p,
205 const typename parcelType::trackingData& td
206 );
207
208
209 // I-O
210
211 //- Write post-processing info
212 virtual void write();
213};
214
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#ifdef NoRepository
223 #include "ParticlePostProcessing.C"
224#endif
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228#endif
229
230// ************************************************************************* //
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
Writes out various standard Lagrangian data elements of particles hitting on a given list of patches ...
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
TypeName("particlePostProcessing")
Runtime type information.
void operator=(const ParticlePostProcessing< CloudType > &)=delete
No copy assignment.
ParticlePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void write()
Write post-processing info.
virtual ~ParticlePostProcessing()=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.
label maxStoredParcels() const noexcept
Return maximum number of parcels to store per surface.
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 List of wordRe with additional matching capabilities.
Definition wordRes.H:56
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
const direction noexcept
Definition scalarImpl.H:265
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68