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) 2011-2015 OpenFOAM Foundation
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  CompositionModelNew.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef CompositionModel_H
39 #define CompositionModel_H
40 
41 #include "CloudSubModelBase.H"
42 #include "IOdictionary.H"
43 #include "autoPtr.H"
44 #include "runTimeSelectionTables.H"
45 
46 #include "PtrList.H"
47 #include "SLGThermo.H"
48 
49 #include "phasePropertiesList.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class CompositionModel Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class CloudType>
61 class CompositionModel
62 :
63  public CloudSubModelBase<CloudType>
64 {
65  // Private data
66 
67  //- Reference to the thermo database
68  const SLGThermo& thermo_;
69 
70  //- List of phase properties
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("compositionModel");
78 
79  //- Declare runtime constructor selection table
81  (
82  autoPtr,
84  dictionary,
85  (
86  const dictionary& dict,
87  CloudType& owner
88  ),
89  (dict, owner)
90  );
91 
92 
93  // Constructors
94 
95  //- Construct null from owner
97 
98  //- Construct from dictionary
100  (
101  const dictionary& dict,
102  CloudType& owner,
103  const word& type
104  );
105 
106  //- Construct copy
108 
109  //- Construct and return a clone
110  virtual autoPtr<CompositionModel<CloudType> > clone() const = 0;
111 
112 
113  //- Destructor
114  virtual ~CompositionModel();
115 
116 
117  //- Selector
119  (
120  const dictionary& dict,
121  CloudType& owner
122  );
123 
124 
125  // Member Functions
126 
127  // Access
128 
129  //- Return the thermo database
130  const SLGThermo& thermo() const;
131 
132 
133  // Composition lists
134 
135  //- Return the carrier components (wrapper function)
136  const basicSpecieMixture& carrier() const;
137 
138  //- Return the global (additional) liquids
139  const liquidMixtureProperties& liquids() const;
140 
141  //- Return the global (additional) solids
142  const solidMixtureProperties& solids() const;
143 
144  //- Return the list of phase properties
145  const phasePropertiesList& phaseProps() const;
146 
147  //- Return the number of phases
148  label nPhase() const;
149 
150 
151  // Phase properties
152 
153  //- Return the list of phase type names
154  // If only 1 phase, return the component names of that phase
155  const wordList& phaseTypes() const;
156 
157  //- Return the list of state labels (s), (l), (g) etc.
158  const wordList& stateLabels() const;
159 
160  //- Return the list of component names for phaseI
161  const wordList& componentNames(const label phaseI) const;
162 
163  //- Return global id of component cmptName in carrier thermo
165  (
166  const word& cmptName,
167  const bool allowNotFound = false
168  ) const;
169 
170  //- Return local id of component cmptName in phase phaseI
171  label localId
172  (
173  const label phaseI,
174  const word& cmptName,
175  const bool allowNotFound = false
176  ) const;
177 
178  //- Return carrier id of component given local id
180  (
181  const label phaseI,
182  const label id,
183  const bool allowNotFound = false
184  ) const;
185 
186  //- Return the list of phase phaseI mass fractions
187  const scalarField& Y0(const label phaseI) const;
188 
189  //- Return the list of phase phaseI volume fractions fractions
190  // based on supplied mass fractions Y
192  (
193  const label phaseI,
194  const scalarField& Y
195  ) const;
196 
197 
198  // Mixture properties
199 
200  //- Return the list of mixture mass fractions
201  // If only 1 phase, return component fractions of that phase
202  virtual const scalarField& YMixture0() const = 0;
203 
204  // Indices of gas, liquid and solid phases in phase properties
205  // list - returns -1 if not applicable
206 
207  //- Gas id
208  virtual label idGas() const = 0;
209 
210  //- Liquid id
211  virtual label idLiquid() const = 0;
212 
213  //- Solid id
214  virtual label idSolid() const = 0;
215 
216 
217  // Evaluation
218 
219  //- Return total enthalpy for the phase phaseI
220  virtual scalar H
221  (
222  const label phaseI,
223  const scalarField& Y,
224  const scalar p,
225  const scalar T
226  ) const;
227 
228  //- Return sensible enthalpy for the phase phaseI
229  virtual scalar Hs
230  (
231  const label phaseI,
232  const scalarField& Y,
233  const scalar p,
234  const scalar T
235  ) const;
236 
237  //- Return chemical enthalpy for the phase phaseI
238  virtual scalar Hc
239  (
240  const label phaseI,
241  const scalarField& Y,
242  const scalar p,
243  const scalar T
244  ) const;
245 
246  //- Return specific heat caoacity for the phase phaseI
247  virtual scalar Cp
248  (
249  const label phaseI,
250  const scalarField& Y,
251  const scalar p,
252  const scalar T
253  ) const;
254 
255  //- Return latent heat for the phase phaseI
256  virtual scalar L
257  (
258  const label phaseI,
259  const scalarField& Y,
260  const scalar p,
261  const scalar T
262  ) const;
263 };
264 
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 } // End namespace Foam
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #define makeCompositionModel(CloudType) \
273  \
274  typedef Foam::CloudType::reactingCloudType reactingCloudType; \
275  defineNamedTemplateTypeNameAndDebug \
276  ( \
277  Foam::CompositionModel<reactingCloudType>, \
278  0 \
279  ); \
280  namespace Foam \
281  { \
282  defineTemplateRunTimeSelectionTable \
283  ( \
284  CompositionModel<reactingCloudType>, \
285  dictionary \
286  ); \
287  }
288 
289 
290 #define makeCompositionModelType(SS, CloudType) \
291  \
292  typedef Foam::CloudType::reactingCloudType reactingCloudType; \
293  defineNamedTemplateTypeNameAndDebug(Foam::SS<reactingCloudType>, 0); \
294  \
295  Foam::CompositionModel<reactingCloudType>:: \
296  adddictionaryConstructorToTable<Foam::SS<reactingCloudType> > \
297  add##SS##CloudType##reactingCloudType##ConstructorToTable_;
298 
299 
300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 
302 #ifdef NoRepository
303 # include "CompositionModel.C"
304 #endif
305 
306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307 
308 #endif
309 
310 // ************************************************************************* //
phasePropertiesList.H
Foam::CompositionModel::YMixture0
virtual const scalarField & YMixture0() const =0
Return the list of mixture mass fractions.
Foam::CompositionModel::Cp
virtual scalar Cp(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return specific heat caoacity for the phase phaseI.
Definition: CompositionModel.C:437
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::CompositionModel::H
virtual scalar H(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return total enthalpy for the phase phaseI.
Definition: CompositionModel.C:277
Foam::basicSpecieMixture
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
Definition: basicSpecieMixture.H:49
Foam::SLGThermo
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::CompositionModel::thermo_
const SLGThermo & thermo_
Reference to the thermo database.
Definition: CompositionModel.H:67
Foam::CompositionModel::localId
label localId(const label phaseI, const word &cmptName, const bool allowNotFound=false) const
Return local id of component cmptName in phase phaseI.
Definition: CompositionModel.C:180
Foam::CompositionModel::localToCarrierId
label localToCarrierId(const label phaseI, const label id, const bool allowNotFound=false) const
Return carrier id of component given local id.
Definition: CompositionModel.C:201
Foam::solidMixtureProperties
A mixture of solids.
Definition: solidMixtureProperties.H:74
Foam::phasePropertiesList
Simple container for a list of phase properties.
Definition: phasePropertiesList.H:51
Foam::CompositionModel::Hs
virtual scalar Hs(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return sensible enthalpy for the phase phaseI.
Definition: CompositionModel.C:331
SLGThermo.H
Foam::CompositionModel::Hc
virtual scalar Hc(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return chemical enthalpy for the phase phaseI.
Definition: CompositionModel.C:386
Foam::CompositionModel
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
Definition: ReactingCloud.H:52
Foam::CompositionModel::idGas
virtual label idGas() const =0
Gas id.
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::CompositionModel::phaseProps
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
Definition: CompositionModel.C:113
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::CompositionModel::Y0
const scalarField & Y0(const label phaseI) const
Return the list of phase phaseI mass fractions.
Definition: CompositionModel.C:223
Foam::CompositionModel::X
tmp< scalarField > X(const label phaseI, const scalarField &Y) const
Return the list of phase phaseI volume fractions fractions.
Definition: CompositionModel.C:233
CloudSubModelBase.H
Foam::CompositionModel::phaseProps_
phasePropertiesList phaseProps_
List of phase properties.
Definition: CompositionModel.H:70
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::CompositionModel::idSolid
virtual label idSolid() const =0
Solid id.
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::CompositionModel::liquids
const liquidMixtureProperties & liquids() const
Return the global (additional) liquids.
Definition: CompositionModel.C:97
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::CompositionModel::idLiquid
virtual label idLiquid() const =0
Liquid id.
Foam::CompositionModel::carrier
const basicSpecieMixture & carrier() const
Return the carrier components (wrapper function)
Definition: CompositionModel.C:89
Foam::CompositionModel::CompositionModel
CompositionModel(CloudType &owner)
Construct null from owner.
Definition: CompositionModel.C:31
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::CompositionModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, CompositionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::CompositionModel::componentNames
const wordList & componentNames(const label phaseI) const
Return the list of component names for phaseI.
Definition: CompositionModel.C:150
Foam::CompositionModel::solids
const solidMixtureProperties & solids() const
Return the global (additional) solids.
Definition: CompositionModel.C:105
Foam::CompositionModel::TypeName
TypeName("compositionModel")
Runtime type information.
Foam::CompositionModel::nPhase
label nPhase() const
Return the number of phases.
Definition: CompositionModel.C:120
IOdictionary.H
CompositionModel.C
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::liquidMixtureProperties
A mixture of liquids.
Definition: liquidMixtureProperties.H:74
Foam::CompositionModel::clone
virtual autoPtr< CompositionModel< CloudType > > clone() const =0
Construct and return a clone.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::CompositionModel::thermo
const SLGThermo & thermo() const
Return the thermo database.
Definition: CompositionModel.C:81
Foam::CompositionModel::~CompositionModel
virtual ~CompositionModel()
Destructor.
Definition: CompositionModel.C:74
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::CompositionModel::New
static autoPtr< CompositionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: CompositionModelNew.C:33
Foam::CompositionModel::phaseTypes
const wordList & phaseTypes() const
Return the list of phase type names.
Definition: CompositionModel.C:127
Foam::CompositionModel::carrierId
label carrierId(const word &cmptName, const bool allowNotFound=false) const
Return global id of component cmptName in carrier thermo.
Definition: CompositionModel.C:158
PtrList.H
Foam::CompositionModel::L
virtual scalar L(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return latent heat for the phase phaseI.
Definition: CompositionModel.C:487
Foam::CompositionModel::stateLabels
const wordList & stateLabels() const
Return the list of state labels (s), (l), (g) etc.
Definition: CompositionModel.C:142
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36
autoPtr.H