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

ReactingParcel.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::ReactingParcel
00027 
00028 Description
00029     Reacting parcel class with one/two-way coupling with the continuous
00030     phase.
00031 
00032 SourceFiles
00033     ReactingParcelI.H
00034     ReactingParcel.C
00035     ReactingParcelIO.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef ReactingParcel_H
00040 #define ReactingParcel_H
00041 
00042 #include "IOstream.H"
00043 #include "autoPtr.H"
00044 #include "interpolationCellPoint.H"
00045 #include "contiguous.H"
00046 
00047 #include "ThermoParcel.H"
00048 #include "ReactingCloud.H"
00049 #include "reactingParcel.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 template<class ParcelType>
00057 class ReactingParcel;
00058 
00059 template<class ParcelType>
00060 Ostream& operator<<
00061 (
00062     Ostream&,
00063     const ReactingParcel<ParcelType>&
00064 );
00065 
00066 /*---------------------------------------------------------------------------*\
00067                         Class ReactingParcel Declaration
00068 \*---------------------------------------------------------------------------*/
00069 
00070 template<class ParcelType>
00071 class ReactingParcel
00072 :
00073     public reactingParcel,
00074     public ThermoParcel<ParcelType>
00075 {
00076 public:
00077 
00078     //- Class to hold reacting particle constant properties
00079     class constantProperties
00080     :
00081         public ThermoParcel<ParcelType>::constantProperties
00082     {
00083         // Private data
00084 
00085             //- Minimum pressure [Pa]
00086             const scalar pMin_;
00087 
00088             //- Constant volume flag - e.g. during mass transfer
00089             Switch constantVolume_;
00090 
00091             //- Vaporisation temperature [K]
00092             const scalar Tvap_;
00093 
00094             //- Boiling point [K]
00095             const scalar Tbp_;
00096 
00097 
00098     public:
00099 
00100         //- Constructor
00101         constantProperties(const dictionary& parentDict);
00102 
00103         // Access
00104 
00105             //- Return const access to the minimum pressure
00106             inline scalar pMin() const;
00107 
00108             //- Return const access to the constant volume flag
00109             inline Switch constantVolume() const;
00110 
00111             //- Return const access to the vaporisation temperature
00112             inline scalar Tvap() const;
00113 
00114             //- Return const access to the boiling point
00115             inline scalar Tbp() const;
00116    };
00117 
00118 
00119     //- Class used to pass reacting tracking data to the trackToFace function
00120     class trackData
00121     :
00122         public ThermoParcel<ParcelType>::trackData
00123     {
00124 
00125         // Private data
00126 
00127             //- Reference to the cloud containing this particle
00128             ReactingCloud<ParcelType>& cloud_;
00129 
00130             //- Particle constant properties
00131             const constantProperties& constProps_;
00132 
00133             //- Interpolator for continuous phase pressure field
00134             const interpolation<scalar>& pInterp_;
00135 
00136 
00137     public:
00138 
00139         // Constructors
00140 
00141             //- Construct from components
00142             inline trackData
00143             (
00144                 ReactingCloud<ParcelType>& cloud,
00145                 const constantProperties& constProps,
00146                 const interpolation<scalar>& rhoInterp,
00147                 const interpolation<vector>& UInterp,
00148                 const interpolation<scalar>& muInterp,
00149                 const interpolation<scalar>& TInterp,
00150                 const interpolation<scalar>& CpInterp,
00151                 const interpolation<scalar>& pInterp,
00152                 const vector& g
00153             );
00154 
00155 
00156         // Member functions
00157 
00158             //- Return access to the owner cloud
00159             inline ReactingCloud<ParcelType>& cloud();
00160 
00161             //- Return const access to the constant properties
00162             inline const constantProperties& constProps() const;
00163 
00164             //- Return const access to the interpolator for continuous
00165             //  phase pressure field
00166             inline const interpolation<scalar>& pInterp() const;
00167     };
00168 
00169 
00170 protected:
00171 
00172     // Protected data
00173 
00174         // Parcel properties
00175 
00176             //- Initial particle mass [kg]
00177             scalar mass0_;
00178 
00179             //- Mass fractions of mixture []
00180             scalarField Y_;
00181 
00182 
00183         // Cell-based quantities
00184 
00185             //- Pressure [Pa]
00186             scalar pc_;
00187 
00188 
00189     // Protected member functions
00190 
00191         //- Calculate Phase change
00192         template<class TrackData>
00193         void calcPhaseChange
00194         (
00195             TrackData& td,
00196             const scalar dt,           // timestep
00197             const label cellI,         // owner cell
00198             const scalar d,            // diameter
00199             const scalar T,            // temperature
00200             const vector& U,           // velocity
00201             const scalar mass,         // mass
00202             const label idPhase,       // id of phase involved in phase change
00203             const scalar YPhase,       // total mass fraction
00204             const scalarField& YComponents, // component mass fractions
00205             scalarField& dMassPC,      // mass transfer - local to particle
00206             scalar& Sh,                // explicit particle enthalpy source
00207             scalar& dhsTrans           // sensible enthalpy transfer to carrier
00208         );
00209 
00210         //- Update mass fraction
00211         scalar updateMassFraction
00212         (
00213             const scalar mass0,
00214             const scalarField& dMass,
00215             scalarField& Y
00216         ) const;
00217 
00218 
00219 public:
00220 
00221     // Static data members
00222 
00223         //- String representation of properties
00224         static string propHeader;
00225 
00226         //- Runtime type information
00227         TypeName("ReactingParcel");
00228 
00229 
00230     friend class Cloud<ParcelType>;
00231 
00232 
00233     // Constructors
00234 
00235         //- Construct from owner, position, and cloud owner
00236         //  Other properties initialised as null
00237         inline ReactingParcel
00238         (
00239             ReactingCloud<ParcelType>& owner,
00240             const vector& position,
00241             const label cellI
00242         );
00243 
00244         //- Construct from components
00245         inline ReactingParcel
00246         (
00247             ReactingCloud<ParcelType>& owner,
00248             const vector& position,
00249             const label cellI,
00250             const label typeId,
00251             const scalar nParticle0,
00252             const scalar d0,
00253             const vector& U0,
00254             const scalarField& Y0,
00255             const constantProperties& constProps
00256         );
00257 
00258         //- Construct from Istream
00259         ReactingParcel
00260         (
00261             const Cloud<ParcelType>& c,
00262             Istream& is,
00263             bool readFields = true
00264         );
00265 
00266         //- Construct as a copy
00267         ReactingParcel(const ReactingParcel& p);
00268 
00269         //- Construct and return a clone
00270         autoPtr<ReactingParcel> clone() const
00271         {
00272             return autoPtr<ReactingParcel>(new ReactingParcel(*this));
00273         }
00274 
00275 
00276     // Member Functions
00277 
00278         // Access
00279 
00280             //- Return const access to initial mass
00281             inline scalar mass0() const;
00282 
00283             //- Return const access to mass fractions of mixture
00284             inline const scalarField& Y() const;
00285 
00286             //- Return the owner cell pressure
00287             inline scalar pc() const;
00288 
00289 
00290         // Edit
00291 
00292             //- Return access to initial mass
00293             inline scalar& mass0();
00294 
00295             //- Return access to mass fractions of mixture
00296             inline scalarField& Y();
00297 
00298 
00299         // Main calculation loop
00300 
00301             //- Set cell values
00302             template<class TrackData>
00303             void setCellValues
00304             (
00305                 TrackData& td,
00306                 const scalar dt,
00307                 const label cellI
00308             );
00309 
00310             //- Correct cell values using latest transfer information
00311             template<class TrackData>
00312             void cellValueSourceCorrection
00313             (
00314                 TrackData& td,
00315                 const scalar dt,
00316                 const label cellI
00317             );
00318 
00319             //- Update parcel properties over the time interval
00320             template<class TrackData>
00321             void calc
00322             (
00323                 TrackData& td,
00324                 const scalar dt,
00325                 const label cellI
00326             );
00327 
00328 
00329         // I-O
00330 
00331             //- Read
00332             static void readFields(ReactingCloud<ParcelType>& c);
00333 
00334             //- Write
00335             static void writeFields(const ReactingCloud<ParcelType>& c);
00336 
00337 
00338     // Ostream Operator
00339 
00340         friend Ostream& operator<< <ParcelType>
00341         (
00342             Ostream&,
00343             const ReactingParcel<ParcelType>&
00344         );
00345 };
00346 
00347 
00348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00349 
00350 } // End namespace Foam
00351 
00352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00353 
00354 #include "ReactingParcelI.H"
00355 
00356 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00357 
00358 #ifdef NoRepository
00359     #include "ReactingParcel.C"
00360 #endif
00361 
00362 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00363 
00364 #endif
00365 
00366 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd