initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / parcels / Templates / ThermoParcel / ThermoParcel.H
blobc11fecd11dc9166cfe5f1753686cf6bcd6030132
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-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::ThermoParcel
28 Description
29     Thermodynamic parcel class with one/two-way coupling with the continuous
30     phase. Includes Kinematic parcel sub-models, plus:
31     - heat transfer
33 SourceFiles
34     ThermoParcelI.H
35     ThermoParcel.C
36     ThermoParcelIO.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef ThermoParcel_H
41 #define ThermoParcel_H
43 #include "IOstream.H"
44 #include "autoPtr.H"
45 #include "interpolationCellPoint.H"
46 #include "contiguous.H"
48 #include "KinematicParcel.H"
49 #include "ThermoCloud.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 template<class ParcelType>
57 class ThermoParcel;
59 template<class ParcelType>
60 Ostream& operator<<
62     Ostream&,
63     const ThermoParcel<ParcelType>&
66 /*---------------------------------------------------------------------------*\
67                        Class ThermoParcel Declaration
68 \*---------------------------------------------------------------------------*/
70 template<class ParcelType>
71 class ThermoParcel
73     public KinematicParcel<ParcelType>
75 public:
77     //- Class to hold thermo particle constant properties
78     class constantProperties
79     :
80         public KinematicParcel<ParcelType>::constantProperties
81     {
83         // Private data
85             //- Particle initial temperature [K]
86             const scalar T0_;
88             //- Minimum temperature [K]
89             const scalar TMin_;
91             //- Particle specific heat capacity [J/(kg.K)]
92             const scalar cp0_;
94             //- Particle emissivity [] (radiation)
95             const scalar epsilon0_;
97             //- Particle scattering factor [] (radiation)
98             const scalar f0_;
101     public:
103         // Constructors
104         constantProperties(const dictionary& parentDict);
106         // Member functions
108             // Access
110                 //- Return const access to the particle initial temperature [K]
111                 inline scalar T0() const;
113                 //- Return const access to minimum temperature [K]
114                 inline scalar TMin() const;
116                 //- Return const access to the particle specific heat capacity
117                 //  [J/(kg.K)]
118                 inline scalar cp0() const;
120                 //- Return const access to the particle emissivity []
121                 //  Active for radiation only
122                 inline scalar epsilon0() const;
124                 //- Return const access to the particle scattering factor []
125                 //  Active for radiation only
126                 inline scalar f0() const;
127     };
130     //- Class used to pass thermo tracking data to the trackToFace function
131     class trackData
132     :
133         public KinematicParcel<ParcelType>::trackData
134     {
136         // Private data
138             //- Reference to the cloud containing this particle
139             ThermoCloud<ParcelType>& cloud_;
141             //- Particle constant properties
142             const constantProperties& constProps_;
144             // Interpolators for continuous phase fields
146                 //- Temperature field interpolator
147                 const interpolation<scalar>& TInterp_;
149                 //- Specific heat capacity field interpolator
150                 const interpolation<scalar>& cpInterp_;
153     public:
155         // Constructors
157             //- Construct from components
158             inline trackData
159             (
160                 ThermoCloud<ParcelType>& cloud,
161                 const constantProperties& constProps,
162                 const interpolation<scalar>& rhoInterp,
163                 const interpolation<vector>& UInterp,
164                 const interpolation<scalar>& muInterp,
165                 const interpolation<scalar>& TInterp,
166                 const interpolation<scalar>& cpInterp,
167                 const vector& g
168             );
171         // Member functions
173             //- Return access to the owner cloud
174             inline ThermoCloud<ParcelType>& cloud();
176             //- Return const access to the owner cloud
177             inline const constantProperties& constProps() const;
179             //- Return const access to the interpolator for continuous
180             //  phase temperature field
181             inline const interpolation<scalar>& TInterp() const;
183             //- Return const access to the interpolator for continuous
184             //  phase specific heat capacity field
185             inline const interpolation<scalar>& cpInterp() const;
186     };
189 protected:
191     // Protected data
193         // Parcel properties
195             //- Temperature [K]
196             scalar T_;
198             //- Specific heat capacity [J/(kg.K)]
199             scalar cp_;
202         // Cell-based quantities
204             //- Temperature [K]
205             scalar Tc_;
207             //- Specific heat capacity [J/(kg.K)]
208             scalar cpc_;
211     // Protected member functions
213         //- Calculate new particle temperature
214         template<class TrackData>
215         scalar calcHeatTransfer
216         (
217             TrackData& td,
218             const scalar dt,           // timestep
219             const label cellI,         // owner cell
220             const scalar d,            // diameter
221             const vector& U,           // velocity
222             const scalar rho,          // density
223             const scalar T,            // temperature
224             const scalar cp,           // specific heat capacity
225             const scalar Sh,           // explicit particle enthalpy source
226             scalar& dhsTrans           // sensible enthalpy transfer to carrier
227         );
230 public:
232     // Static data members
234         //- String representation of properties
235         static string propHeader;
237         //- Runtime type information
238         TypeName("ThermoParcel");
241     friend class Cloud<ParcelType>;
244     // Constructors
246         //- Construct from owner, position, and cloud owner
247         //  Other properties initialised as null
248         inline ThermoParcel
249         (
250             ThermoCloud<ParcelType>& owner,
251             const vector& position,
252             const label cellI
253         );
255         //- Construct from components
256         inline ThermoParcel
257         (
258             ThermoCloud<ParcelType>& owner,
259             const vector& position,
260             const label cellI,
261             const label typeId,
262             const scalar nParticle0,
263             const scalar d0,
264             const vector& U0,
265             const constantProperties& constProps
266         );
268         //- Construct from Istream
269         ThermoParcel
270         (
271             const Cloud<ParcelType>& c,
272             Istream& is,
273             bool readFields = true
274         );
276         //- Construct as a copy
277         ThermoParcel(const ThermoParcel& p);
279         //- Construct and return a clone
280         autoPtr<ThermoParcel> clone() const
281         {
282             return autoPtr<ThermoParcel>(new ThermoParcel(*this));
283         }
286     // Member Functions
288         // Access
290             //- Return const access to temperature
291             inline scalar T() const;
293             //- Return const access to specific heat capacity
294             inline scalar cp() const;
297         // Edit
299             //- Return access to temperature
300             inline scalar& T();
302             //- Return access to specific heat capacity
303             inline scalar& cp();
306         // Main calculation loop
308             //- Set cell values
309             template<class TrackData>
310             void setCellValues
311             (
312                 TrackData& td,
313                 const scalar dt,
314                 const label cellI
315             );
317             //- Correct cell values using latest transfer information
318             template<class TrackData>
319             void cellValueSourceCorrection
320             (
321                 TrackData& td,
322                 const scalar dt,
323                 const label cellI
324             );
326             //- Update parcel properties over the time interval
327             template<class TrackData>
328             void calc
329             (
330                 TrackData& td,
331                 const scalar dt,
332                 const label cellI
333             );
336         // I-O
338             //- Read
339             static void readFields(ThermoCloud<ParcelType>& c);
341             //- Write
342             static void writeFields(const ThermoCloud<ParcelType>& c);
345     // Ostream Operator
347         friend Ostream& operator<< <ParcelType>
348         (
349             Ostream&,
350             const ThermoParcel<ParcelType>&
351         );
355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
357 } // End namespace Foam
359 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
361 #include "ThermoParcelI.H"
363 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
365 #ifdef NoRepository
366     #include "ThermoParcel.C"
367 #endif
369 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
371 #endif
373 // ************************************************************************* //