1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
26 Foam::CompositionModel
29 Templated reacting parcel composition model class
30 Consists of carrier species (via thermo package), and additional liquids
37 \*---------------------------------------------------------------------------*/
39 #ifndef CompositionModel_H
40 #define CompositionModel_H
42 #include "IOdictionary.H"
44 #include "runTimeSelectionTables.H"
47 #include "multiComponentMixture.H"
49 #include "liquidMixture.H"
50 #include "solidMixture.H"
52 #include "phasePropertiesList.H"
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 /*---------------------------------------------------------------------------*\
60 Class CompositionModel Declaration
61 \*---------------------------------------------------------------------------*/
63 template<class CloudType>
64 class CompositionModel
68 //- The cloud dictionary
69 const dictionary& dict_;
71 //- Reference to the owner injection class
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_;
92 //- Runtime type information
93 TypeName("CompositionModel");
95 //- Declare runtime constructor selection table
96 declareRunTimeSelectionTable
102 const dictionary& dict,
111 //- Construct from dictionary
114 const dictionary& dict,
121 virtual ~CompositionModel();
125 static autoPtr<CompositionModel<CloudType> > New
127 const dictionary& dict,
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;
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;
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
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
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
218 virtual label idGas() const = 0;
221 virtual label idLiquid() const = 0;
224 virtual label idSolid() const = 0;
229 //- Return enthalpy for the phase phaseI
233 const scalarField& Y,
238 //- Return specific heat caoacity for the phase phaseI
242 const scalarField& Y,
247 //- Return latent heat for the phase phaseI
251 const scalarField& Y,
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 } // End namespace Foam
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 #define makeCompositionModel(CloudType) \
266 defineNamedTemplateTypeNameAndDebug \
268 CompositionModel<CloudType>, \
272 defineTemplateRunTimeSelectionTable \
274 CompositionModel<CloudType>, \
279 #define makeCompositionModelThermoType(SS, CloudType, ParcelType, ThermoType) \
281 defineNamedTemplateTypeNameAndDebug \
283 SS<CloudType<ParcelType<ThermoType> > >, \
287 CompositionModel<CloudType<ParcelType<ThermoType> > >:: \
288 adddictionaryConstructorToTable \
289 <SS<CloudType<ParcelType<ThermoType> > > > \
290 add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 # include "CompositionModel.C"
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303 // ************************************************************************* //