GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/components/mesitylene.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 42 73 57.5%
Functions: 3 8 37.5%
Branches: 52 103 50.5%

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 mesitylene.
11 */
12 #ifndef DUMUX_MESITYLENE_HH
13 #define DUMUX_MESITYLENE_HH
14
15 #include <dumux/material/idealgas.hh>
16 #include <dumux/material/constants.hh>
17
18 #include <dumux/material/components/base.hh>
19 #include <dumux/material/components/liquid.hh>
20 #include <dumux/material/components/gas.hh>
21
22 namespace Dumux {
23 namespace Components {
24
25 /*!
26 * \ingroup Components
27 * \brief mesitylene
28 *
29 * \tparam Scalar The type used for scalar values
30 */
31 template <class Scalar>
32 class Mesitylene
33 : public Components::Base<Scalar, Mesitylene<Scalar> >
34 , public Components::Liquid<Scalar, Mesitylene<Scalar> >
35 , public Components::Gas<Scalar, Mesitylene<Scalar> >
36 {
37 using Consts = Constants<Scalar>;
38 using IdealGas = Dumux::IdealGas<Scalar>;
39 public:
40 /*!
41 * \brief A human readable name for the mesitylene
42 */
43 static std::string name()
44
34/66
✓ 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.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 1 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 1 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 1 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 1 times.
✗ Branch 95 not taken.
44 { return "mesitylene"; }
45
46 /*!
47 * \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of mesitylene
48 */
49 constexpr static Scalar molarMass()
50 { return 0.120; }
51
52 /*!
53 * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of mesitylene
54 */
55 constexpr static Scalar criticalTemperature()
56 { return 637.3; }
57
58 /*!
59 * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of mesitylene
60 */
61 constexpr static Scalar criticalPressure()
62 { return 31.3e5; }
63
64 /*!
65 * \brief Returns the temperature \f$\mathrm{[K]}\f$ at mesitylene's boiling point (1 atm).
66 */
67 constexpr static Scalar boilingTemperature()
68 { return 437.9; }
69
70 /*!
71 * \brief Returns the temperature \f$\mathrm{[K]}\f$ at mesitylene's triple point.
72 */
73 static Scalar tripleTemperature()
74 {
75 DUNE_THROW(Dune::NotImplemented, "tripleTemperature for mesitylene");
76 }
77
78 /*!
79 * \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at mesitylene's triple point.
80 */
81 static Scalar triplePressure()
82 {
83 DUNE_THROW(Dune::NotImplemented, "triplePressure for mesitylene");
84 }
85
86 /*!
87 * \brief The saturation vapor pressure in \f$\mathrm{[Pa]}\f$ of
88 * pure mesitylene at a given temperature according to
89 * Antoine after Betz 1997, see Gmehling et al 1980
90 *
91 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
92 */
93 static Scalar vaporPressure(Scalar temperature)
94 {
95 7618767 const Scalar A = 7.07638;
96 7618767 const Scalar B = 1571.005;
97 7618767 const Scalar C = 209.728;
98
99 7618767 const Scalar T = temperature - 273.15;
100
101 using std::pow;
102
3/3
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2764137 times.
✓ Branch 2 taken 2764136 times.
7618767 return 100 * 1.334 * pow(Scalar(10.0), Scalar(A - (B / (T + C))));
103 }
104
105
106 /*!
107 * \brief Specific enthalpy of liquid mesitylene \f$\mathrm{[J/kg]}\f$.
108 *
109 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
110 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
111 */
112 3775448 static Scalar liquidEnthalpy(const Scalar temperature,
113 const Scalar pressure)
114 {
115 // Gauss quadrature rule:
116 // Interval: [0K; temperature (K)]
117 // Gauss-Legendre-Integration with variable transformation:
118 // \int_a^b f(T) dT \approx (b-a)/2 \sum_i=1^n \alpha_i f( (b-a)/2 x_i + (a+b)/2 )
119 // with: n=2, legendre -> x_i = +/- \sqrt(1/3), \apha_i=1
120 // here: a=273.15K, b=actual temperature in Kelvin
121 // \leadsto h(T) = \int_273.15^T c_p(T) dT
122 // \approx 0.5 (T-273.15) * (cp( 0.5(temperature-273.15)sqrt(1/3) ) + cp(0.5(temperature-273.15)(-1)sqrt(1/3))
123
124 // Enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input and is
125 // fit over a certain temperature range. This suggests choosing an interval of integration being in the actual fit range.
126 // I.e. choosing T=273.15K as reference point for liquid enthalpy.
127 using std::sqrt;
128 3775448 const Scalar sqrt1over3 = sqrt(1./3.);
129 // evaluation points according to Gauss-Legendre integration
130 3775448 const Scalar TEval1 = 0.5*(temperature-273.15)* sqrt1over3 + 0.5*(273.15+temperature);
131 // evaluation points according to Gauss-Legendre integration
132 3775448 const Scalar TEval2 = 0.5*(temperature-273.15)* (-1)* sqrt1over3 + 0.5*(273.15+temperature);
133
134 3775448 const Scalar h_n = 0.5 * (temperature-273.15) * ( liquidHeatCapacity(TEval1, pressure) + liquidHeatCapacity(TEval2, pressure) );
135
136 3775448 return h_n;
137 }
138
139 /*!
140 * \brief Latent heat of vaporization for mesitylene \f$\mathrm{[J/kg]}\f$.
141 *
142 * source : Reid et al. (1987, Chen method (chap. 7-11, Delta H_v = Delta H_v (T) according to chap. 7-12)) \cite reid1987
143 *
144 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
145 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
146 */
147 static Scalar heatVap(Scalar temperature,
148 const Scalar pressure)
149 {
150 using std::min;
151 using std::max;
152 temperature = min(temperature, criticalTemperature()); // regularization
153 temperature = max(temperature, 0.0); // regularization
154
155 constexpr Scalar T_crit = criticalTemperature();
156 constexpr Scalar Tr1 = boilingTemperature()/criticalTemperature();
157 constexpr Scalar p_crit = criticalPressure();
158
159 // Chen method, eq. 7-11.4 (at boiling)
160 using std::log;
161 const Scalar DH_v_boil = Consts::R * T_crit * Tr1 * (3.978 * Tr1 - 3.958 + 1.555*log(p_crit * 1e-5 /*Pa->bar*/ ) )
162 / (1.07 - Tr1); /* [J/mol] */
163
164 /* Variation with temp according to Watson relation eq 7-12.1*/
165 using std::pow;
166 const Scalar Tr2 = temperature/criticalTemperature();
167 const Scalar n = 0.375;
168 const Scalar DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n);
169
170 return (DH_vap/molarMass()); // we need [J/kg]
171 }
172
173
174 /*!
175 * \brief Specific enthalpy of mesitylene vapor \f$\mathrm{[J/kg]}\f$.
176 *
177 * This relation is true on the vapor pressure curve, i.e. as long
178 * as there is a liquid phase present.
179 *
180 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
181 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
182 */
183 static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
184 {
185 1887724 return liquidEnthalpy(temperature,pressure) + heatVap(temperature, pressure);
186 }
187
188 /*!
189 * \brief The density of mesitylene at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$ .
190 *
191 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
192 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
193 */
194 static Scalar gasDensity(Scalar temperature, Scalar pressure)
195 {
196
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
4181204 return IdealGas::density(molarMass(),
197 temperature,
198 pressure);
199 }
200
201 /*!
202 * \brief The molar density of mesitylene in \f$\mathrm{[mol/m^3]}\f$,
203 * depending on pressure and temperature.
204 * \param temperature The temperature of the gas
205 * \param pressure The pressure of the gas
206 */
207 static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
208 2764138 { return IdealGas::molarDensity(temperature, pressure); }
209
210 /*!
211 * \brief The density of pure mesitylene at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
212 *
213 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
214 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
215 */
216 static Scalar liquidDensity(Scalar temperature, Scalar pressure)
217 {
218
2/2
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 2 times.
2343503 return liquidMolarDensity(temperature, pressure)*molarMass();
219 }
220
221 /*!
222 * \brief The molar density of pure mesitylene at a given pressure and temperature
223 * \f$\mathrm{[mol/m^3]}\f$.
224 *
225 * source : Reid et al. (1987, Modified Racket technique (chap. 3-11, eq. 3-11.9)) \cite reid1987
226 *
227 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
228 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
229 */
230 static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
231 {
232 using std::min;
233 using std::max;
234 temperature = min(temperature, 500.0); // regularization
235 temperature = max(temperature, 250.0);
236
237 const Scalar Z_RA = 0.2556; // from equation
238
239 using std::pow;
240 const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
241 Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
242
243 return 1.0/V; // molar density [mol/m^3]
244 }
245
246 /*!
247 * \brief Returns true if the gas phase is assumed to be compressible
248 */
249 static constexpr bool gasIsCompressible()
250 { return true; }
251
252 /*!
253 * \brief Returns true if the gas phase is assumed to be ideal
254 */
255 static constexpr bool gasIsIdeal()
256 { return true; }
257
258 /*!
259 * \brief Returns true if the liquid phase is assumed to be compressible
260 */
261 static constexpr bool liquidIsCompressible()
262 { return false; }
263
264 /*!
265 * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of mesitylene vapor
266 *
267 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
268 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
269 */
270 2090599 static Scalar gasViscosity(Scalar temperature, Scalar pressure)
271 {
272 using std::min;
273 using std::max;
274
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2090599 times.
2090599 temperature = min(temperature, 500.0); // regularization
275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2090599 times.
2090599 temperature = max(temperature, 250.0);
276
277 // reduced temperature
278 2090599 Scalar Tr = temperature/criticalTemperature();
279
280 2090599 Scalar Fp0 = 1.0;
281 2090599 Scalar xi = 0.00474;
282
283 using std::pow;
284 using std::exp;
285 2090599 Scalar eta_xi =
286 2090599 Fp0*(0.807*pow(Tr,0.618)
287 2090599 - 0.357*exp(-0.449*Tr)
288 2090599 + 0.34*exp(-4.058*Tr)
289 2090599 + 0.018);
290
291 2090599 return eta_xi/xi/1e7; // [Pa s]
292 }
293
294 /*!
295 * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure mesitylene.
296 *
297 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
298 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
299 */
300 static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
301 {
302 using std::min;
303 using std::max;
304 temperature = min(temperature, 500.0); // regularization
305 temperature = max(temperature, 250.0);
306
307 const Scalar A = -6.749;
308 const Scalar B = 2010.0;
309
310 using std::exp;
311 return exp(A + B/temperature)*1e-3; // [Pa s]
312 }
313
314 /*!
315 * \brief Specific heat capacity of liquid mesitylene \f$\mathrm{[J/(kg*K)]}\f$.
316 *
317 * source : Reid et al. (1987, Missenard group contrib. method (chap 5-7, Table 5-11, s. example 5-8)) \cite reid1987
318 *
319 * \param temperature temperature of component in \f$\mathrm{[K]}\f$
320 * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
321 *
322 */
323 7551006 static Scalar liquidHeatCapacity(const Scalar temperature,
324 const Scalar pressure)
325 {
326 /* according Reid et al. : Missenard group contrib. method (s. example 5-8) */
327 /* Mesitylen: C9H12 : 3* CH3 ; 1* C6H5 (phenyl-ring) ; -2* H (this was to much!) */
328 /* linear interpolation between table values [J/(mol K)]*/
329 Scalar H, CH3, C6H5;
330
2/2
✓ Branch 0 taken 7364253 times.
✓ Branch 1 taken 186753 times.
7551006 if(temperature<298.) {
331 // extrapolation for Temperature<273 */
332 7364253 H = 13.4+1.2*(temperature-273.0)/25.; // 13.4 + 1.2 = 14.6 = H(T=298K) i.e. interpolation of table values 273<T<298
333 7364253 CH3 = 40.0+1.6*(temperature-273.0)/25.; // 40 + 1.6 = 41.6 = CH3(T=298K)
334 7364253 C6H5 = 113.0+4.2*(temperature-273.0)/25.; // 113 + 4.2 =117.2 = C6H5(T=298K)
335 }
336
3/4
✓ Branch 0 taken 186753 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 107332 times.
✓ Branch 3 taken 79421 times.
186753 else if((temperature>=298.0)&&(temperature<323.)){ // i.e. interpolation of table values 298<T<323
337 107332 H = 14.6+0.9*(temperature-298.0)/25.;
338 107332 CH3 = 41.6+1.9*(temperature-298.0)/25.;
339 107332 C6H5 = 117.2+6.2*(temperature-298.0)/25.;
340 }
341
2/4
✓ Branch 0 taken 79421 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 79421 times.
✗ Branch 3 not taken.
79421 else if((temperature>=323.0)&&(temperature<348.)){// i.e. interpolation of table values 323<T<348
342 79421 H = 15.5+1.2*(temperature-323.0)/25.;
343 79421 CH3 = 43.5+2.3*(temperature-323.0)/25.;
344 79421 C6H5 = 123.4+6.3*(temperature-323.0)/25.;
345 }
346 else {
347 assert(temperature>=348.0);
348
349 /* take care: extrapolation for Temperature>373 */
350 H = 16.7+2.1*(temperature-348.0)/25.; /* leads probably to underestimates */
351 CH3 = 45.8+2.5*(temperature-348.0)/25.;
352 C6H5 = 129.7+6.3*(temperature-348.0)/25.;
353 }
354
355 7551006 return (C6H5 + 3*CH3 - 2*H)/molarMass(); // J/(mol K) -> J/(kg K)
356 }
357
358 /*!
359 * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of mesitylene
360 *
361 * see: http://pubs.acs.org/doi/pdf/10.1021/ci000139t
362 *
363 * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
364 * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
365 */
366 static Scalar liquidThermalConductivity( Scalar temperature, Scalar pressure)
367 {
368 return 0.1351;
369 }
370 };
371
372 } // end namespace Components
373
374 } // end namespace Dumux
375
376 #endif
377