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

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