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 methane \f$CH_4\f$. | ||
11 | */ | ||
12 | #ifndef DUMUX_CH4_HH | ||
13 | #define DUMUX_CH4_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 methane \f$CH_4\f$. | ||
29 | * \tparam Scalar The type used for scalar values | ||
30 | */ | ||
31 | template <class Scalar> | ||
32 | class CH4 | ||
33 | : public Components::Base<Scalar, CH4<Scalar> > | ||
34 | , public Components::Gas<Scalar, CH4<Scalar> > | ||
35 | { | ||
36 | using IdealGas = Dumux::IdealGas<Scalar>; | ||
37 | using ShomateMethod = Dumux::ShomateMethod<Scalar, 3>; // three regions | ||
38 | |||
39 | public: | ||
40 | static const ShomateMethod shomateMethod; | ||
41 | |||
42 | /*! | ||
43 | * \brief A human readable name for methane. | ||
44 | */ | ||
45 | static std::string name() | ||
46 |
18/34✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ 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.
|
10 | { return "CH4"; } |
47 | |||
48 | /*! | ||
49 | * \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular methane. | ||
50 | */ | ||
51 | static constexpr Scalar molarMass() | ||
52 | { return 16.043e-3; /* [kg/mol] */} | ||
53 | |||
54 | /*! | ||
55 | * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of molecular methane | ||
56 | */ | ||
57 | static Scalar criticalTemperature() | ||
58 | { return 190.4; /* [K] */ } | ||
59 | |||
60 | /*! | ||
61 | * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of molecular methane | ||
62 | */ | ||
63 | static Scalar criticalPressure() | ||
64 | { return 46e5; /* [Pa] */ } | ||
65 | |||
66 | /*! | ||
67 | * \brief Returns the temperature \f$\mathrm{[K]}\f$ at molecular methane's triple point. | ||
68 | */ | ||
69 | static Scalar tripleTemperature() | ||
70 | { return 90.7; /* [K] */ } | ||
71 | |||
72 | /*! | ||
73 | * \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at molecular methane's triple point. | ||
74 | */ | ||
75 | static Scalar triplePressure() | ||
76 | { return 0; /* [Pa] */ } | ||
77 | |||
78 | /*! | ||
79 | * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure molecular methane | ||
80 | * at a given temperature. | ||
81 | * | ||
82 | *\param T temperature of component in \f$\mathrm{[K]}\f$ | ||
83 | */ | ||
84 | static Scalar vaporPressure(Scalar T) | ||
85 | { DUNE_THROW(Dune::NotImplemented, "vaporPressure for CH4"); } | ||
86 | |||
87 | /*! | ||
88 | * \brief Returns true if the gas phase is assumed to be compressible | ||
89 | */ | ||
90 | static constexpr bool gasIsCompressible() | ||
91 | { return true; } | ||
92 | |||
93 | /*! | ||
94 | * \brief The density \f$\mathrm{[kg/m^3]}\f$ of \f$CH_4\f$ gas at a given pressure and temperature. | ||
95 | * | ||
96 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
97 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
98 | */ | ||
99 | static Scalar gasDensity(Scalar temperature, Scalar pressure) | ||
100 | { | ||
101 | // Assume an ideal gas | ||
102 | 739244 | return IdealGas::density(molarMass(), temperature, pressure); | |
103 | } | ||
104 | |||
105 | /*! | ||
106 | * \brief The molar density of \f$CH_4\f$ gas in \f$\mathrm{[mol/m^3]}\f$, | ||
107 | * depending on pressure and temperature. | ||
108 | * \param temperature The temperature of the gas | ||
109 | * \param pressure The pressure of the gas | ||
110 | */ | ||
111 | static Scalar gasMolarDensity(Scalar temperature, Scalar pressure) | ||
112 | { return IdealGas::molarDensity(temperature, pressure); } | ||
113 | |||
114 | /*! | ||
115 | * \brief Returns true if the gas phase is assumed to be ideal | ||
116 | */ | ||
117 | static constexpr bool gasIsIdeal() | ||
118 | { return true; } | ||
119 | |||
120 | /*! | ||
121 | * \brief The pressure of gaseous \f$CH_4\f$ in \f$\mathrm{[Pa]}\f$ at a given density and temperature. | ||
122 | * | ||
123 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
124 | * \param density density of component in \f$\mathrm{[kg/m^3]}\f$ | ||
125 | */ | ||
126 | static Scalar gasPressure(Scalar temperature, Scalar density) | ||
127 | { | ||
128 | // Assume an ideal gas | ||
129 | 18 | return IdealGas::pressure(temperature, density/molarMass()); | |
130 | } | ||
131 | |||
132 | /*! | ||
133 | * \brief Specific enthalpy \f$\mathrm{[J/kg]}\f$ of pure methane gas. | ||
134 | * Shomate Equation is used for a temperature range of 298K to 6000K. | ||
135 | * | ||
136 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
137 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
138 | */ | ||
139 | ✗ | static const Scalar gasEnthalpy(Scalar temperature, | |
140 | Scalar pressure) | ||
141 | { | ||
142 |
1/2✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
|
110 | const auto h = shomateMethod.enthalpy(temperature); // KJ/mol |
143 | 110 | return h * 1e3 / molarMass(); // J/kg | |
144 | } | ||
145 | |||
146 | /*! | ||
147 | * \brief Specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$ of pure methane gas. | ||
148 | *Shomate Equation is used for a temperature range of 298K to 6000K. | ||
149 | */ | ||
150 | ✗ | static Scalar gasHeatCapacity(Scalar T, | |
151 | Scalar pressure) | ||
152 | { | ||
153 |
1/2✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
|
110 | const auto cp = shomateMethod.heatCapacity(T); // J/(mol K) |
154 | 110 | return cp / molarMass(); // J/(kg K) | |
155 | } | ||
156 | |||
157 | /*! | ||
158 | * \brief Specific enthalpy \f$\mathrm{[J/kg]}\f$ of pure methane gas. | ||
159 | * | ||
160 | * Definition of enthalpy: \f$h= u + pv = u + p / \rho\f$. | ||
161 | * | ||
162 | * Rearranging for internal energy yields: \f$u = h - pv\f$. | ||
163 | * | ||
164 | * Exploiting the Ideal Gas assumption (\f$pv = R_{\textnormal{specific}} T\f$)gives: \f$u = h - R / M T \f$. | ||
165 | * | ||
166 | * The universal gas constant can only be used in the case of molar formulations. | ||
167 | * | ||
168 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
169 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
170 | */ | ||
171 | static const Scalar gasInternalEnergy(Scalar temperature, | ||
172 | Scalar pressure) | ||
173 | { | ||
174 | |||
175 | return | ||
176 | gasEnthalpy(temperature, pressure) - | ||
177 | 1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)] | ||
178 | IdealGas::R*temperature; // = pressure * spec. volume for an ideal gas | ||
179 | } | ||
180 | |||
181 | /*! | ||
182 | * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of \f$CH_4\f$ at a given pressure and temperature. | ||
183 | * | ||
184 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
185 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
186 | * | ||
187 | * See: | ||
188 | * | ||
189 | * See: R. Reid, et al.: The Properties of Gases and Liquids, | ||
190 | * 4th edition (1987, pp 396-397, 670) \cite reid1987 <BR> | ||
191 | * 5th edition (2001, pp 9.7-9.8 (omega and V_c taken from p. A.5)) \cite poling2001 | ||
192 | * | ||
193 | */ | ||
194 | 369622 | static Scalar gasViscosity(Scalar temperature, Scalar pressure) | |
195 | { | ||
196 | 369622 | const Scalar Tc = criticalTemperature(); | |
197 | 369622 | const Scalar Vc = 98.6; // critical specific volume [cm^3/mol] | |
198 | 369622 | const Scalar omega = 0.011; // accentric factor | |
199 | 369622 | const Scalar M = molarMass() * 1e3; // molar mas [g/mol] | |
200 | 369622 | const Scalar dipole = 0.0; // dipole moment [debye] | |
201 | |||
202 | using std::sqrt; | ||
203 | 369622 | Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); | |
204 | 369622 | mu_r4 *= mu_r4; | |
205 | 369622 | mu_r4 *= mu_r4; | |
206 | |||
207 | using std::exp; | ||
208 | using std::pow; | ||
209 | 369622 | Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; | |
210 | 369622 | Scalar Tstar = 1.2593 * temperature/Tc; | |
211 | 369622 | Scalar Omega_v = | |
212 | 739244 | 1.16145*pow(Tstar, -0.14874) + | |
213 | 369622 | 0.52487*exp(- 0.77320*Tstar) + | |
214 | 369622 | 2.16178*exp(- 2.43787*Tstar); | |
215 | 369622 | Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); | |
216 | |||
217 | // conversion from micro poise to Pa s | ||
218 | 369622 | return mu/1e6 / 10; | |
219 | } | ||
220 | }; | ||
221 | |||
222 | /*! | ||
223 | * \brief Shomate parameters for methane published by NIST \cite NIST | ||
224 | * https://webbook.nist.gov/cgi/cbook.cgi?ID=C74828&Units=SI&Mask=1&Type=JANAFG&Table=on#JANAFG | ||
225 | * First row defines the temperature ranges, further rows give the parameters (A,B,C,D,E,F,G,H) for the respective temperature ranges. | ||
226 | */ | ||
227 | template <class Scalar> | ||
228 | const typename CH4<Scalar>::ShomateMethod CH4<Scalar>::shomateMethod{ | ||
229 | /*temperature*/{298.0, 1300.0, 6000.0}, | ||
230 | typename CH4<Scalar>::ShomateMethod::Coefficients{{ | ||
231 | {-0.703029, 108.4773, -42.52157, 5.862788, 0.678565, -76.84376, 158.7163, -74.87310}, | ||
232 | {85.81217, 11.26467, -2.114146, 0.138190, -26.42221, -153.5327, 224.4143, -74.87310} | ||
233 | }} | ||
234 | }; | ||
235 | |||
236 | } // end namespace Components | ||
237 | } // end namespace Dumux | ||
238 | |||
239 | #endif | ||
240 |