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

ReactingMultiphaseParcel.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) 2008-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::ReactingMultiphaseParcel
00026 
00027 Description
00028     Multiphase variant of the reacting parcel class with one/two-way coupling
00029     with the continuous phase.
00030 
00031 SourceFiles
00032     ReactingMultiphaseParcelI.H
00033     ReactingMultiphaseParcel.C
00034     ReactingMultiphaseParcelIO.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef ReactingMultiphaseParcel_H
00039 #define ReactingMultiphaseParcel_H
00040 
00041 #include <lagrangianIntermediate/ReactingParcel_.H>
00042 #include <lagrangianIntermediate/ReactingMultiphaseCloud_.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 template<class ParcelType>
00050 class ReactingMultiphaseParcel;
00051 
00052 template<class ParcelType>
00053 Ostream& operator<<
00054 (
00055     Ostream&,
00056     const ReactingMultiphaseParcel<ParcelType>&
00057 );
00058 
00059 /*---------------------------------------------------------------------------*\
00060                  Class ReactingMultiphaseParcel Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class ParcelType>
00064 class ReactingMultiphaseParcel
00065 :
00066     public ReactingParcel<ParcelType>
00067 {
00068 public:
00069 
00070     // IDs of phases in ReacingParcel phase list (Y)
00071 
00072         static const label GAS;
00073         static const label LIQ;
00074         static const label SLD;
00075 
00076 
00077     //- Class to hold reacting multiphase particle constant properties
00078     class constantProperties
00079     :
00080         public ReactingParcel<ParcelType>::constantProperties
00081     {
00082         // Private data
00083 
00084             //- Latent heat of devolatilisation [J/kg]
00085             const scalar LDevol_;
00086 
00087             //- Fraction of enthalpy retained by parcel due to surface
00088             //  reactions
00089             scalar hRetentionCoeff_;
00090 
00091 
00092     public:
00093 
00094         //- Constructor
00095         constantProperties(const dictionary& parentDict);
00096 
00097         // Access
00098 
00099             //- Return const access to the latent heat of devolatilisation
00100             inline scalar LDevol() const;
00101 
00102             //- Return const access to the fraction of enthalpy retained by
00103             //  parcel due to surface reactions
00104             inline scalar hRetentionCoeff() const;
00105     };
00106 
00107 
00108     //- Class used to pass reacting tracking data to the trackToFace function
00109     class trackData
00110     :
00111         public ReactingParcel<ParcelType>::trackData
00112     {
00113         // Private data
00114 
00115             //- Reference to the cloud containing this particle
00116             ReactingMultiphaseCloud<ParcelType>& cloud_;
00117 
00118             //- Particle constant properties
00119             const constantProperties& constProps_;
00120 
00121 
00122     public:
00123 
00124         // Constructors
00125 
00126             //- Construct from components
00127             inline trackData
00128             (
00129                 ReactingMultiphaseCloud<ParcelType>& cloud,
00130                 const constantProperties& constProps,
00131                 const interpolation<scalar>& rhoInterp,
00132                 const interpolation<vector>& UInterp,
00133                 const interpolation<scalar>& muInterp,
00134                 const interpolation<scalar>& TInterp,
00135                 const interpolation<scalar>& CpInterp,
00136                 const interpolation<scalar>& pInterp,
00137                 const vector& g
00138             );
00139 
00140 
00141         // Member functions
00142 
00143             //- Return access to the owner cloud
00144             inline ReactingMultiphaseCloud<ParcelType>& cloud();
00145 
00146             //- Return const access to the constant properties
00147             inline const constantProperties& constProps() const;
00148     };
00149 
00150 
00151 private:
00152 
00153     // Private member functions
00154 
00155         //- Return the mixture effective specific heat capacity
00156         template<class TrackData>
00157         scalar cpEff
00158         (
00159             TrackData& td,
00160             const scalar p,
00161             const scalar T,
00162             const label idG,
00163             const label idL,
00164             const label idS
00165         ) const;
00166 
00167         //- Return the mixture effective enthalpy
00168         template<class TrackData>
00169         scalar HEff
00170         (
00171             TrackData& td,
00172             const scalar p,
00173             const scalar T,
00174             const label idG,
00175             const label idL,
00176             const label idS
00177         ) const;
00178 
00179         //- Return the mixture effective latent heat
00180         template<class TrackData>
00181         scalar LEff
00182         (
00183             TrackData& td,
00184             const scalar p,
00185             const scalar T,
00186             const label idG,
00187             const label idL,
00188             const label idS
00189         ) const;
00190 
00191         //- Update the mass fractions (Y, YGas, YLiquid, YSolid)
00192         scalar updateMassFractions
00193         (
00194             const scalar mass0,
00195             const scalarField& dMassGas,
00196             const scalarField& dMassLiquid,
00197             const scalarField& dMassSolid
00198         );
00199 
00200 
00201 protected:
00202 
00203     // Protected data
00204 
00205         // Parcel properties
00206 
00207             //- Mass fractions of gases []
00208             scalarField YGas_;
00209 
00210             //- Mass fractions of liquids []
00211             scalarField YLiquid_;
00212 
00213             //- Mass fractions of solids []
00214             scalarField YSolid_;
00215 
00216             //- Flag to say that the particle is allowed to combust
00217             //  Only true after volatile content falls below threshold value
00218             bool canCombust_;
00219 
00220 
00221     // Protected member functions
00222 
00223         //- Calculate Devolatilisation
00224         template<class TrackData>
00225         void calcDevolatilisation
00226         (
00227             TrackData& td,
00228             const scalar dt,           // timestep
00229             const scalar Ts,           // Surface temperature
00230             const scalar d,            // diameter
00231             const scalar T,            // temperature
00232             const scalar mass,         // mass
00233             const scalar mass0,        // mass (initial on injection)
00234             const label idVolatile,    // id of volatile phase
00235             const scalar YVolatileTot, // total volatile mass fraction
00236             const scalarField& YVolatile, // volatile component mass fractions
00237             bool& canCombust,          // 'can combust' flag
00238             scalarField& dMassDV,      // mass transfer - local to particle
00239             scalar& Sh,                // explicit particle enthalpy source
00240             scalar& N,                 // flux of species emitted from particle
00241             scalar& NCpW,              // sum of N*Cp*W of emission species
00242             scalarField& Cs            // carrier conc. of emission species
00243         ) const;
00244 
00245         //- Calculate surface reactions
00246         template<class TrackData>
00247         void calcSurfaceReactions
00248         (
00249             TrackData& td,
00250             const scalar dt,           // timestep
00251             const label cellI,         // owner cell
00252             const scalar d,            // diameter
00253             const scalar T,            // temperature
00254             const scalar mass,         // mass
00255             const bool canCombust,     // 'can combust' flag
00256             const scalar N,            // flux of species emitted from particle
00257             const scalarField& YMix,   // mixture mass fractions
00258             const scalarField& YGas,   // gas-phase mass fractions
00259             const scalarField& YLiquid,// liquid-phase mass fractions
00260             const scalarField& YSolid, // solid-phase mass fractions
00261             scalarField& dMassSRGas,   // gas-phase mass transfer - local
00262             scalarField& dMassSRLiquid,// liquid-phase mass transfer - local
00263             scalarField& dMassSRSolid, // solid-phase mass transfer - local
00264             scalarField& dMassSRCarrier, // carrier phase mass transfer
00265             scalar& Sh,                // explicit particle enthalpy source
00266             scalar& dhsTrans           // sensible enthalpy transfer to carrier
00267         ) const;
00268 
00269 
00270 public:
00271 
00272     // Static data members
00273 
00274         //- String representation of properties
00275         static string propHeader;
00276 
00277         //- Runtime type information
00278         TypeName("ReactingMultiphaseParcel");
00279 
00280 
00281     friend class Cloud<ParcelType>;
00282 
00283 
00284     // Constructors
00285 
00286         //- Construct from owner, position, and cloud owner
00287         //  Other properties initialised as null
00288         inline ReactingMultiphaseParcel
00289         (
00290             ReactingMultiphaseCloud<ParcelType>& owner,
00291             const vector& position,
00292             const label cellI
00293         );
00294 
00295 
00296         //- Construct from components
00297         inline ReactingMultiphaseParcel
00298         (
00299             ReactingMultiphaseCloud<ParcelType>& owner,
00300             const vector& position,
00301             const label cellI,
00302             const label typeId,
00303             const scalar nParticle0,
00304             const scalar d0,
00305             const vector& U0,
00306             const scalarField& Y0,
00307             const scalarField& YGas0,
00308             const scalarField& YLiquid0,
00309             const scalarField& YSolid0,
00310             const constantProperties& constProps
00311         );
00312 
00313         //- Construct from Istream
00314         ReactingMultiphaseParcel
00315         (
00316             const Cloud<ParcelType>& c,
00317             Istream& is,
00318             bool readFields = true
00319         );
00320 
00321         //- Construct as a copy
00322         ReactingMultiphaseParcel(const ReactingMultiphaseParcel& p);
00323 
00324         //- Construct and return a clone
00325         autoPtr<ReactingMultiphaseParcel> clone() const
00326         {
00327             return
00328                 autoPtr<ReactingMultiphaseParcel>
00329                 (
00330                     new ReactingMultiphaseParcel(*this)
00331                 );
00332         }
00333 
00334 
00335     // Member Functions
00336 
00337         // Access
00338 
00339             //- Return const access to mass fractions of gases
00340             inline const scalarField& YGas() const;
00341 
00342             //- Return const access to mass fractions of liquids
00343             inline const scalarField& YLiquid() const;
00344 
00345             //- Return const access to mass fractions of solids
00346             inline const scalarField& YSolid() const;
00347 
00348             //- Return const access to the canCombust flag
00349             inline bool canCombust() const;
00350 
00351 
00352         // Edit
00353 
00354             //- Return access to mass fractions of gases
00355             inline scalarField& YGas();
00356 
00357             //- Return access to mass fractions of liquids
00358             inline scalarField& YLiquid();
00359 
00360             //- Return access to mass fractions of solids
00361             inline scalarField& YSolid();
00362 
00363             //- Return access to the canCombust flag
00364             inline bool& canCombust();
00365 
00366 
00367         // Main calculation loop
00368 
00369             //- Set cell values
00370             template<class TrackData>
00371             void setCellValues
00372             (
00373                 TrackData& td,
00374                 const scalar dt,
00375                 const label cellI
00376             );
00377 
00378             //- Correct cell values using latest transfer information
00379             template<class TrackData>
00380             void cellValueSourceCorrection
00381             (
00382                 TrackData& td,
00383                 const scalar dt,
00384                 const label cellI
00385             );
00386 
00387             //- Update parcel properties over the time interval
00388             template<class TrackData>
00389             void calc
00390             (
00391                 TrackData& td,
00392                 const scalar dt,
00393                 const label cellI
00394             );
00395 
00396 
00397         // I-O
00398 
00399             //- Read
00400             static void readFields(Cloud<ParcelType>& c);
00401 
00402             //- Write
00403             static void writeFields(const Cloud<ParcelType>& c);
00404 
00405 
00406     // Ostream Operator
00407 
00408         friend Ostream& operator<< <ParcelType>
00409         (
00410             Ostream&,
00411             const ReactingMultiphaseParcel<ParcelType>&
00412         );
00413 };
00414 
00415 
00416 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00417 
00418 } // End namespace Foam
00419 
00420 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00421 
00422 #include "ReactingMultiphaseParcelI.H"
00423 
00424 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00425 
00426 #ifdef NoRepository
00427     #include "ReactingMultiphaseParcel.C"
00428 #endif
00429 
00430 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00431 
00432 #endif
00433 
00434 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines