initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / submodels / Reacting / CompositionModel / CompositionModel / CompositionModel.H
blobb3f0949defcc84b06f7f8c4b4b0a9ff900d1b079
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::CompositionModel
28 Description
29     Templated reacting parcel composition model class
30     Consists of carrier species (via thermo package), and additional liquids
31     and solids
33 SourceFiles
34     CompositionModel.C
35     NewCompositionModel.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef CompositionModel_H
40 #define CompositionModel_H
42 #include "IOdictionary.H"
43 #include "autoPtr.H"
44 #include "runTimeSelectionTables.H"
46 #include "PtrList.H"
47 #include "multiComponentMixture.H"
49 #include "liquidMixture.H"
50 #include "solidMixture.H"
52 #include "phasePropertiesList.H"
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 namespace Foam
59 /*---------------------------------------------------------------------------*\
60                        Class CompositionModel Declaration
61 \*---------------------------------------------------------------------------*/
63 template<class CloudType>
64 class CompositionModel
66     // Private data
68         //- The cloud dictionary
69         const dictionary& dict_;
71         //- Reference to the owner injection class
72         CloudType& owner_;
74         //- The coefficients dictionary
75         const dictionary& coeffDict_;
77         //- Reference to the multi-component carrier phase thermo
78         multiComponentMixture<typename CloudType::thermoType>& mcCarrierThermo_;
80         //- Global (additional) liquid properties data
81         autoPtr<liquidMixture> liquids_;
83         //- Global (additional) solid properties data
84         autoPtr<solidMixture> solids_;
86         //- List of phase properties
87         phasePropertiesList phaseProps_;
90 public:
92     //- Runtime type information
93     TypeName("CompositionModel");
95     //- Declare runtime constructor selection table
96     declareRunTimeSelectionTable
97     (
98         autoPtr,
99         CompositionModel,
100         dictionary,
101         (
102             const dictionary& dict,
103             CloudType& owner
104         ),
105         (dict, owner)
106     );
109     // Constructors
111         //- Construct from dictionary
112         CompositionModel
113         (
114             const dictionary& dict,
115             CloudType& owner,
116             const word& type
117         );
120     //- Destructor
121     virtual ~CompositionModel();
124     //- Selector
125     static autoPtr<CompositionModel<CloudType> > New
126     (
127         const dictionary& dict,
128         CloudType& owner
129     );
132     // Member Functions
134         // Access
136             //- Return the cloud object
137             const CloudType& owner() const;
139             //- Return the cloud dictionary
140             const dictionary& dict() const;
142             //- Return the coefficients dictionary
143             const dictionary& coeffDict() const;
145             //- Return the carrier phase thermo package
146             const multiComponentMixture<typename CloudType::thermoType>&
147                 mcCarrierThermo() const;
150             // Composition lists
152                 //- Return the global (additional) liquids
153                 const liquidMixture& liquids() const;
155                 //- Return the global (additional) solids
156                 const solidMixture& solids() const;
158                 //- Return the list of phase properties
159                 const phasePropertiesList& phaseProps() const;
161                 //- Return the number of phases
162                 label nPhase() const;
165             // Phase properties
167                 //- Return the list of phase type names
168                 //  If only 1 phase, return the component names of that phase
169                 const wordList& phaseTypes() const;
171                 //- Return the list of state labels (s), (l), (g) etc.
172                 const wordList& stateLabels() const;
174                 //- Return the list of component names for phaseI
175                 const wordList& componentNames(const label phaseI) const;
177                 //- Return global id of component cmptName in carrier thermo
178                 label globalCarrierId(const word& cmptName) const;
180                 //- Return global id of component cmptName in phase phaseI
181                 label globalId(const label phaseI, const word& cmptName) const;
183                 //- Return global ids of for phase phaseI
184                 const labelList& globalIds(const label phaseI) const;
186                 //- Return local id of component cmptName in phase phaseI
187                 label localId(const label phaseI, const word& cmptName) const;
189                 //- Return global carrier id of component given local id
190                 label localToGlobalCarrierId
191                 (
192                     const label phaseI,
193                     const label id
194                 ) const;
196                 //- Return the list of phase phaseI mass fractions
197                 const scalarField& Y0(const label phaseI) const;
199                 //- Return the list of phase phaseI volume fractions fractions
200                 //  based on supplied mass fractions Y
201                 scalarField X
202                 (
203                     const label phaseI,
204                     const scalarField& Y
205                 ) const;
208             // Mixture properties
210                 //- Return the list of mixture mass fractions
211                 //  If only 1 phase, return component fractions of that phase
212                 virtual const scalarField& YMixture0() const = 0;
214                 // Indices of gas, liquid and solid phases in phase properties
215                 // list - returns -1 if not applicable
217                     //- Gas id
218                     virtual label idGas() const = 0;
220                     //- Liquid id
221                     virtual label idLiquid() const = 0;
223                     //- Solid id
224                     virtual label idSolid() const = 0;
227         // Evaluation
229             //- Return enthalpy for the phase phaseI
230             virtual scalar H
231             (
232                 const label phaseI,
233                 const scalarField& Y,
234                 const scalar p,
235                 const scalar T
236             ) const;
238             //- Return specific heat caoacity for the phase phaseI
239             virtual scalar cp
240             (
241                 const label phaseI,
242                 const scalarField& Y,
243                 const scalar p,
244                 const scalar T
245             ) const;
247             //- Return latent heat for the phase phaseI
248             virtual scalar L
249             (
250                 const label phaseI,
251                 const scalarField& Y,
252                 const scalar p,
253                 const scalar T
254             ) const;
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 } // End namespace Foam
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 #define makeCompositionModel(CloudType)                                       \
265                                                                               \
266     defineNamedTemplateTypeNameAndDebug                                       \
267     (                                                                         \
268         CompositionModel<CloudType>,                                          \
269         0                                                                     \
270     );                                                                        \
271                                                                               \
272     defineTemplateRunTimeSelectionTable                                       \
273     (                                                                         \
274         CompositionModel<CloudType>,                                          \
275         dictionary                                                            \
276     );
279 #define makeCompositionModelThermoType(SS, CloudType, ParcelType, ThermoType) \
280                                                                               \
281     defineNamedTemplateTypeNameAndDebug                                       \
282     (                                                                         \
283         SS<CloudType<ParcelType<ThermoType> > >,                              \
284         0                                                                     \
285     );                                                                        \
286                                                                               \
287     CompositionModel<CloudType<ParcelType<ThermoType> > >::                   \
288         adddictionaryConstructorToTable                                       \
289             <SS<CloudType<ParcelType<ThermoType> > > >                        \
290             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 #ifdef NoRepository
296 #   include "CompositionModel.C"
297 #endif
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 #endif
303 // ************************************************************************* //