FreeFOAM The Cross-Platform CFD Toolkit
CompositionModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::CompositionModel
26 
27 Description
28  Templated reacting parcel composition model class
29  Consists of carrier species (via thermo package), and additional liquids
30  and solids
31 
32 SourceFiles
33  CompositionModel.C
34  NewCompositionModel.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef CompositionModel_H
39 #define CompositionModel_H
40 
41 #include <OpenFOAM/IOdictionary.H>
42 #include <OpenFOAM/autoPtr.H>
44 
45 #include <OpenFOAM/PtrList.H>
47 
50 
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class CompositionModel Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class CloudType>
64 {
65  // Private data
66 
67  //- The cloud dictionary
68  const dictionary& dict_;
69 
70  //- Reference to the owner injection class
71  CloudType& owner_;
72 
73  //- The coefficients dictionary
74  const dictionary& coeffDict_;
75 
76  //- Reference to the multi-component carrier phase thermo
78 
79  //- Global (additional) liquid properties data
80  autoPtr<liquidMixture> liquids_;
81 
82  //- Global (additional) solid properties data
83  autoPtr<solidMixture> solids_;
84 
85  //- List of phase properties
86  phasePropertiesList phaseProps_;
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("CompositionModel");
93 
94  //- Declare runtime constructor selection table
96  (
97  autoPtr,
99  dictionary,
100  (
101  const dictionary& dict,
102  CloudType& owner
103  ),
104  (dict, owner)
105  );
106 
107 
108  // Constructors
109 
110  //- Construct from dictionary
112  (
113  const dictionary& dict,
114  CloudType& owner,
115  const word& type
116  );
117 
118 
119  //- Destructor
120  virtual ~CompositionModel();
121 
122 
123  //- Selector
125  (
126  const dictionary& dict,
127  CloudType& owner
128  );
129 
130 
131  // Member Functions
132 
133  // Access
134 
135  //- Return the cloud object
136  const CloudType& owner() const;
137 
138  //- Return the cloud dictionary
139  const dictionary& dict() const;
140 
141  //- Return the coefficients dictionary
142  const dictionary& coeffDict() const;
143 
144  //- Return the carrier phase thermo package
146  mcCarrierThermo() const;
147 
148 
149  // Composition lists
150 
151  //- Return the global (additional) liquids
152  const liquidMixture& liquids() const;
153 
154  //- Return the global (additional) solids
155  const solidMixture& solids() const;
156 
157  //- Return the list of phase properties
158  const phasePropertiesList& phaseProps() const;
159 
160  //- Return the number of phases
161  label nPhase() const;
162 
163 
164  // Phase properties
165 
166  //- Return the list of phase type names
167  // If only 1 phase, return the component names of that phase
168  const wordList& phaseTypes() const;
169 
170  //- Return the list of state labels (s), (l), (g) etc.
171  const wordList& stateLabels() const;
172 
173  //- Return the list of component names for phaseI
174  const wordList& componentNames(const label phaseI) const;
175 
176  //- Return global id of component cmptName in carrier thermo
177  label globalCarrierId(const word& cmptName) const;
178 
179  //- Return global id of component cmptName in phase phaseI
180  label globalId(const label phaseI, const word& cmptName) const;
181 
182  //- Return global ids of for phase phaseI
183  const labelList& globalIds(const label phaseI) const;
184 
185  //- Return local id of component cmptName in phase phaseI
186  label localId(const label phaseI, const word& cmptName) const;
187 
188  //- Return global carrier id of component given local id
190  (
191  const label phaseI,
192  const label id
193  ) const;
194 
195  //- Return the list of phase phaseI mass fractions
196  const scalarField& Y0(const label phaseI) const;
197 
198  //- Return the list of phase phaseI volume fractions fractions
199  // based on supplied mass fractions Y
200  scalarField X
201  (
202  const label phaseI,
203  const scalarField& Y
204  ) const;
205 
206 
207  // Mixture properties
208 
209  //- Return the list of mixture mass fractions
210  // If only 1 phase, return component fractions of that phase
211  virtual const scalarField& YMixture0() const = 0;
212 
213  // Indices of gas, liquid and solid phases in phase properties
214  // list - returns -1 if not applicable
215 
216  //- Gas id
217  virtual label idGas() const = 0;
218 
219  //- Liquid id
220  virtual label idLiquid() const = 0;
221 
222  //- Solid id
223  virtual label idSolid() const = 0;
224 
225 
226  // Evaluation
227 
228  //- Return total enthalpy for the phase phaseI
229  virtual scalar H
230  (
231  const label phaseI,
232  const scalarField& Y,
233  const scalar p,
234  const scalar T
235  ) const;
236 
237  //- Return sensible enthalpy for the phase phaseI
238  virtual scalar Hs
239  (
240  const label phaseI,
241  const scalarField& Y,
242  const scalar p,
243  const scalar T
244  ) const;
245 
246  //- Return chemical enthalpy for the phase phaseI
247  virtual scalar Hc
248  (
249  const label phaseI,
250  const scalarField& Y,
251  const scalar p,
252  const scalar T
253  ) const;
254 
255  //- Return specific heat caoacity for the phase phaseI
256  virtual scalar cp
257  (
258  const label phaseI,
259  const scalarField& Y,
260  const scalar p,
261  const scalar T
262  ) const;
263 
264  //- Return latent heat for the phase phaseI
265  virtual scalar L
266  (
267  const label phaseI,
268  const scalarField& Y,
269  const scalar p,
270  const scalar T
271  ) const;
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace Foam
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #define makeCompositionModel(CloudType) \
282  \
283  defineNamedTemplateTypeNameAndDebug \
284  ( \
285  CompositionModel<CloudType>, \
286  0 \
287  ); \
288  \
289  defineTemplateRunTimeSelectionTable \
290  ( \
291  CompositionModel<CloudType>, \
292  dictionary \
293  );
294 
295 
296 #define makeCompositionModelThermoType(SS, CloudType, ParcelType, ThermoType) \
297  \
298  defineNamedTemplateTypeNameAndDebug \
299  ( \
300  SS<CloudType<ParcelType<ThermoType> > >, \
301  0 \
302  ); \
303  \
304  CompositionModel<CloudType<ParcelType<ThermoType> > >:: \
305  adddictionaryConstructorToTable \
306  <SS<CloudType<ParcelType<ThermoType> > > > \
307  add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
308 
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #ifdef NoRepository
314 #endif
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 #endif
319 
320 // ************************ vim: set sw=4 sts=4 et: ************************ //