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

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