valueMulticomponentMixture.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) 2011-2025 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::valueMulticomponentMixture
26 
27 Description
28  Thermophysical properties mixing class which applies mass-fraction weighted
29  mixing to thermodynamic properties and mole-fraction weighted mixing to
30  transport properties.
31 
32 SourceFiles
33  valueMulticomponentMixture.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef valueMulticomponentMixture_H
38 #define valueMulticomponentMixture_H
39 
40 #include "multicomponentMixture.H"
41 #include "FieldListSlice.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class valueMulticomponentMixture Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class ThermoType>
54 :
55  public multicomponentMixture<ThermoType>
56 {
57 public:
58 
59  // Public Classes
60 
61  //- Mixing type for thermodynamic properties
62  class thermoMixtureType
63  {
64  // Private Data
65 
66  //- List of specie thermo
67  const PtrList<ThermoType>& specieThermos_;
68 
69  //- List of mass fractions
70  mutable List<scalar> Y_;
71 
72  //- Calculate a mass-fraction-weighted property
73  template<class Method, class ... Args>
74  scalar massWeighted
75  (
76  Method psiMethod,
77  const Args& ... args
78  ) const;
79 
80  //- Calculate a harmonic mass-fraction-weighted property
81  template<class Method, class ... Args>
82  scalar harmonicMassWeighted
83  (
84  Method psiMethod,
85  const Args& ... args
86  ) const;
87 
88  //- Limit the given temperature
89  scalar limit(const scalar T) const;
90 
91 
92  public:
93 
94  friend class valueMulticomponentMixture;
95 
96 
97  // Constructors
98 
99  //- Construct from list of specie thermo
101  :
102  specieThermos_(specieThermos),
103  Y_(specieThermos.size())
104  {}
105 
106 
107  // Fundamental properties
108 
109  //- Molecular weight [kg/kmol]
110  scalar W() const;
111 
112  //- Return density [kg/m^3]
113  scalar rho(scalar p, scalar T) const;
114 
115  //- Return compressibility [s^2/m^2]
116  scalar psi(scalar p, scalar T) const;
117 
118  //- Return volumetric coefficient of thermal expansion [1/T]
119  scalar alphav(const scalar p, const scalar T) const;
120 
121  // Heat capacity at constant pressure [J/kg/K]
122  scalar Cp(const scalar p, const scalar T) const;
123 
124  // Heat capacity at constant volume [J/kg/K]
125  scalar Cv(const scalar p, const scalar T) const;
126 
127  // Sensible enthalpy [J/kg]
128  scalar hs(const scalar p, const scalar T) const;
129 
130  // Sensible internal energy [J/kg]
131  scalar es(const scalar p, const scalar T) const;
132 
133  // Absolute enthalpy [J/kg]
134  scalar ha(const scalar p, const scalar T) const;
135 
136  // Enthalpy of formation [J/kg]
137  scalar hf() const;
138 
139 
140  // Mass specific derived properties
141 
142  //- Heat capacity at constant pressure/volume [J/kg/K]
143  scalar Cpv(const scalar p, const scalar T) const;
144 
145  //- Gamma = Cp/Cv []
146  scalar gamma(const scalar p, const scalar T) const;
147 
148  //- Enthalpy/Internal energy [J/kg]
149  scalar he(const scalar p, const scalar T) const;
150 
151 
152  // Energy->temperature inversion functions
153 
154  //- Temperature from enthalpy or internal energy
155  // given an initial temperature T0
156  scalar The
157  (
158  const scalar he,
159  const scalar p,
160  const scalar T0
161  ) const;
162 
163  //- Temperature from sensible internal energy
164  // given an initial temperature T0
165  scalar Tes
166  (
167  const scalar he,
168  const scalar p,
169  const scalar T0
170  ) const;
171  };
172 
173  //- Mixing type for transport properties
175  {
176  // Private Data
177 
178  //- List of specie thermo
179  const PtrList<ThermoType>& specieThermos_;
180 
181  //- List of mole fractions
182  mutable List<scalar> X_;
183 
184  //- Calculate a mole-fraction-weighted property
185  template<class Method, class ... Args>
186  scalar moleWeighted
187  (
188  Method psiMethod,
189  const Args& ... args
190  ) const;
191 
192 
193  public:
194 
195  friend class valueMulticomponentMixture;
196 
197 
198  // Constructors
199 
200  //- Construct from list of specie thermo
202  :
203  specieThermos_(specieThermos),
204  X_(specieThermos.size())
205  {}
206 
207 
208  // Transport properties
209 
210  //- Dynamic viscosity [kg/m/s]
211  scalar mu(const scalar p, const scalar T) const;
212 
213  //- Thermal conductivity [W/m/K]
214  scalar kappa(const scalar p, const scalar T) const;
215  };
216 
217 
218 private:
219 
220  // Private Data
221 
222  //- Mutable storage for the cell/face mixture thermo data
223  mutable thermoMixtureType thermoMixture_;
224 
225  //- Mutable storage for the cell/face mixture transport data
226  mutable transportMixtureType transportMixture_;
227 
228 
229 public:
230 
231  // Constructors
232 
233  //- Construct from a dictionary
235 
236  //- Disallow default bitwise copy construction
238  (
240  ) = delete;
241 
242 
243  // Member Functions
244 
245  //- Return the instantiated type name
246  static word typeName()
247  {
248  return "valueMulticomponentMixture<" + ThermoType::typeName() + '>';
249  }
250 
251  //- Return the mixture for thermodynamic properties
252  const thermoMixtureType& thermoMixture
253  (
254  const scalarFieldListSlice&
255  ) const;
256 
257  //- Return the mixture for transport properties
258  const transportMixtureType& transportMixture
259  (
260  const scalarFieldListSlice&
261  ) const;
262 
263  //- Return the mixture for transport properties
264  const transportMixtureType& transportMixture
265  (
266  const scalarFieldListSlice&,
267  const thermoMixtureType&
268  ) const;
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #ifdef NoRepository
280 #endif
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 #endif
285 
286 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Foam::multicomponentMixture.
const PtrList< ThermoType > & specieThermos() const
Return the raw specie thermodynamic data.
scalar psi(scalar p, scalar T) const
Return compressibility [s^2/m^2].
scalar alphav(const scalar p, const scalar T) const
Return volumetric coefficient of thermal expansion [1/T].
scalar Cp(const scalar p, const scalar T) const
scalar he(const scalar p, const scalar T) const
Enthalpy/Internal energy [J/kg].
scalar Tes(const scalar he, const scalar p, const scalar T0) const
Temperature from sensible internal energy.
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
scalar Cpv(const scalar p, const scalar T) const
Heat capacity at constant pressure/volume [J/kg/K].
scalar Cv(const scalar p, const scalar T) const
scalar ha(const scalar p, const scalar T) const
scalar gamma(const scalar p, const scalar T) const
Gamma = Cp/Cv [].
scalar es(const scalar p, const scalar T) const
scalar The(const scalar he, const scalar p, const scalar T0) const
Temperature from enthalpy or internal energy.
scalar hs(const scalar p, const scalar T) const
thermoMixtureType(const PtrList< ThermoType > &specieThermos)
Construct from list of specie thermo.
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
transportMixtureType(const PtrList< ThermoType > &specieThermos)
Construct from list of specie thermo.
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
Thermophysical properties mixing class which applies mass-fraction weighted mixing to thermodynamic p...
valueMulticomponentMixture(const dictionary &)
Construct from a dictionary.
static word typeName()
Return the instantiated type name.
const thermoMixtureType & thermoMixture(const scalarFieldListSlice &) const
Return the mixture for thermodynamic properties.
const transportMixtureType & transportMixture(const scalarFieldListSlice &) const
Return the mixture for transport properties.
A class for handling words, derived from string.
Definition: word.H:63
const scalar T0
Namespace for OpenFOAM.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
Foam::argList args(argc, argv)
volScalarField & p