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

CompositionModel.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::CompositionModel
00027 
00028 Description
00029     Templated reacting parcel composition model class
00030     Consists of carrier species (via thermo package), and additional liquids
00031     and solids
00032 
00033 SourceFiles
00034     CompositionModel.C
00035     NewCompositionModel.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef CompositionModel_H
00040 #define CompositionModel_H
00041 
00042 #include "IOdictionary.H"
00043 #include "autoPtr.H"
00044 #include "runTimeSelectionTables.H"
00045 
00046 #include "PtrList.H"
00047 #include "multiComponentMixture.H"
00048 
00049 #include "liquidMixture.H"
00050 #include "solidMixture.H"
00051 
00052 #include "phasePropertiesList.H"
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace Foam
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                        Class CompositionModel Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class CloudType>
00064 class CompositionModel
00065 {
00066     // Private data
00067 
00068         //- The cloud dictionary
00069         const dictionary& dict_;
00070 
00071         //- Reference to the owner injection class
00072         CloudType& owner_;
00073 
00074         //- The coefficients dictionary
00075         const dictionary& coeffDict_;
00076 
00077         //- Reference to the multi-component carrier phase thermo
00078         multiComponentMixture<typename CloudType::thermoType>& mcCarrierThermo_;
00079 
00080         //- Global (additional) liquid properties data
00081         autoPtr<liquidMixture> liquids_;
00082 
00083         //- Global (additional) solid properties data
00084         autoPtr<solidMixture> solids_;
00085 
00086         //- List of phase properties
00087         phasePropertiesList phaseProps_;
00088 
00089 
00090 public:
00091 
00092     //- Runtime type information
00093     TypeName("CompositionModel");
00094 
00095     //- Declare runtime constructor selection table
00096     declareRunTimeSelectionTable
00097     (
00098         autoPtr,
00099         CompositionModel,
00100         dictionary,
00101         (
00102             const dictionary& dict,
00103             CloudType& owner
00104         ),
00105         (dict, owner)
00106     );
00107 
00108 
00109     // Constructors
00110 
00111         //- Construct from dictionary
00112         CompositionModel
00113         (
00114             const dictionary& dict,
00115             CloudType& owner,
00116             const word& type
00117         );
00118 
00119 
00120     //- Destructor
00121     virtual ~CompositionModel();
00122 
00123 
00124     //- Selector
00125     static autoPtr<CompositionModel<CloudType> > New
00126     (
00127         const dictionary& dict,
00128         CloudType& owner
00129     );
00130 
00131 
00132     // Member Functions
00133 
00134         // Access
00135 
00136             //- Return the cloud object
00137             const CloudType& owner() const;
00138 
00139             //- Return the cloud dictionary
00140             const dictionary& dict() const;
00141 
00142             //- Return the coefficients dictionary
00143             const dictionary& coeffDict() const;
00144 
00145             //- Return the carrier phase thermo package
00146             const multiComponentMixture<typename CloudType::thermoType>&
00147                 mcCarrierThermo() const;
00148 
00149 
00150             // Composition lists
00151 
00152                 //- Return the global (additional) liquids
00153                 const liquidMixture& liquids() const;
00154 
00155                 //- Return the global (additional) solids
00156                 const solidMixture& solids() const;
00157 
00158                 //- Return the list of phase properties
00159                 const phasePropertiesList& phaseProps() const;
00160 
00161                 //- Return the number of phases
00162                 label nPhase() const;
00163 
00164 
00165             // Phase properties
00166 
00167                 //- Return the list of phase type names
00168                 //  If only 1 phase, return the component names of that phase
00169                 const wordList& phaseTypes() const;
00170 
00171                 //- Return the list of state labels (s), (l), (g) etc.
00172                 const wordList& stateLabels() const;
00173 
00174                 //- Return the list of component names for phaseI
00175                 const wordList& componentNames(const label phaseI) const;
00176 
00177                 //- Return global id of component cmptName in carrier thermo
00178                 label globalCarrierId(const word& cmptName) const;
00179 
00180                 //- Return global id of component cmptName in phase phaseI
00181                 label globalId(const label phaseI, const word& cmptName) const;
00182 
00183                 //- Return global ids of for phase phaseI
00184                 const labelList& globalIds(const label phaseI) const;
00185 
00186                 //- Return local id of component cmptName in phase phaseI
00187                 label localId(const label phaseI, const word& cmptName) const;
00188 
00189                 //- Return global carrier id of component given local id
00190                 label localToGlobalCarrierId
00191                 (
00192                     const label phaseI,
00193                     const label id
00194                 ) const;
00195 
00196                 //- Return the list of phase phaseI mass fractions
00197                 const scalarField& Y0(const label phaseI) const;
00198 
00199                 //- Return the list of phase phaseI volume fractions fractions
00200                 //  based on supplied mass fractions Y
00201                 scalarField X
00202                 (
00203                     const label phaseI,
00204                     const scalarField& Y
00205                 ) const;
00206 
00207 
00208             // Mixture properties
00209 
00210                 //- Return the list of mixture mass fractions
00211                 //  If only 1 phase, return component fractions of that phase
00212                 virtual const scalarField& YMixture0() const = 0;
00213 
00214                 // Indices of gas, liquid and solid phases in phase properties
00215                 // list - returns -1 if not applicable
00216 
00217                     //- Gas id
00218                     virtual label idGas() const = 0;
00219 
00220                     //- Liquid id
00221                     virtual label idLiquid() const = 0;
00222 
00223                     //- Solid id
00224                     virtual label idSolid() const = 0;
00225 
00226 
00227         // Evaluation
00228 
00229             //- Return enthalpy for the phase phaseI
00230             virtual scalar H
00231             (
00232                 const label phaseI,
00233                 const scalarField& Y,
00234                 const scalar p,
00235                 const scalar T
00236             ) const;
00237 
00238             //- Return specific heat caoacity for the phase phaseI
00239             virtual scalar cp
00240             (
00241                 const label phaseI,
00242                 const scalarField& Y,
00243                 const scalar p,
00244                 const scalar T
00245             ) const;
00246 
00247             //- Return latent heat for the phase phaseI
00248             virtual scalar L
00249             (
00250                 const label phaseI,
00251                 const scalarField& Y,
00252                 const scalar p,
00253                 const scalar T
00254             ) const;
00255 };
00256 
00257 
00258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00259 
00260 } // End namespace Foam
00261 
00262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00263 
00264 #define makeCompositionModel(CloudType)                                       \
00265                                                                               \
00266     defineNamedTemplateTypeNameAndDebug                                       \
00267     (                                                                         \
00268         CompositionModel<CloudType>,                                          \
00269         0                                                                     \
00270     );                                                                        \
00271                                                                               \
00272     defineTemplateRunTimeSelectionTable                                       \
00273     (                                                                         \
00274         CompositionModel<CloudType>,                                          \
00275         dictionary                                                            \
00276     );
00277 
00278 
00279 #define makeCompositionModelThermoType(SS, CloudType, ParcelType, ThermoType) \
00280                                                                               \
00281     defineNamedTemplateTypeNameAndDebug                                       \
00282     (                                                                         \
00283         SS<CloudType<ParcelType<ThermoType> > >,                              \
00284         0                                                                     \
00285     );                                                                        \
00286                                                                               \
00287     CompositionModel<CloudType<ParcelType<ThermoType> > >::                   \
00288         adddictionaryConstructorToTable                                       \
00289             <SS<CloudType<ParcelType<ThermoType> > > >                        \
00290             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
00291 
00292 
00293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00294 
00295 #ifdef NoRepository
00296 #   include "CompositionModel.C"
00297 #endif
00298 
00299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00300 
00301 #endif
00302 
00303 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd