1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
36 \*---------------------------------------------------------------------------*/
44 #include "contiguous.H"
46 #include "DsmcCloud.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 template<class ParcelType>
56 // Forward declaration of friend functions
58 template<class ParcelType>
62 const DsmcParcel<ParcelType>&
65 /*---------------------------------------------------------------------------*\
66 Class DsmcParcel Declaration
67 \*---------------------------------------------------------------------------*/
69 template<class ParcelType>
72 public Particle<ParcelType>
76 //- Class to hold DSMC particle constant properties
77 class constantProperties
81 //- Particle mass [kg] (constant)
84 //- Particle hard sphere diameter [m] (constant)
87 //- Internal degrees of freedom
88 scalar internalDegreesOfFreedom_;
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);
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;
126 //- Class used to pass kinematic tracking data to the trackToFace function
129 public Particle<ParcelType>::trackData
133 //- Reference to the cloud containing this particle
134 DsmcCloud<ParcelType>& cloud_;
141 //- Construct from components
144 DsmcCloud<ParcelType>& cloud
150 //- Return access to the owner cloud
151 inline DsmcCloud<ParcelType>& cloud();
157 // Protected member data
161 //- Velocity of Parcel [m/s]
164 //- Internal energy of the Parcel, covering all non-translational
165 // degrees of freedom [J]
174 //- Runtime type information
175 TypeName("DsmcParcel");
177 friend class Cloud<ParcelType>;
182 //- Construct from components
185 DsmcCloud<ParcelType>& owner,
186 const vector& position,
193 //- Construct from Istream
196 const Cloud<ParcelType>& c,
198 bool readFields = true
201 //- Construct and return a clone
202 autoPtr<ParcelType> clone() const
204 return autoPtr<ParcelType>(new DsmcParcel<ParcelType>(*this));
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;
223 //- Return access to velocity
226 //- Return access to internal energy
230 // Main calculation loop
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>
251 //- Overridable function to handle the particle hitting a
253 template<class TrackData>
254 void hitProcessorPatch
256 const processorPolyPatch&,
260 //- Overridable function to handle the particle hitting a
261 // processorPatch without trackData
262 void hitProcessorPatch
264 const processorPolyPatch&,
268 //- Overridable function to handle the particle hitting a wallPatch
269 template<class TrackData>
272 const wallPolyPatch&,
276 //- Overridable function to handle the particle hitting a wallPatch
280 const wallPolyPatch&,
284 //- Overridable function to handle the particle hitting a polyPatch
285 template<class TrackData>
292 //- Overridable function to handle the particle hitting a polyPatch
293 //- without trackData
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);
311 static void readFields(Cloud<ParcelType>& c);
313 static void writeFields(const Cloud<ParcelType>& c);
318 friend Ostream& operator<< <ParcelType>
321 const DsmcParcel<ParcelType>&
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328 } // End namespace Foam
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332 #include "DsmcParcelI.H"
334 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
336 #define defineParcelTypeNameAndDebug(Type, DebugSwitch) \
338 const Foam::word DsmcParcel<Type>::typeName(#Type); \
340 int DsmcParcel<Type>::debug \
342 Foam::debug::debugSwitch(#Type, DebugSwitch) \
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348 #include "DsmcParcel.C"
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355 // ************************************************************************* //