Loading...
Searching...
No Matches
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-2024 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>
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
87
88 class trackingData
89 :
90 public ParcelType::trackingData
91 {
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
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 );
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
240
241 //- Return a (basic particle) clone
242 virtual autoPtr<particle> clone() const
243 {
244 return particle::Clone(*this);
245 }
246
247 //- Return a (basic particle) clone
248 virtual autoPtr<particle> clone(const polyMesh& mesh) const
250 return particle::Clone(*this, mesh);
251 }
252
253 //- Factory class to read-construct particles (for parallel transfer)
254 class iNew
255 {
256 const polyMesh& mesh_;
257
258 public:
259
260 iNew(const polyMesh& mesh)
261 :
262 mesh_(mesh)
263 {}
264
265 autoPtr<MPPICParcel<ParcelType>> operator()(Istream& is) const
266 {
267 return autoPtr<MPPICParcel<ParcelType>>
269 new MPPICParcel<ParcelType>(mesh_, is, true)
270 );
271 }
272 };
273
274
275 // Member Functions
276
277 // Access
278
279 //- Return const access to correction velocity
280 inline const vector& UCorrect() const;
281
282 //- Return access to correction velocity
283 inline vector& UCorrect();
285
286 // Tracking
287
288 //- Move the parcel
289 template<class TrackCloudType>
290 bool move
291 (
292 TrackCloudType& cloud,
293 trackingData& td,
294 const scalar trackTime
295 );
296
298 // Friend Functions
299
300 // I-O
301
302 //- Read
303 template<class CloudType>
304 static void readFields(CloudType& c);
306 //- Write
307 template<class CloudType>
308 static void writeFields(const CloudType& c);
309
310 //- Write individual parcel properties to stream
312 (
313 Ostream& os,
314 const wordRes& filters,
315 const word& delim,
316 const bool namesOnly = false
317 ) const;
318
319 //- Read particle fields as objects from the obr registry
320 template<class CloudType>
321 static void readObjects(CloudType& c, const objectRegistry& obr);
322
323 //- Write particle fields as objects into the obr registry
324 template<class CloudType>
325 static void writeObjects(const CloudType& c, objectRegistry& obr);
326
327
328 // Ostream operator
329
330 friend Ostream& operator<< <ParcelType>
331 (
332 Ostream&,
334 );
335};
336
337
338// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
339
340} // End namespace Foam
341
342// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343
344#include "MPPICParcelI.H"
346
347// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348
349#ifdef NoRepository
350 #include "MPPICParcel.C"
351#endif
352
353// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354
355#endif
356
357// ************************************************************************* //
Base class for lagrangian averaging methods.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
iNew(const polyMesh &mesh)
autoPtr< MPPICParcel< ParcelType > > operator()(Istream &is) const
trackingData(const TrackCloudType &cloud, trackPart part=tpLinearTrack)
Constructors.
void updateAverages(const TrackCloudType &cloud)
Update the MPPIC averages.
Wrapper around kinematic parcel types to add MPPIC modelling.
Definition MPPICParcel.H:76
const vector & UCorrect() const
Return const access to correction velocity.
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Return a (basic particle) clone.
vector & UCorrect()
Return access to correction velocity.
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
Return a (basic particle) clone.
MPPICParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const label typeId, const scalar nParticle0, const scalar d0, const scalar dTarget0, const vector &U0, const vector &UCorrect0, const typename ParcelType::constantProperties &constProps)
Construct from components.
MPPICParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
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.
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
Definition MPPICParcel.C:53
MPPICParcel(const polyMesh &mesh, Istream &is, bool readFields=true, bool newFormat=true)
Construct from Istream.
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
TypeName("MPPICParcel")
Runtime type information.
MPPICParcel(const polyMesh &mesh, const vector &position, const label celli)
Construct from a position and a cell, searching for the rest of the.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
Registry of regIOobjects.
vector position() const
Return current particle position.
Definition particleI.H:283
static autoPtr< particle > Clone(const Derived &p)
Clone a particle.
Definition particle.H:552
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition particleI.H:110
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition particleI.H:116
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
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
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
DSMCCloud< dsmcParcel > CloudType
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
Definition barycentric.H:45
Vector< scalar > vector
Definition vector.H:57
#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:68