GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/components/o2.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 33 45 73.3%
Functions: 2 5 40.0%
Branches: 27 50 54.0%

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 oxygen \f$O_2\f$.
11 */
12 #ifndef DUMUX_O2_HH
13 #define DUMUX_O2_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
22 namespace Dumux {
23 namespace Components {
24
25 /*!
26 * \ingroup Components
27 * \brief Properties of pure molecular oxygen \f$O_2\f$.
28 *
29 * \tparam Scalar The type used for scalar values
30 */
31 template <class Scalar>
32 class O2
33 : public Components::Base<Scalar, O2<Scalar> >
34 , public Components::Gas<Scalar, O2<Scalar> >
35 {
36 using IdealGas = Dumux::IdealGas<Scalar>;
37
38 public:
39 /*!
40 * \brief A human readable name for the \f$O_2\f$.
41 */
42 static std::string name()
43
22/42
✓ 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.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
34 { return "O2"; }
44
45 /*!
46 * \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular oxygen.
47 */
48 static constexpr Scalar molarMass()
49 { return 32e-3; }
50
51 /*!
52 * \brief Returns the critical temperature in \f$\mathrm{[K]}\f$ of molecular oxygen.
53 */
54 static constexpr Scalar criticalTemperature()
55 { return 154.581; /* [K] */ }
56
57 /*!
58 * \brief Returns the critical pressure in \f$\mathrm{[Pa]}\f$ of molecular oxygen.
59 */
60 static constexpr Scalar criticalPressure()
61 { return 5.0804e6; /* [N/m^2] */ }
62
63 /*!
64 * \brief Returns the temperature in \f$\mathrm{[K]}\f$ at molecular oxygen's triple point.
65 */
66 static constexpr Scalar tripleTemperature()
67 { return 54.359; /* [K] */ }
68
69 /*!
70 * \brief Returns the pressure in \f$\mathrm{[Pa]}\f$ at molecular oxygen's triple point.
71 */
72 static constexpr Scalar triplePressure()
73 { return 148.0; /* [N/m^2] */ }
74
75 /*!
76 * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure molecular oxygen
77 * at a given temperature.
78 *
79 * \param T temperature of component in \f$\mathrm{[K]}\f$
80 *
81 * Taken from:
82 *
83 * R. Prydz (1972, pp. 1-4) \cite prydz1972
84 */
85 3 static Scalar vaporPressure(Scalar T)
86 {
87
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (T > criticalTemperature())
88 return criticalPressure();
89 if (T < tripleTemperature())
90 return 0; // O2 is solid: We don't take sublimation into account
91
92 // vapor pressure between tripe and critical points. See the
93 // paper of Prydz for a discussion
94 Scalar X =
95 (1 - tripleTemperature()/T) /
96 (1 - tripleTemperature()/criticalTemperature());
97 const Scalar A = 7.568956;
98 const Scalar B = 5.004836;
99 const Scalar C = -2.137460;
100 const Scalar D = 3.454481;
101 const Scalar epsilon = 1.514;
102
103 using std::exp;
104 using std::pow;
105 return triplePressure()*exp(X*(A + X*(B + C*X) + D*pow(1 - X, epsilon)));
106 }
107
108 /*!
109 * \brief Returns true if the gas phase is assumed to be compressible
110 */
111 static constexpr bool gasIsCompressible()
112 { return true; }
113
114 /*!
115 * \brief The density in \f$\mathrm{[kg/m^3]}\f$ of pure \f$O_2\f$ at a given pressure and temperature.
116 *
117 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
118 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
119 *
120 * \todo: density liquid oxygen
121 */
122 static constexpr Scalar gasDensity(Scalar temperature, Scalar pressure)
123 {
124 // Assume an ideal gas
125
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
603656 return IdealGas::density(molarMass(), temperature, pressure);
126 }
127
128 /*!
129 * \brief The molar density of pure \f$O_2\f$ in \f$\mathrm{[mol/m^3]}\f$,
130 * depending on pressure and temperature.
131 * \param temperature The temperature of the gas
132 * \param pressure The pressure of the gas
133 */
134 static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
135 603430 { return IdealGas::molarDensity(temperature, pressure); }
136
137 /*!
138 * \brief Returns true if the gas phase is assumed to be ideal
139 */
140 static constexpr bool gasIsIdeal()
141 { return true; }
142
143 /*!
144 * \brief The pressure of gaseous \f$O_2\f$ in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
145 *
146 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
147 * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
148 */
149 static constexpr Scalar gasPressure(Scalar temperature, Scalar density)
150 {
151 // Assume an ideal gas
152 18 return IdealGas::pressure(temperature, density/molarMass());
153 }
154
155 /*!
156 * \brief Specific enthalpy \f$\mathrm{[J/kg]}\f$ of pure oxygen gas.
157 *
158 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
159 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
160 */
161 static Scalar gasEnthalpy(Scalar temperature,
162 Scalar pressure)
163 {
164 279034 return gasHeatCapacity(temperature, pressure) * temperature;
165 }
166
167 /*!
168 * \brief Specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$ of pure
169 * oxygen gas.
170 *
171 * This is equivalent to the partial derivative of the specific
172 * enthalpy to the temperature.
173 * \param T absolute temperature in \f$\mathrm{[K]}\f$
174 * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
175 *
176 * See: R. Reid, et al. (1987, pp 154, 657, 665) \cite reid1987
177 */
178 static Scalar gasHeatCapacity(Scalar T,
179 Scalar pressure)
180 {
181 // method of Joback
182 139629 const Scalar cpVapA = 28.11;
183 139629 const Scalar cpVapB = -3.680e-6;
184 139629 const Scalar cpVapC = 1.746e-5;
185 139629 const Scalar cpVapD = -1.065e-8;
186
187 return
188 1/molarMass()* // conversion from [J/(mol*K)] to [J/(kg*K)]
189 139629 (cpVapA + T*
190 139629 (cpVapB/2 + T*
191 139629 (cpVapC/3 + T*
192 139629 (cpVapD/4))));
193 }
194
195 /*!
196 * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of \f$O_2\f$ at a given pressure and temperature.
197 *
198 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
199 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
200 *
201 * See:
202 *
203 * See: R. Reid, et al. (1987, pp 396-397, 664) \cite reid1987
204 */
205 301825 static Scalar gasViscosity(Scalar temperature, Scalar pressure)
206 {
207 301825 const Scalar Tc = criticalTemperature();
208 301825 const Scalar Vc = 73.4; // critical specific volume [cm^3/mol]
209 301825 const Scalar omega = 0.025; // accentric factor
210 301825 const Scalar M = molarMass() * 1e3; // molar mas [g/mol]
211 301825 const Scalar dipole = 0.0; // dipole moment [debye]
212
213 using std::sqrt;
214 301825 Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc);
215 301825 mu_r4 *= mu_r4;
216 301825 mu_r4 *= mu_r4;
217
218 301825 Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4;
219 301825 Scalar Tstar = 1.2593 * temperature/Tc;
220
221 using std::pow;
222 using std::exp;
223 301825 Scalar Omega_v =
224 603650 1.16145*pow(Tstar, -0.14874) +
225 301825 0.52487*exp(- 0.77320*Tstar) +
226 301825 2.16178*exp(- 2.43787*Tstar);
227 301825 Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v);
228
229 // conversion from micro poise to Pa s
230 301825 return mu/1e6 / 10;
231 }
232
233 /*!
234 * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of nitrogen.
235 *
236 * Isobaric Properties for Nitrogen and Oxygen in: NIST Standard
237 * Reference Database Number 69, Eds. P.J. Linstrom and
238 * W.G. Mallard evaluated at p=.1 MPa, does not
239 * change dramatically with p and can be interpolated linearly with temperature
240 *
241 * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
242 * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
243 */
244 static constexpr Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
245 {
246 139517 return 8.044e-5 * (temperature - 273.15) + 0.024486;
247 }
248 };
249
250 } // end namespace Components
251
252 } // end namespace Dumux
253
254 #endif
255