Line | Branch | Exec | Source |
---|---|---|---|
1 | // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
2 | // vi: set et ts=4 sw=4 sts=4: | ||
3 | // | ||
4 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup Components | ||
10 | * \brief Properties of pure molecular hydrogen \f$H_2\f$. | ||
11 | */ | ||
12 | #ifndef DUMUX_H2_HH | ||
13 | #define DUMUX_H2_HH | ||
14 | |||
15 | #include <dumux/material/idealgas.hh> | ||
16 | |||
17 | #include <cmath> | ||
18 | |||
19 | #include <dumux/material/components/base.hh> | ||
20 | #include <dumux/material/components/gas.hh> | ||
21 | #include <dumux/material/components/shomate.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | namespace Components { | ||
25 | |||
26 | /*! | ||
27 | * \ingroup Components | ||
28 | * \brief Properties of pure molecular hydrogen \f$H_2\f$. | ||
29 | * | ||
30 | * \tparam Scalar The type used for scalar values | ||
31 | */ | ||
32 | template <class Scalar> | ||
33 | class H2 | ||
34 | : public Components::Base<Scalar, H2<Scalar> > | ||
35 | , public Components::Gas<Scalar, H2<Scalar> > | ||
36 | { | ||
37 | using IdealGas = Dumux::IdealGas<Scalar>; | ||
38 | using ShomateMethod = Dumux::ShomateMethod<Scalar, 3>; // three regions | ||
39 | |||
40 | public: | ||
41 | static const ShomateMethod shomateMethod; | ||
42 | |||
43 | /*! | ||
44 | * \brief A human readable name for the \f$H_2\f$. | ||
45 | */ | ||
46 | static std::string name() | ||
47 |
16/32✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
|
8 | { return "H2"; } |
48 | |||
49 | /*! | ||
50 | * \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular hydrogen. | ||
51 | */ | ||
52 | static constexpr Scalar molarMass() | ||
53 | { return 2.01588e-3; } | ||
54 | |||
55 | /*! | ||
56 | * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of molecular hydrogen. | ||
57 | */ | ||
58 | static Scalar criticalTemperature() | ||
59 | { return 33.2; /* [K] */ } | ||
60 | |||
61 | /*! | ||
62 | * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of molecular hydrogen. | ||
63 | */ | ||
64 | static Scalar criticalPressure() | ||
65 | { return 13.0e5; /* [N/m^2] */ } | ||
66 | |||
67 | /*! | ||
68 | * \brief Returns the temperature \f$\mathrm{[K]}\f$ at molecular hydrogen's triple point. | ||
69 | */ | ||
70 | static Scalar tripleTemperature() | ||
71 | { return 14.0; /* [K] */ } | ||
72 | |||
73 | /*! | ||
74 | * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure molecular hydrogen | ||
75 | * at a given temperature. | ||
76 | * | ||
77 | *\param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
78 | * | ||
79 | * Taken from: | ||
80 | * | ||
81 | * See: R. Reid, et al. (1987, pp 208-209, 669) \cite reid1987 | ||
82 | * | ||
83 | * \todo implement the Gomez-Thodos approach... | ||
84 | */ | ||
85 | static Scalar vaporPressure(Scalar temperature) | ||
86 | { | ||
87 | if (temperature > criticalTemperature()) | ||
88 | return criticalPressure(); | ||
89 | if (temperature < tripleTemperature()) | ||
90 | return 0; // H2 is solid: We don't take sublimation into | ||
91 | // account | ||
92 | |||
93 | // antoine equatuion | ||
94 | const Scalar A = -7.76451; | ||
95 | const Scalar B = 1.45838; | ||
96 | const Scalar C = -2.77580; | ||
97 | |||
98 | using std::exp; | ||
99 | return 1e5 * exp(A - B/(temperature + C)); | ||
100 | } | ||
101 | |||
102 | /*! | ||
103 | * \brief The density \f$\mathrm{[kg/m^3]}\f$ of \f$H_2\f$ at a given pressure and temperature. | ||
104 | * | ||
105 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
106 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
107 | */ | ||
108 | static Scalar gasDensity(Scalar temperature, Scalar pressure) | ||
109 | { | ||
110 | // Assume an ideal gas | ||
111 | 202 | return IdealGas::density(molarMass(), temperature, pressure); | |
112 | } | ||
113 | |||
114 | /*! | ||
115 | * \brief The molar density of \f$H_2\f$ in \f$\mathrm{[mol/m^3]}\f$, | ||
116 | * depending on pressure and temperature. | ||
117 | * \param temperature The temperature of the gas | ||
118 | * \param pressure The pressure of the gas | ||
119 | */ | ||
120 | static Scalar gasMolarDensity(Scalar temperature, Scalar pressure) | ||
121 | { return IdealGas::molarDensity(temperature, pressure); } | ||
122 | |||
123 | /*! | ||
124 | * \brief Returns true if the gas phase is assumed to be compressible | ||
125 | */ | ||
126 | static constexpr bool gasIsCompressible() | ||
127 | { return true; } | ||
128 | |||
129 | /*! | ||
130 | * \brief Returns true if the gas phase is assumed to be ideal | ||
131 | */ | ||
132 | static constexpr bool gasIsIdeal() | ||
133 | { return true; } | ||
134 | |||
135 | /*! | ||
136 | * \brief The pressure of gaseous \f$H_2\f$ in \f$\mathrm{[Pa]}\f$ at a given density and temperature. | ||
137 | * | ||
138 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
139 | * \param density density of component in \f$\mathrm{[kg/m^3]}\f$ | ||
140 | */ | ||
141 | static Scalar gasPressure(Scalar temperature, Scalar density) | ||
142 | { | ||
143 | // Assume an ideal gas | ||
144 | return IdealGas::pressure(temperature, density/molarMass()); | ||
145 | } | ||
146 | |||
147 | /*! | ||
148 | * \brief Specific enthalpy \f$\mathrm{[J/kg]}\f$ of pure hydrogen gas. | ||
149 | * Shomate Equation is used for a temperature range of 298K to 6000K. | ||
150 | * | ||
151 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
152 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
153 | */ | ||
154 | ✗ | static const Scalar gasEnthalpy(Scalar temperature, | |
155 | Scalar pressure) | ||
156 | { | ||
157 |
1/2✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
|
101 | const auto h = shomateMethod.enthalpy(temperature); // KJ/mol |
158 | 101 | return h * 1e3 / molarMass(); // J/kg | |
159 | } | ||
160 | |||
161 | /*! | ||
162 | * \brief Specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$ of pure | ||
163 | * hydrogen gas. | ||
164 | * Shomate Equation is used for a temperature range of 298K to 6000K. | ||
165 | * | ||
166 | * \param T temperature of component in \f$\mathrm{[K]}\f$ | ||
167 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
168 | * | ||
169 | * See: R. Reid, et al. (1987, pp 154, 657, 665) \cite reid1987 | ||
170 | */ | ||
171 | ✗ | static const Scalar gasHeatCapacity(Scalar T, | |
172 | Scalar pressure) | ||
173 | { | ||
174 |
1/2✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
|
101 | const auto cp = shomateMethod.heatCapacity(T); // J/(mol K) |
175 | 101 | return cp / molarMass(); // J/(kg K) | |
176 | } | ||
177 | |||
178 | /*! | ||
179 | * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of \f$H_2\f$ at a given pressure and temperature. | ||
180 | * | ||
181 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
182 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
183 | * | ||
184 | * See: | ||
185 | * | ||
186 | * See: R. Reid, et al.: The Properties of Gases and Liquids, | ||
187 | * 4th edition (1987, pp 396-397, 667) \cite reid1987 <BR> | ||
188 | * 5th edition (2001, pp 9.7-9.8 (omega and V_c taken from p. A.19)) \cite poling2001 | ||
189 | */ | ||
190 | 101 | static Scalar gasViscosity(Scalar temperature, Scalar pressure) | |
191 | { | ||
192 | 101 | const Scalar Tc = criticalTemperature(); | |
193 | 101 | const Scalar Vc = 65.0; // critical specific volume [cm^3/mol] | |
194 | 101 | const Scalar omega = -0.216; // accentric factor | |
195 | 101 | const Scalar M = molarMass() * 1e3; // molar mas [g/mol] | |
196 | 101 | const Scalar dipole = 0.0; // dipole moment [debye] | |
197 | |||
198 | using std::sqrt; | ||
199 | 101 | Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); | |
200 | 101 | mu_r4 *= mu_r4; | |
201 | 101 | mu_r4 *= mu_r4; | |
202 | |||
203 | using std::pow; | ||
204 | using std::exp; | ||
205 | 101 | Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; | |
206 | 101 | Scalar Tstar = 1.2593 * temperature/Tc; | |
207 | 101 | Scalar Omega_v = | |
208 | 202 | 1.16145*pow(Tstar, -0.14874) + | |
209 | 101 | 0.52487*exp(- 0.77320*Tstar) + | |
210 | 101 | 2.16178*exp(- 2.43787*Tstar); | |
211 | 101 | Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); | |
212 | |||
213 | // conversion from micro poise to Pa s | ||
214 | 101 | return mu/1e6 / 10; | |
215 | } | ||
216 | }; | ||
217 | |||
218 | /*! | ||
219 | * \brief Shomate parameters for hydrogen published by NIST \cite NIST | ||
220 | * https://webbook.nist.gov/cgi/cbook.cgi?ID=C1333740&Units=SI&Mask=1&Type=JANAFG&Table=on#JANAFG | ||
221 | * First row defines the temperature ranges, further rows give the parameters (A,B,C,D,E,F,G,H) for the respective temperature ranges. | ||
222 | */ | ||
223 | template <class Scalar> | ||
224 | const typename H2<Scalar>::ShomateMethod H2<Scalar>::shomateMethod{ | ||
225 | /*temperature*/{298.0, 1000.0, 2500.0, 6000.0}, | ||
226 | typename H2<Scalar>::ShomateMethod::Coefficients{{ | ||
227 | {33.066178, -11.363417, 11.432816, -2.772874, -0.158558, -9.980797, 172.707974, 0.0}, | ||
228 | {18.563083, 12.257357, -2.859786, 0.268238, 1.97799, -1.147438, 156.288133, 0.0}, | ||
229 | {43.41356, -4.293079, 1.272428, -0.096876, -20.533862, -38.515158, 162.081354, 0.0} | ||
230 | }} | ||
231 | }; | ||
232 | |||
233 | } // end namespace Components | ||
234 | } // end namespace Dumux | ||
235 | |||
236 | #endif | ||
237 |