FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::ThermoParcel
00026 
00027 Description
00028     Thermodynamic parcel class with one/two-way coupling with the continuous
00029     phase. Includes Kinematic parcel sub-models, plus:
00030     - heat transfer
00031 
00032 SourceFiles
00033     ThermoParcelI.H
00034     ThermoParcel.C
00035     ThermoParcelIO.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef ThermoParcel_H
00040 #define ThermoParcel_H
00041 
00042 #include <OpenFOAM/IOstream.H>
00043 #include <OpenFOAM/autoPtr.H>
00044 #include <finiteVolume/interpolationCellPoint.H>
00045 #include <OpenFOAM/contiguous.H>
00046 
00047 #include <lagrangianIntermediate/KinematicParcel.H>
00048 #include <lagrangianIntermediate/ThermoCloud_.H>
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 template<class ParcelType>
00056 class ThermoParcel;
00057 
00058 template<class ParcelType>
00059 Ostream& operator<<
00060 (
00061     Ostream&,
00062     const ThermoParcel<ParcelType>&
00063 );
00064 
00065 /*---------------------------------------------------------------------------*\
00066                        Class ThermoParcel Declaration
00067 \*---------------------------------------------------------------------------*/
00068 
00069 template<class ParcelType>
00070 class ThermoParcel
00071 :
00072     public KinematicParcel<ParcelType>
00073 {
00074 public:
00075 
00076     //- Class to hold thermo particle constant properties
00077     class constantProperties
00078     :
00079         public KinematicParcel<ParcelType>::constantProperties
00080     {
00081 
00082         // Private data
00083 
00084             //- Particle initial temperature [K]
00085             const scalar T0_;
00086 
00087             //- Minimum temperature [K]
00088             const scalar TMin_;
00089 
00090             //- Particle specific heat capacity [J/(kg.K)]
00091             const scalar cp0_;
00092 
00093             //- Particle emissivity [] (radiation)
00094             const scalar epsilon0_;
00095 
00096             //- Particle scattering factor [] (radiation)
00097             const scalar f0_;
00098 
00099             //- Default carrier Prandtl number []
00100             const scalar Pr_;
00101 
00102 
00103     public:
00104 
00105         // Constructors
00106         constantProperties(const dictionary& parentDict);
00107 
00108         // Member functions
00109 
00110             // Access
00111 
00112                 //- Return const access to the particle initial temperature [K]
00113                 inline scalar T0() const;
00114 
00115                 //- Return const access to minimum temperature [K]
00116                 inline scalar TMin() const;
00117 
00118                 //- Return const access to the particle specific heat capacity
00119                 //  [J/(kg.K)]
00120                 inline scalar cp0() const;
00121 
00122                 //- Return const access to the particle emissivity []
00123                 //  Active for radiation only
00124                 inline scalar epsilon0() const;
00125 
00126                 //- Return const access to the particle scattering factor []
00127                 //  Active for radiation only
00128                 inline scalar f0() const;
00129 
00130                 //- Return const access to the default carrier Prandtl number []
00131                 inline scalar Pr() const;
00132     };
00133 
00134 
00135     //- Class used to pass thermo tracking data to the trackToFace function
00136     class trackData
00137     :
00138         public KinematicParcel<ParcelType>::trackData
00139     {
00140 
00141         // Private data
00142 
00143             //- Reference to the cloud containing this particle
00144             ThermoCloud<ParcelType>& cloud_;
00145 
00146             //- Particle constant properties
00147             const constantProperties& constProps_;
00148 
00149             // Interpolators for continuous phase fields
00150 
00151                 //- Temperature field interpolator
00152                 const interpolation<scalar>& TInterp_;
00153 
00154                 //- Specific heat capacity field interpolator
00155                 const interpolation<scalar>& cpInterp_;
00156 
00157 
00158     public:
00159 
00160         // Constructors
00161 
00162             //- Construct from components
00163             inline trackData
00164             (
00165                 ThermoCloud<ParcelType>& cloud,
00166                 const constantProperties& constProps,
00167                 const interpolation<scalar>& rhoInterp,
00168                 const interpolation<vector>& UInterp,
00169                 const interpolation<scalar>& muInterp,
00170                 const interpolation<scalar>& TInterp,
00171                 const interpolation<scalar>& cpInterp,
00172                 const vector& g
00173             );
00174 
00175 
00176         // Member functions
00177 
00178             //- Return access to the owner cloud
00179             inline ThermoCloud<ParcelType>& cloud();
00180 
00181             //- Return const access to the owner cloud
00182             inline const constantProperties& constProps() const;
00183 
00184             //- Return const access to the interpolator for continuous
00185             //  phase temperature field
00186             inline const interpolation<scalar>& TInterp() const;
00187 
00188             //- Return const access to the interpolator for continuous
00189             //  phase specific heat capacity field
00190             inline const interpolation<scalar>& cpInterp() const;
00191     };
00192 
00193 
00194 protected:
00195 
00196     // Protected data
00197 
00198         // Parcel properties
00199 
00200             //- Temperature [K]
00201             scalar T_;
00202 
00203             //- Specific heat capacity [J/(kg.K)]
00204             scalar cp_;
00205 
00206 
00207         // Cell-based quantities
00208 
00209             //- Temperature [K]
00210             scalar Tc_;
00211 
00212             //- Specific heat capacity [J/(kg.K)]
00213             scalar cpc_;
00214 
00215 
00216     // Protected member functions
00217 
00218         //- Calculate new particle temperature
00219         template<class TrackData>
00220         scalar calcHeatTransfer
00221         (
00222             TrackData& td,
00223             const scalar dt,           // timestep
00224             const label cellI,         // owner cell
00225             const scalar Re,           // Reynolds number
00226             const scalar Pr,           // Prandtl number - surface
00227             const scalar kappa,        // Thermal conductivity - surface
00228             const scalar d,            // diameter
00229             const scalar rho,          // density
00230             const scalar T,            // temperature
00231             const scalar cp,           // specific heat capacity
00232             const scalar NCpW,         // Sum of N*Cp*W of emission species
00233             const scalar Sh,           // explicit particle enthalpy source
00234             scalar& dhsTrans           // sensible enthalpy transfer to carrier
00235         );
00236 
00237 
00238 public:
00239 
00240     // Static data members
00241 
00242         //- String representation of properties
00243         static string propHeader;
00244 
00245         //- Runtime type information
00246         TypeName("ThermoParcel");
00247 
00248 
00249     friend class Cloud<ParcelType>;
00250 
00251 
00252     // Constructors
00253 
00254         //- Construct from owner, position, and cloud owner
00255         //  Other properties initialised as null
00256         inline ThermoParcel
00257         (
00258             ThermoCloud<ParcelType>& owner,
00259             const vector& position,
00260             const label cellI
00261         );
00262 
00263         //- Construct from components
00264         inline ThermoParcel
00265         (
00266             ThermoCloud<ParcelType>& owner,
00267             const vector& position,
00268             const label cellI,
00269             const label typeId,
00270             const scalar nParticle0,
00271             const scalar d0,
00272             const vector& U0,
00273             const constantProperties& constProps
00274         );
00275 
00276         //- Construct from Istream
00277         ThermoParcel
00278         (
00279             const Cloud<ParcelType>& c,
00280             Istream& is,
00281             bool readFields = true
00282         );
00283 
00284         //- Construct as a copy
00285         ThermoParcel(const ThermoParcel& p);
00286 
00287         //- Construct and return a clone
00288         autoPtr<ThermoParcel> clone() const
00289         {
00290             return autoPtr<ThermoParcel>(new ThermoParcel(*this));
00291         }
00292 
00293 
00294     // Member Functions
00295 
00296         // Access
00297 
00298             //- Return const access to temperature
00299             inline scalar T() const;
00300 
00301             //- Return const access to specific heat capacity
00302             inline scalar cp() const;
00303 
00304 
00305         // Edit
00306 
00307             //- Return access to temperature
00308             inline scalar& T();
00309 
00310             //- Return access to specific heat capacity
00311             inline scalar& cp();
00312 
00313 
00314         // Main calculation loop
00315 
00316             //- Set cell values
00317             template<class TrackData>
00318             void setCellValues
00319             (
00320                 TrackData& td,
00321                 const scalar dt,
00322                 const label cellI
00323             );
00324 
00325             //- Correct cell values using latest transfer information
00326             template<class TrackData>
00327             void cellValueSourceCorrection
00328             (
00329                 TrackData& td,
00330                 const scalar dt,
00331                 const label cellI
00332             );
00333 
00334             //- Calculate surface thermo properties
00335             template<class TrackData>
00336             void calcSurfaceValues
00337             (
00338                 TrackData& td,
00339                 const label cellI,
00340                 const scalar T,
00341                 scalar& Ts,
00342                 scalar& rhos,
00343                 scalar& mus,
00344                 scalar& Pr,
00345                 scalar& kappa
00346             ) const;
00347 
00348             //- Update parcel properties over the time interval
00349             template<class TrackData>
00350             void calc
00351             (
00352                 TrackData& td,
00353                 const scalar dt,
00354                 const label cellI
00355             );
00356 
00357 
00358         // I-O
00359 
00360             //- Read
00361             static void readFields(Cloud<ParcelType>& c);
00362 
00363             //- Write
00364             static void writeFields(const Cloud<ParcelType>& c);
00365 
00366 
00367     // Ostream Operator
00368 
00369         friend Ostream& operator<< <ParcelType>
00370         (
00371             Ostream&,
00372             const ThermoParcel<ParcelType>&
00373         );
00374 };
00375 
00376 
00377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00378 
00379 } // End namespace Foam
00380 
00381 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00382 
00383 #include <lagrangianIntermediate/ThermoParcelI.H>
00384 
00385 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00386 
00387 #ifdef NoRepository
00388     #include <lagrangianIntermediate/ThermoParcel.C>
00389 #endif
00390 
00391 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00392 
00393 #endif
00394 
00395 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines