OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

ThermoParcel.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::ThermoParcel
00027 
00028 Description
00029     Thermodynamic parcel class with one/two-way coupling with the continuous
00030     phase. Includes Kinematic parcel sub-models, plus:
00031     - heat transfer
00032 
00033 SourceFiles
00034     ThermoParcelI.H
00035     ThermoParcel.C
00036     ThermoParcelIO.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef ThermoParcel_H
00041 #define ThermoParcel_H
00042 
00043 #include "IOstream.H"
00044 #include "autoPtr.H"
00045 #include "interpolationCellPoint.H"
00046 #include "contiguous.H"
00047 
00048 #include "KinematicParcel.H"
00049 #include "ThermoCloud.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 template<class ParcelType>
00057 class ThermoParcel;
00058 
00059 template<class ParcelType>
00060 Ostream& operator<<
00061 (
00062     Ostream&,
00063     const ThermoParcel<ParcelType>&
00064 );
00065 
00066 /*---------------------------------------------------------------------------*\
00067                        Class ThermoParcel Declaration
00068 \*---------------------------------------------------------------------------*/
00069 
00070 template<class ParcelType>
00071 class ThermoParcel
00072 :
00073     public KinematicParcel<ParcelType>
00074 {
00075 public:
00076 
00077     //- Class to hold thermo particle constant properties
00078     class constantProperties
00079     :
00080         public KinematicParcel<ParcelType>::constantProperties
00081     {
00082 
00083         // Private data
00084 
00085             //- Particle initial temperature [K]
00086             const scalar T0_;
00087 
00088             //- Minimum temperature [K]
00089             const scalar TMin_;
00090 
00091             //- Particle specific heat capacity [J/(kg.K)]
00092             const scalar cp0_;
00093 
00094             //- Particle emissivity [] (radiation)
00095             const scalar epsilon0_;
00096 
00097             //- Particle scattering factor [] (radiation)
00098             const scalar f0_;
00099 
00100 
00101     public:
00102 
00103         // Constructors
00104         constantProperties(const dictionary& parentDict);
00105 
00106         // Member functions
00107 
00108             // Access
00109 
00110                 //- Return const access to the particle initial temperature [K]
00111                 inline scalar T0() const;
00112 
00113                 //- Return const access to minimum temperature [K]
00114                 inline scalar TMin() const;
00115 
00116                 //- Return const access to the particle specific heat capacity
00117                 //  [J/(kg.K)]
00118                 inline scalar cp0() const;
00119 
00120                 //- Return const access to the particle emissivity []
00121                 //  Active for radiation only
00122                 inline scalar epsilon0() const;
00123 
00124                 //- Return const access to the particle scattering factor []
00125                 //  Active for radiation only
00126                 inline scalar f0() const;
00127     };
00128 
00129 
00130     //- Class used to pass thermo tracking data to the trackToFace function
00131     class trackData
00132     :
00133         public KinematicParcel<ParcelType>::trackData
00134     {
00135 
00136         // Private data
00137 
00138             //- Reference to the cloud containing this particle
00139             ThermoCloud<ParcelType>& cloud_;
00140 
00141             //- Particle constant properties
00142             const constantProperties& constProps_;
00143 
00144             // Interpolators for continuous phase fields
00145 
00146                 //- Temperature field interpolator
00147                 const interpolation<scalar>& TInterp_;
00148 
00149                 //- Specific heat capacity field interpolator
00150                 const interpolation<scalar>& cpInterp_;
00151 
00152 
00153     public:
00154 
00155         // Constructors
00156 
00157             //- Construct from components
00158             inline trackData
00159             (
00160                 ThermoCloud<ParcelType>& cloud,
00161                 const constantProperties& constProps,
00162                 const interpolation<scalar>& rhoInterp,
00163                 const interpolation<vector>& UInterp,
00164                 const interpolation<scalar>& muInterp,
00165                 const interpolation<scalar>& TInterp,
00166                 const interpolation<scalar>& cpInterp,
00167                 const vector& g
00168             );
00169 
00170 
00171         // Member functions
00172 
00173             //- Return access to the owner cloud
00174             inline ThermoCloud<ParcelType>& cloud();
00175 
00176             //- Return const access to the owner cloud
00177             inline const constantProperties& constProps() const;
00178 
00179             //- Return const access to the interpolator for continuous
00180             //  phase temperature field
00181             inline const interpolation<scalar>& TInterp() const;
00182 
00183             //- Return const access to the interpolator for continuous
00184             //  phase specific heat capacity field
00185             inline const interpolation<scalar>& cpInterp() const;
00186     };
00187 
00188 
00189 protected:
00190 
00191     // Protected data
00192 
00193         // Parcel properties
00194 
00195             //- Temperature [K]
00196             scalar T_;
00197 
00198             //- Specific heat capacity [J/(kg.K)]
00199             scalar cp_;
00200 
00201 
00202         // Cell-based quantities
00203 
00204             //- Temperature [K]
00205             scalar Tc_;
00206 
00207             //- Specific heat capacity [J/(kg.K)]
00208             scalar cpc_;
00209 
00210 
00211     // Protected member functions
00212 
00213         //- Calculate new particle temperature
00214         template<class TrackData>
00215         scalar calcHeatTransfer
00216         (
00217             TrackData& td,
00218             const scalar dt,           // timestep
00219             const label cellI,         // owner cell
00220             const scalar d,            // diameter
00221             const vector& U,           // velocity
00222             const scalar rho,          // density
00223             const scalar T,            // temperature
00224             const scalar cp,           // specific heat capacity
00225             const scalar Sh,           // explicit particle enthalpy source
00226             scalar& dhsTrans           // sensible enthalpy transfer to carrier
00227         );
00228 
00229 
00230 public:
00231 
00232     // Static data members
00233 
00234         //- String representation of properties
00235         static string propHeader;
00236 
00237         //- Runtime type information
00238         TypeName("ThermoParcel");
00239 
00240 
00241     friend class Cloud<ParcelType>;
00242 
00243 
00244     // Constructors
00245 
00246         //- Construct from owner, position, and cloud owner
00247         //  Other properties initialised as null
00248         inline ThermoParcel
00249         (
00250             ThermoCloud<ParcelType>& owner,
00251             const vector& position,
00252             const label cellI
00253         );
00254 
00255         //- Construct from components
00256         inline ThermoParcel
00257         (
00258             ThermoCloud<ParcelType>& owner,
00259             const vector& position,
00260             const label cellI,
00261             const label typeId,
00262             const scalar nParticle0,
00263             const scalar d0,
00264             const vector& U0,
00265             const constantProperties& constProps
00266         );
00267 
00268         //- Construct from Istream
00269         ThermoParcel
00270         (
00271             const Cloud<ParcelType>& c,
00272             Istream& is,
00273             bool readFields = true
00274         );
00275 
00276         //- Construct as a copy
00277         ThermoParcel(const ThermoParcel& p);
00278 
00279         //- Construct and return a clone
00280         autoPtr<ThermoParcel> clone() const
00281         {
00282             return autoPtr<ThermoParcel>(new ThermoParcel(*this));
00283         }
00284 
00285 
00286     // Member Functions
00287 
00288         // Access
00289 
00290             //- Return const access to temperature
00291             inline scalar T() const;
00292 
00293             //- Return const access to specific heat capacity
00294             inline scalar cp() const;
00295 
00296 
00297         // Edit
00298 
00299             //- Return access to temperature
00300             inline scalar& T();
00301 
00302             //- Return access to specific heat capacity
00303             inline scalar& cp();
00304 
00305 
00306         // Main calculation loop
00307 
00308             //- Set cell values
00309             template<class TrackData>
00310             void setCellValues
00311             (
00312                 TrackData& td,
00313                 const scalar dt,
00314                 const label cellI
00315             );
00316 
00317             //- Correct cell values using latest transfer information
00318             template<class TrackData>
00319             void cellValueSourceCorrection
00320             (
00321                 TrackData& td,
00322                 const scalar dt,
00323                 const label cellI
00324             );
00325 
00326             //- Update parcel properties over the time interval
00327             template<class TrackData>
00328             void calc
00329             (
00330                 TrackData& td,
00331                 const scalar dt,
00332                 const label cellI
00333             );
00334 
00335 
00336         // I-O
00337 
00338             //- Read
00339             static void readFields(ThermoCloud<ParcelType>& c);
00340 
00341             //- Write
00342             static void writeFields(const ThermoCloud<ParcelType>& c);
00343 
00344 
00345     // Ostream Operator
00346 
00347         friend Ostream& operator<< <ParcelType>
00348         (
00349             Ostream&,
00350             const ThermoParcel<ParcelType>&
00351         );
00352 };
00353 
00354 
00355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00356 
00357 } // End namespace Foam
00358 
00359 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00360 
00361 #include "ThermoParcelI.H"
00362 
00363 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00364 
00365 #ifdef NoRepository
00366     #include "ThermoParcel.C"
00367 #endif
00368 
00369 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00370 
00371 #endif
00372 
00373 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd