Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
lagrangian
dsmc
parcels
Templates
DsmcParcel_
DsmcParcel_.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 | Copyright (C) 2009-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::DsmcParcel
26
27
Description
28
DSMC parcel class
29
30
SourceFiles
31
DsmcParcelI.H
32
DsmcParcel.C
33
DsmcParcelIO.C
34
35
\*---------------------------------------------------------------------------*/
36
37
#ifndef DsmcParcel_H
38
#define DsmcParcel_H
39
40
#include <
lagrangian/Particle.H
>
41
#include <
OpenFOAM/IOstream.H
>
42
#include <
OpenFOAM/autoPtr.H
>
43
#include <
OpenFOAM/contiguous.H
>
44
45
#include <
dsmc/DsmcCloud_.H
>
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49
namespace
Foam
50
{
51
52
template
<
class
ParcelType>
53
class
DsmcParcel;
54
55
// Forward declaration of friend functions
56
57
template
<
class
ParcelType>
58
Ostream&
operator
<<
59
(
60
Ostream&,
61
const
DsmcParcel<ParcelType>&
62
);
63
64
/*---------------------------------------------------------------------------*\
65
Class DsmcParcel Declaration
66
\*---------------------------------------------------------------------------*/
67
68
template
<
class
ParcelType>
69
class
DsmcParcel
70
:
71
public
Particle
<ParcelType>
72
{
73
public
:
74
75
//- Class to hold DSMC particle constant properties
76
class
constantProperties
77
{
78
// Private data
79
80
//- Particle mass [kg] (constant)
81
scalar mass_;
82
83
//- Particle hard sphere diameter [m] (constant)
84
scalar d_;
85
86
//- Internal degrees of freedom
87
scalar internalDegreesOfFreedom_;
88
89
//- Viscosity index
90
scalar omega_;
91
92
93
public
:
94
95
// Constrcutors
96
97
//- Null constructor, allows List of constantProperties to be
98
// created before the contents is initialised
99
inline
constantProperties
();
100
101
//- Constructor from dictionary
102
inline
constantProperties
(
const
dictionary
& dict);
103
104
105
// Member functions
106
107
//- Return const access to the particle density
108
inline
scalar
mass
()
const
;
109
110
//- Return const access to the minimum particle mass
111
inline
scalar
d
()
const
;
112
113
//- Return the reference total collision cross section
114
inline
scalar
sigmaT
()
const
;
115
116
//- Return the internalDegreesOfFreedom
117
inline
scalar
internalDegreesOfFreedom
()
const
;
118
119
//- Return the viscosity index
120
inline
scalar
omega
()
const
;
121
122
};
123
124
125
//- Class used to pass kinematic tracking data to the trackToFace function
126
class
trackData
127
:
128
public
Particle
<ParcelType>
::trackData
129
{
130
// Private data
131
132
//- Reference to the cloud containing this particle
133
DsmcCloud<ParcelType>
& cloud_;
134
135
136
public
:
137
138
// Constructors
139
140
//- Construct from components
141
inline
trackData
142
(
143
DsmcCloud<ParcelType>
&
cloud
144
);
145
146
147
// Member functions
148
149
//- Return access to the owner cloud
150
inline
DsmcCloud<ParcelType>
&
cloud
();
151
};
152
153
154
protected
:
155
156
// Protected member data
157
158
// Parcel properties
159
160
//- Velocity of Parcel [m/s]
161
vector
U_
;
162
163
//- Internal energy of the Parcel, covering all non-translational
164
// degrees of freedom [J]
165
scalar
Ei_
;
166
167
//- Parcel type id
168
label
typeId_
;
169
170
171
public
:
172
173
//- Runtime type information
174
TypeName
(
"DsmcParcel"
);
175
176
friend
class
Cloud
<ParcelType>;
177
178
179
// Constructors
180
181
//- Construct from components
182
inline
DsmcParcel
183
(
184
DsmcCloud<ParcelType>
& owner,
185
const
vector
&
position
,
186
const
vector
&
U
,
187
const
scalar
Ei
,
188
const
label celli,
189
const
label
typeId
190
);
191
192
//- Construct from Istream
193
DsmcParcel
194
(
195
const
Cloud<ParcelType>
& c,
196
Istream
& is,
197
bool
readFields
=
true
198
);
199
200
//- Construct and return a clone
201
autoPtr<ParcelType>
clone
()
const
202
{
203
return
autoPtr<ParcelType>
(
new
DsmcParcel<ParcelType>
(*this));
204
}
205
206
207
// Member Functions
208
209
// Access
210
211
//- Return type id
212
inline
label
typeId
()
const
;
213
214
//- Return const access to velocity
215
inline
const
vector
&
U
()
const
;
216
217
//- Return const access to internal energy
218
inline
scalar
Ei
()
const
;
219
220
// Edit
221
222
//- Return access to velocity
223
inline
vector
&
U
();
224
225
//- Return access to internal energy
226
inline
scalar&
Ei
();
227
228
229
// Main calculation loop
230
231
// Tracking
232
233
//- Move the parcel
234
template
<
class
TrackData>
235
bool
move
(TrackData& td);
236
237
238
// Patch interactions
239
240
//- Overridable function to handle the particle hitting a patch
241
// Executed before other patch-hitting functions
242
template
<
class
TrackData>
243
bool
hitPatch
244
(
245
const
polyPatch
&,
246
TrackData& td,
247
const
label patchI
248
);
249
250
//- Overridable function to handle the particle hitting a
251
// processorPatch
252
template
<
class
TrackData>
253
void
hitProcessorPatch
254
(
255
const
processorPolyPatch
&,
256
TrackData& td
257
);
258
259
//- Overridable function to handle the particle hitting a
260
// processorPatch without trackData
261
void
hitProcessorPatch
262
(
263
const
processorPolyPatch
&,
264
int
&
265
);
266
267
//- Overridable function to handle the particle hitting a wallPatch
268
template
<
class
TrackData>
269
void
hitWallPatch
270
(
271
const
wallPolyPatch
&,
272
TrackData& td
273
);
274
275
//- Overridable function to handle the particle hitting a wallPatch
276
// without trackData
277
void
hitWallPatch
278
(
279
const
wallPolyPatch
&,
280
int
&
281
);
282
283
//- Overridable function to handle the particle hitting a polyPatch
284
template
<
class
TrackData>
285
void
hitPatch
286
(
287
const
polyPatch
&,
288
TrackData& td
289
);
290
291
//- Overridable function to handle the particle hitting a polyPatch
292
//- without trackData
293
void
hitPatch
294
(
295
const
polyPatch
&,
296
int
&
297
);
298
299
//- Transform the physical properties of the particle
300
// according to the given transformation tensor
301
void
transformProperties
(
const
tensor
&
T
);
302
303
//- Transform the physical properties of the particle
304
// according to the given separation vector
305
void
transformProperties
(
const
vector
& separation);
306
307
308
// I-O
309
310
static
void
readFields
(
Cloud<ParcelType>
& c);
311
312
static
void
writeFields
(
const
Cloud<ParcelType>
& c);
313
314
315
// Ostream Operator
316
317
friend
Ostream
& operator<< <ParcelType>
318
(
319
Ostream
&,
320
const
DsmcParcel<ParcelType>
&
321
);
322
};
323
324
325
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326
327
}
// End namespace Foam
328
329
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330
331
#include "
DsmcParcelI_.H
"
332
333
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334
335
#define defineParcelTypeNameAndDebug(Type, DebugSwitch) \
336
template<> \
337
const Foam::word DsmcParcel<Type>::typeName(#Type); \
338
template<> \
339
int DsmcParcel<Type>::debug \
340
( \
341
Foam::debug::debugSwitch(#Type, DebugSwitch) \
342
);
343
344
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
345
346
#ifdef NoRepository
347
#include "
DsmcParcel_.C
"
348
#endif
349
350
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351
352
#endif
353
354
// ************************ vim: set sw=4 sts=4 et: ************************ //
355