MPPICParcel.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) 2013-2017 OpenFOAM Foundation
9 Copyright (C) 2016-2019 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::MPPICParcel
29
30Group
31 grpLagrangianIntermediateParcels
32
33Description
34 Wrapper around kinematic parcel types to add MPPIC modelling
35
36SourceFiles
37 MPPICParcelI.H
38 MPPICParcelTrackingDataI.H
39 MPPICParcel.C
40 MPPICParcelIO.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef MPPICParcel_H
45#define MPPICParcel_H
46
47#include "particle.H"
48#include "labelFieldIOField.H"
49#include "vectorFieldIOField.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56// Forward declaration of classes
57
58template<class ParcelType>
59class MPPICParcel;
60
61template<class Type>
62class AveragingMethod;
63
64// Forward declaration of friend functions
65
66template<class ParcelType>
67Ostream& operator<<
68(
69 Ostream&,
71);
72
73/*---------------------------------------------------------------------------*\
74 Class MPPICParcel Declaration
75\*---------------------------------------------------------------------------*/
76
77template<class ParcelType>
78class MPPICParcel
79:
80 public ParcelType
81{
82public:
83
84 //- Size in bytes of the fields
85 static const std::size_t sizeofFields;
86
88 class trackingData
89 :
91 {
92
93 public:
95 enum trackPart
96 {
101 };
102
103
104 private:
105
106 // Private data
107
108 // MPPIC Averages
109
110 //- Volume average
111 autoPtr<AveragingMethod<scalar>> volumeAverage_;
112
113 //- Radius average [ volume^(1/3) ]
114 autoPtr<AveragingMethod<scalar>> radiusAverage_;
115
116 //- Density average
118
119 //- Velocity average
121
122 //- Magnitude velocity squared average
124
125 //- Frequency average
126 autoPtr<AveragingMethod<scalar>> frequencyAverage_;
127
128 //- Mass average
130
131
132 //- Label specifying the current part of the tracking process
133 trackPart part_;
134
135
136 public:
137
138 //- Constructors
139
140 //- Construct from components
141 template<class TrackCloudType>
142 inline trackingData
143 (
144 const TrackCloudType& cloud,
146 );
147
148
149 //- Update the MPPIC averages
150 template<class TrackCloudType>
151 inline void updateAverages(const TrackCloudType& cloud);
152
153
154 //- Access
155
156 //- Const access to the tracking part label
157 inline trackPart part() const;
158
159 //- Non const access to the tracking part label
160 inline trackPart& part();
161 };
162
163
164protected:
165
166 // Protected data
167
168 //- Velocity correction due to collisions [m/s]
170
171
172public:
173
174 // Static data members
175
176 //- Runtime type information
177 TypeName("MPPICParcel");
178
179 //- String representation of properties
181 (
182 ParcelType,
183 " (UCorrectx UCorrecty UCorrectz)"
184 );
185
186
187 // Constructors
188
189 //- Construct from mesh, coordinates and topology
190 // Other properties initialised as null
191 inline MPPICParcel
192 (
193 const polyMesh& mesh,
195 const label celli,
196 const label tetFacei,
197 const label tetPti
198 );
199
200 //- Construct from a position and a cell, searching for the rest of the
201 // required topology. Other properties are initialised as null.
202 inline MPPICParcel
203 (
204 const polyMesh& mesh,
205 const vector& position,
206 const label celli
207 );
208
209 //- Construct from components
210 inline MPPICParcel
211 (
212 const polyMesh& mesh,
214 const label celli,
215 const label tetFacei,
216 const label tetPti,
217 const label typeId,
218 const scalar nParticle0,
219 const scalar d0,
220 const scalar dTarget0,
221 const vector& U0,
222 const vector& UCorrect0,
223 const typename ParcelType::constantProperties& constProps
224 );
225
226 //- Construct from Istream
228 (
229 const polyMesh& mesh,
230 Istream& is,
231 bool readFields = true,
232 bool newFormat = true
233 );
234
235 //- Construct as a copy
236 MPPICParcel(const MPPICParcel& p);
237
238 //- Construct as a copy
239 MPPICParcel(const MPPICParcel& p, const polyMesh& mesh);
240
241 //- Construct and return a (basic particle) clone
242 virtual autoPtr<particle> clone() const
243 {
244 return autoPtr<particle>(new MPPICParcel(*this));
245 }
246
247 //- Construct and return a (basic particle) clone
248 virtual autoPtr<particle> clone(const polyMesh& mesh) const
249 {
250 return autoPtr<particle>(new MPPICParcel(*this, mesh));
251 }
252
253 //- Factory class to read-construct particles used for
254 // parallel transfer
255 class iNew
256 {
257 const polyMesh& mesh_;
258
259 public:
261 iNew(const polyMesh& mesh)
262 :
263 mesh_(mesh)
264 {}
267 {
269 (
270 new MPPICParcel<ParcelType>(mesh_, is, true)
271 );
272 }
273 };
274
275
276 // Member Functions
277
278 // Access
279
280 //- Return const access to correction velocity
281 inline const vector& UCorrect() const;
282
283 //- Return access to correction velocity
284 inline vector& UCorrect();
285
286
287 // Tracking
288
289 //- Move the parcel
290 template<class TrackCloudType>
291 bool move
292 (
293 TrackCloudType& cloud,
294 trackingData& td,
295 const scalar trackTime
296 );
297
298
299 // Friend Functions
300
301 // I-O
302
303 //- Read
304 template<class CloudType>
305 static void readFields(CloudType& c);
306
307 //- Write
308 template<class CloudType>
309 static void writeFields(const CloudType& c);
310
311 //- Write individual parcel properties to stream
312 void writeProperties
313 (
314 Ostream& os,
315 const wordRes& filters,
316 const word& delim,
317 const bool namesOnly = false
318 ) const;
319
320 //- Read particle fields as objects from the obr registry
321 template<class CloudType>
322 static void readObjects(CloudType& c, const objectRegistry& obr);
323
324 //- Write particle fields as objects into the obr registry
325 template<class CloudType>
326 static void writeObjects(const CloudType& c, objectRegistry& obr);
327
328
329 // Ostream operator
331 friend Ostream& operator<< <ParcelType>
332 (
333 Ostream&,
335 );
336};
337
338
339// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340
341} // End namespace Foam
342
343// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
344
345#include "MPPICParcelI.H"
347
348// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
349
350#ifdef NoRepository
351 #include "MPPICParcel.C"
352#endif
353
354// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355
356#endif
357
358// ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Factory class to read-construct particles used for.
Definition: MPPICParcel.H:255
iNew(const polyMesh &mesh)
Definition: MPPICParcel.H:260
autoPtr< MPPICParcel< ParcelType > > operator()(Istream &is) const
Definition: MPPICParcel.H:265
void updateAverages(const TrackCloudType &cloud)
Update the MPPIC averages.
Wrapper around kinematic parcel types to add MPPIC modelling.
Definition: MPPICParcel.H:80
const vector & UCorrect() const
Return const access to correction velocity.
Definition: MPPICParcelI.H:96
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Construct and return a (basic particle) clone.
Definition: MPPICParcel.H:247
MPPICParcel(const MPPICParcel &p, const polyMesh &mesh)
Construct as a copy.
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
AddToPropertyList(ParcelType, " (UCorrectx UCorrecty UCorrectz)")
String representation of properties.
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
Definition: MPPICParcel.H:241
static const std::size_t sizeofFields
Size in bytes of the fields.
Definition: MPPICParcel.H:84
MPPICParcel(const MPPICParcel &p)
Construct as a copy.
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
static void writeFields(const CloudType &c)
Write.
vector UCorrect_
Velocity correction due to collisions [m/s].
Definition: MPPICParcel.H:168
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
Definition: MPPICParcel.C:60
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
static void readFields(CloudType &c)
Read.
Definition: MPPICParcelIO.C:89
TypeName("MPPICParcel")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Class used to pass data into container.
Registry of regIOobjects.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
#define AddToPropertyList(ParcelType, str)
Add to existing static 'propertyList' for particle properties.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73