basicSpecieMixture.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2014-2020 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::basicSpecieMixture
26 
27 Description
28  Specialization of basicMixture for a mixture consisting of a number for
29  molecular species.
30 
31 SourceFiles
32  basicSpecieMixture.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef basicSpecieMixture_H
37 #define basicSpecieMixture_H
38 
39 #include "volFields.H"
40 #include "PtrList.H"
41 #include "basicMixture.H"
42 #include "speciesTable.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class basicSpecieMixture Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public basicMixture
56 {
57 
58 protected:
59 
60  // Protected data
61 
62  //- Table of specie names
64 
65  //- List of specie active flags
66  mutable List<bool> active_;
67 
68  //- Species mass fractions
70 
71 
72 public:
73 
74  //- Run time type information
75  TypeName("basicSpecieMixture");
76 
77  //- The base class of the mixture
79 
80 
81  // Constructors
82 
83  //- Construct from dictionary, species names, mesh and phase name
85  (
86  const dictionary&,
87  const wordList& specieNames,
88  const fvMesh&,
89  const word&
90  );
91 
92 
93  //- Destructor
94  virtual ~basicSpecieMixture()
95  {}
96 
97 
98  // Member Functions
99 
100  //- Return the table of species
101  inline const speciesTable& species() const;
102 
103  //- Does the mixture include this specie?
104  inline bool contains(const word& specieName) const;
105 
106  //- Return true for active species
107  inline bool active(label speciei) const;
108 
109  //- Return the bool list of active species
110  inline const List<bool>& active() const;
111 
112  //- Set speciei active
113  inline void setActive(label speciei) const;
114 
115  //- Set speciei inactive
116  inline void setInactive(label speciei) const;
117 
118  //- Return the mass-fraction fields
119  inline PtrList<volScalarField>& Y();
120 
121  //- Return the const mass-fraction fields
122  inline const PtrList<volScalarField>& Y() const;
123 
124  //- Return the mass-fraction field for a specie given by index
125  inline volScalarField& Y(const label i);
126 
127  //- Return the const mass-fraction field for a specie given by index
128  inline const volScalarField& Y(const label i) const;
129 
130  //- Return the mass-fraction field for a specie given by name
131  inline volScalarField& Y(const word& specieName);
132 
133  //- Return the const mass-fraction field for a specie given by name
134  inline const volScalarField& Y(const word& specieName) const;
135 
136 
137  // Specie properties
138 
139  //- Molecular weight of the given specie [kg/kmol]
140  virtual scalar Wi(const label speciei) const = 0;
141 
142  //- Enthalpy of formation [J/kg]
143  virtual scalar Hf(const label speciei) const = 0;
144 
145 
146  // Specie thermo properties
147 
148  //- Density [kg/m^3]
149  virtual scalar rho
150  (
151  const label speciei,
152  const scalar p,
153  const scalar T
154  ) const = 0;
155 
156  //- Density [kg/m^3]
157  virtual tmp<volScalarField> rho
158  (
159  const label speciei,
160  const volScalarField& p,
161  const volScalarField& T
162  ) const = 0;
163 
164  //- Heat capacity at constant pressure [J/kg/K]
165  virtual scalar Cp
166  (
167  const label speciei,
168  const scalar p,
169  const scalar T
170  ) const = 0;
171 
172  //- Heat capacity at constant pressure [J/kg/K]
173  virtual tmp<volScalarField> Cp
174  (
175  const label speciei,
176  const volScalarField& p,
177  const volScalarField& T
178  ) const = 0;
179 
180  //- Enthalpy/Internal energy [J/kg]
181  virtual scalar HE
182  (
183  const label speciei,
184  const scalar p,
185  const scalar T
186  ) const = 0;
187 
188  //- Enthalpy/Internal energy [J/kg]
189  virtual tmp<scalarField> HE
190  (
191  const label speciei,
192  const scalarField& p,
193  const scalarField& T
194  ) const = 0;
195 
196  //- Enthalpy/Internal energy [J/kg]
197  virtual tmp<volScalarField> HE
198  (
199  const label speciei,
200  const volScalarField& p,
201  const volScalarField& T
202  ) const = 0;
203 
204  //- Sensible enthalpy [J/kg]
205  virtual scalar Hs
206  (
207  const label speciei,
208  const scalar p,
209  const scalar T
210  ) const = 0;
211 
212  //- Sensible enthalpy [J/kg]
213  virtual tmp<scalarField> Hs
214  (
215  const label speciei,
216  const scalarField& p,
217  const scalarField& T
218  ) const = 0;
219 
220  //- Sensible enthalpy [J/kg]
221  virtual tmp<volScalarField> Hs
222  (
223  const label speciei,
224  const volScalarField& p,
225  const volScalarField& T
226  ) const = 0;
227 
228  //- Absolute enthalpy [J/kg]
229  virtual scalar Ha
230  (
231  const label speciei,
232  const scalar p,
233  const scalar T
234  ) const = 0;
235 
236  //- Enthalpy/Internal energy [J/kg]
237  virtual tmp<scalarField> Ha
238  (
239  const label speciei,
240  const scalarField& p,
241  const scalarField& T
242  ) const = 0;
243 
244  //- Absolute enthalpy [J/kg]
245  virtual tmp<volScalarField> Ha
246  (
247  const label speciei,
248  const volScalarField& p,
249  const volScalarField& T
250  ) const = 0;
251 
252 
253  // Specie transport properties
254 
255  //- Dynamic viscosity [kg/m/s]
256  virtual scalar mu
257  (
258  const label speciei,
259  const scalar p,
260  const scalar T
261  ) const = 0;
262 
263  //- Dynamic viscosity [kg/m/s]
264  virtual tmp<volScalarField> mu
265  (
266  const label speciei,
267  const volScalarField& p,
268  const volScalarField& T
269  ) const = 0;
270 
271  //- Thermal conductivity [W/m/K]
272  virtual scalar kappa
273  (
274  const label speciei,
275  const scalar p,
276  const scalar T
277  ) const = 0;
278 
279  //- Thermal conductivity [W/m/K]
280  virtual tmp<volScalarField> kappa
281  (
282  const label speciei,
283  const volScalarField& p,
284  const volScalarField& T
285  ) const = 0;
286 
287  //- Thermal conductivity [W/m/K]
288  virtual scalar alphah
289  (
290  const label speciei,
291  const scalar p,
292  const scalar T
293  ) const = 0;
294 
295  //- Thermal diffusivity of enthalpy [kg/m/s]
297  (
298  const label speciei,
299  const volScalarField& p,
300  const volScalarField& T
301  ) const = 0;
302 };
303 
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 } // End namespace Foam
308 
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 
311 #include "basicSpecieMixtureI.H"
312 
313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314 
315 #endif
316 
317 // ************************************************************************* //
void setInactive(label speciei) const
Set speciei inactive.
PtrList< volScalarField > Y_
Species mass fractions.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual scalar kappa(const label speciei, const scalar p, const scalar T) const =0
Thermal conductivity [W/m/K].
virtual scalar Ha(const label speciei, const scalar p, const scalar T) const =0
Absolute enthalpy [J/kg].
virtual scalar Wi(const label speciei) const =0
Molecular weight of the given specie [kg/kmol].
virtual scalar rho(const label speciei, const scalar p, const scalar T) const =0
Density [kg/m^3].
Specialization of basicMixture for a mixture consisting of a number for molecular species...
speciesTable species_
Table of specie names.
List< bool > active_
List of specie active flags.
virtual scalar Cp(const label speciei, const scalar p, const scalar T) const =0
Heat capacity at constant pressure [J/kg/K].
virtual scalar mu(const label speciei, const scalar p, const scalar T) const =0
Dynamic viscosity [kg/m/s].
A class for handling words, derived from string.
Definition: word.H:59
virtual scalar HE(const label speciei, const scalar p, const scalar T) const =0
Enthalpy/Internal energy [J/kg].
bool contains(const word &specieName) const
Does the mixture include this specie?
virtual ~basicSpecieMixture()
Destructor.
Foam::basicMixture.
Definition: basicMixture.H:50
virtual scalar alphah(const label speciei, const scalar p, const scalar T) const =0
Thermal conductivity [W/m/K].
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A wordList with hashed indices for faster lookup by name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
TypeName("basicSpecieMixture")
Run time type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual scalar Hs(const label speciei, const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
void setActive(label speciei) const
Set speciei active.
basicSpecieMixture basicMixtureType
The base class of the mixture.
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
PtrList< volScalarField > & Y()
Return the mass-fraction fields.
virtual scalar Hf(const label speciei) const =0
Enthalpy of formation [J/kg].
const List< bool > & active() const
Return the bool list of active species.
basicSpecieMixture(const dictionary &, const wordList &specieNames, const fvMesh &, const word &)
Construct from dictionary, species names, mesh and phase name.
Namespace for OpenFOAM.
const speciesTable & species() const
Return the table of species.