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

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