Added measurement of surface values of velocity and temperature to allow slip
[OpenFOAM-1.6.x.git] / src / lagrangian / dsmc / parcels / Templates / DsmcParcel / DsmcParcel.H
blobd96d51584344609f421672f2f9e128450c3f7a5a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::DsmcParcel
28 Description
29     DSMC parcel class
31 SourceFiles
32     DsmcParcelI.H
33     DsmcParcel.C
34     DsmcParcelIO.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef DsmcParcel_H
39 #define DsmcParcel_H
41 #include "Particle.H"
42 #include "IOstream.H"
43 #include "autoPtr.H"
44 #include "contiguous.H"
46 #include "DsmcCloud.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 template<class ParcelType>
54 class DsmcParcel;
56 // Forward declaration of friend functions
58 template<class ParcelType>
59 Ostream& operator<<
61     Ostream&,
62     const DsmcParcel<ParcelType>&
65 /*---------------------------------------------------------------------------*\
66                          Class DsmcParcel Declaration
67 \*---------------------------------------------------------------------------*/
69 template<class ParcelType>
70 class DsmcParcel
72     public Particle<ParcelType>
74 public:
76     //- Class to hold DSMC particle constant properties
77     class constantProperties
78     {
79         // Private data
81             //- Particle mass [kg] (constant)
82             scalar mass_;
84             //- Particle hard sphere diameter [m] (constant)
85             scalar d_;
87             //- Internal degrees of freedom
88             scalar internalDegreesOfFreedom_;
90             //- Viscosity index
91             scalar omega_;
94     public:
96         // Constrcutors
98             //- Null constructor, allows List of constantProperties to be
99             //  created before the contents is initialised
100             inline constantProperties();
102             //- Constructor from dictionary
103             inline constantProperties(const dictionary& dict);
106         // Member functions
108             //- Return const access to the particle density
109             inline scalar mass() const;
111             //- Return const access to the minimum particle mass
112             inline scalar d() const;
114             //- Return the reference total collision cross section
115             inline scalar sigmaT() const;
117             //- Return the internalDegreesOfFreedom
118             inline scalar internalDegreesOfFreedom() const;
120             //- Return the viscosity index
121             inline scalar omega() const;
123     };
126     //- Class used to pass kinematic tracking data to the trackToFace function
127     class trackData
128     :
129         public Particle<ParcelType>::trackData
130     {
131         // Private data
133             //- Reference to the cloud containing this particle
134             DsmcCloud<ParcelType>& cloud_;
137     public:
139         // Constructors
141             //- Construct from components
142             inline trackData
143             (
144                 DsmcCloud<ParcelType>& cloud
145             );
148         // Member functions
150             //- Return access to the owner cloud
151             inline DsmcCloud<ParcelType>& cloud();
152     };
155 protected:
157     // Protected member data
159         // Parcel properties
161             //- Velocity of Parcel [m/s]
162             vector U_;
164             //- Internal energy of the Parcel, covering all non-translational
165             // degrees of freedom [J]
166             scalar Ei_;
168             //- Parcel type id
169             label typeId_;
172 public:
174     //- Runtime type information
175     TypeName("DsmcParcel");
177     friend class Cloud<ParcelType>;
180     // Constructors
182         //- Construct from components
183         inline DsmcParcel
184         (
185             DsmcCloud<ParcelType>& owner,
186             const vector& position,
187             const vector& U,
188             const scalar Ei,
189             const label celli,
190             const label typeId
191         );
193         //- Construct from Istream
194         DsmcParcel
195         (
196             const Cloud<ParcelType>& c,
197             Istream& is,
198             bool readFields = true
199         );
201         //- Construct and return a clone
202         autoPtr<ParcelType> clone() const
203         {
204             return autoPtr<ParcelType>(new DsmcParcel<ParcelType>(*this));
205         }
208     // Member Functions
210         // Access
212             //- Return type id
213             inline label typeId() const;
215             //- Return const access to velocity
216             inline const vector& U() const;
218             //- Return const access to internal energy
219             inline scalar Ei() const;
221         // Edit
223             //- Return access to velocity
224             inline vector& U();
226             //- Return access to internal energy
227             inline scalar& Ei();
230         // Main calculation loop
232             // Tracking
234                 //- Move the parcel
235                 template<class TrackData>
236                 bool move(TrackData& td);
239         // Patch interactions
241             //- Overridable function to handle the particle hitting a patch
242             //  Executed before other patch-hitting functions
243             template<class TrackData>
244             bool hitPatch
245             (
246                 const polyPatch&,
247                 TrackData& td,
248                 const label patchI
249             );
251             //- Overridable function to handle the particle hitting a
252             //  processorPatch
253             template<class TrackData>
254             void hitProcessorPatch
255             (
256                 const processorPolyPatch&,
257                 TrackData& td
258             );
260             //- Overridable function to handle the particle hitting a
261             //  processorPatch without trackData
262             void hitProcessorPatch
263             (
264                 const processorPolyPatch&,
265                 int&
266             );
268             //- Overridable function to handle the particle hitting a wallPatch
269             template<class TrackData>
270             void hitWallPatch
271             (
272                 const wallPolyPatch&,
273                 TrackData& td
274             );
276             //- Overridable function to handle the particle hitting a wallPatch
277             //  without trackData
278             void hitWallPatch
279             (
280                 const wallPolyPatch&,
281                 int&
282             );
284             //- Overridable function to handle the particle hitting a polyPatch
285             template<class TrackData>
286             void hitPatch
287             (
288                 const polyPatch&,
289                 TrackData& td
290             );
292             //- Overridable function to handle the particle hitting a polyPatch
293             //- without trackData
294             void hitPatch
295             (
296                 const polyPatch&,
297                 int&
298             );
300             //- Transform the physical properties of the particle
301             //  according to the given transformation tensor
302             void transformProperties(const tensor& T);
304             //- Transform the physical properties of the particle
305             //  according to the given separation vector
306             void transformProperties(const vector& separation);
309         // I-O
311             static void readFields(DsmcCloud<ParcelType>& c);
313             static void writeFields(const DsmcCloud<ParcelType>& c);
316     // Ostream Operator
318         friend Ostream& operator<< <ParcelType>
319         (
320             Ostream&,
321             const DsmcParcel<ParcelType>&
322         );
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328 } // End namespace Foam
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332 #include "DsmcParcelI.H"
334 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
336 #define defineParcelTypeNameAndDebug(Type, DebugSwitch)                       \
337     template<>                                                                \
338     const Foam::word DsmcParcel<Type>::typeName(#Type);                       \
339     template<>                                                                \
340     int DsmcParcel<Type>::debug                                               \
341     (                                                                         \
342         Foam::debug::debugSwitch(#Type, DebugSwitch)                          \
343     );
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
347 #ifdef NoRepository
348     #include "DsmcParcel.C"
349 #endif
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
353 #endif
355 // ************************************************************************* //