opm-common
Mesitylene.hpp
Go to the documentation of this file.
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  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
27 #ifndef OPM_MESITYLENE_HPP
28 #define OPM_MESITYLENE_HPP
29 
33 
35 
36 #include <string_view>
37 
38 namespace Opm {
45 template <class Scalar>
46 class Mesitylene : public Component<Scalar, Mesitylene<Scalar> >
47 {
48  typedef Constants<Scalar> Consts;
49 
50 public:
54  static std::string_view name()
55  { return "mesitylene"; }
56 
60  static Scalar molarMass()
61  { return 0.120; }
62 
66  static Scalar criticalTemperature()
67  { return 637.3; }
68 
72  static Scalar criticalPressure()
73  { return 31.3e5; }
74 
78  static Scalar boilingTemperature()
79  { return 437.9; }
80 
84  static Scalar tripleTemperature()
85  { throw std::runtime_error("Not implemented: tripleTemperature for mesitylene"); }
86 
90  static Scalar triplePressure()
91  { throw std::runtime_error("Not implemented: triplePressure for mesitylene"); }
92 
100  template <class Evaluation>
101  static Evaluation vaporPressure(const Evaluation& temperature)
102  {
103  const Scalar A = 7.07638;
104  const Scalar B = 1571.005;
105  const Scalar C = 209.728;
106 
107  const Evaluation& T = temperature - 273.15;
108 
109  return 100 * 1.334 * pow(10.0, A - (B / (T + C)));
110  }
111 
112 
119  template <class Evaluation>
120  static Evaluation liquidEnthalpy(const Evaluation& temperature, const Evaluation& pressure)
121  {
122  // Gauss quadrature rule:
123  // Interval: [0K; temperature (K)]
124  // Gauss-Legendre-Integration with variable transformation:
125  // \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 )
126  // with: n=2, legendre -> x_i = +/- \sqrt(1/3), \apha_i=1
127  // here: a=0, b=actual temperature in Kelvin
128  // \leadsto h(T) = \int_0^T c_p(T) dT
129  // \approx 0.5 T * (cp( (0.5-0.5*\sqrt(1/3)) T) + cp((0.5+0.5*\sqrt(1/3)) T))
130  // = 0.5 T * (cp(0.2113 T) + cp(0.7887 T) )
131 
132  // enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input
133  return 0.5*temperature*(liquidHeatCapacity(Evaluation(0.2113*temperature), pressure)
134  + liquidHeatCapacity(Evaluation(0.7887*temperature), pressure));
135  }
136 
145  template <class Evaluation>
146  static Evaluation heatVap(const Evaluation& temperature, const Evaluation& /*pressure*/)
147  {
148  Evaluation T = min(temperature, criticalTemperature()); // regularization
149  T = max(T, 0.0); // regularization
150 
151  const Scalar T_crit = criticalTemperature();
152  const Scalar Tr1 = boilingTemperature()/criticalTemperature();
153  const Scalar p_crit = criticalPressure();
154 
155  // Chen method, eq. 7-11.4 (at boiling)
156  const Scalar DH_v_boil =
157  Consts::R * T_crit * Tr1
158  * (3.978 * Tr1 - 3.958 + 1.555*std::log(p_crit * 1e-5 /*Pa->bar*/ ) )
159  / (1.07 - Tr1); /* [J/mol] */
160 
161  /* Variation with temp according to Watson relation eq 7-12.1*/
162  const Evaluation& Tr2 = T/criticalTemperature();
163  const Scalar n = 0.375;
164  const Evaluation& DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n);
165 
166  return (DH_vap/molarMass()); // we need [J/kg]
167  }
168 
169 
179  template <class Evaluation>
180  static Evaluation gasEnthalpy(const Evaluation& temperature, const Evaluation& pressure)
181  {
182  return liquidEnthalpy(temperature,pressure) + heatVap(temperature, pressure);
183  }
184 
191  template <class Evaluation>
192  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
193  { return IdealGas<Scalar>::density(Evaluation(molarMass()), temperature, pressure); }
194 
201  template <class Evaluation>
202  static Evaluation liquidDensity(const Evaluation& temperature, const Evaluation& /*pressure*/)
203  { return molarLiquidDensity_(temperature)*molarMass(); }
204 
208  static bool gasIsCompressible()
209  { return true; }
210 
214  static bool gasIsIdeal()
215  { return true; }
216 
220  static bool liquidIsCompressible()
221  { return false; }
222 
230  template <class Evaluation>
231  static Evaluation gasViscosity(Evaluation temperature, const Evaluation& /*pressure*/, bool /*regularize*/=true)
232  {
233  temperature = min(temperature, 500.0); // regularization
234  temperature = max(temperature, 250.0);
235 
236  // reduced temperature
237  const Evaluation& Tr = temperature/criticalTemperature();
238 
239  Scalar Fp0 = 1.0;
240  Scalar xi = 0.00474;
241  const Evaluation& eta_xi =
242  Fp0*(0.807*pow(Tr,0.618)
243  - 0.357*exp(-0.449*Tr)
244  + 0.34*exp(-4.058*Tr)
245  + 0.018);
246 
247  return eta_xi/xi/1e7; // [Pa s]
248  }
249 
256  template <class Evaluation>
257  static Evaluation liquidViscosity(Evaluation temperature, const Evaluation& /*pressure*/)
258  {
259  temperature = min(temperature, 500.0); // regularization
260  temperature = max(temperature, 250.0);
261 
262  const Scalar A = -6.749;
263  const Scalar B = 2010.0;
264 
265  return exp(A + B/temperature)*1e-3; // [Pa s]
266  }
267 
277  template <class Evaluation>
278  static Evaluation liquidHeatCapacity(const Evaluation& temperature,
279  const Evaluation& /*pressure*/)
280  {
281  /* according Reid et al. : Missenard group contrib. method (s. example 5-8) */
282  /* Mesitylen: C9H12 : 3* CH3 ; 1* C6H5 (phenyl-ring) ; -2* H (this was to much!) */
283  /* linear interpolation between table values [J/(mol K)]*/
284  Evaluation H, CH3, C6H5;
285  if(temperature<298.) {
286  // extrapolation for temperature < 273K
287  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
288  CH3 = 40.0 + 1.6*(temperature-273.0)/25.; // 40 + 1.6 = 41.6 = CH3(T=298K)
289  C6H5 = 113.0 + 4.2*(temperature-273.0)/25.; // 113 + 4.2 =117.2 = C6H5(T=298K)
290  }
291  else if((temperature>=298.0)&&(temperature<323.)){ // i.e. interpolation of table values 298<T<323
292  H = 14.6 + 0.9*(temperature-298.0)/25.;
293  CH3 = 41.6 + 1.9*(temperature-298.0)/25.;
294  C6H5 = 117.2 + 6.2*(temperature-298.0)/25.;
295  }
296  else if((temperature>=323.0)&&(temperature<348.)){// i.e. interpolation of table values 323<T<348
297  H = 15.5 + 1.2*(temperature-323.0)/25.;
298  CH3 = 43.5 + 2.3*(temperature-323.0)/25.;
299  C6H5 = 123.4 + 6.3*(temperature-323.0)/25.;
300  }
301  else {
302  assert(temperature>=348.0);
303 
304  // extrapolation for temperature > 373K
305  H = 16.7+2.1*(temperature-348.0)/25.; // probably leads to underestimates
306  CH3 = 45.8+2.5*(temperature-348.0)/25.;
307  C6H5 = 129.7+6.3*(temperature-348.0)/25.;
308  }
309 
310  return (C6H5 + 3*CH3 - 2*H)/molarMass(); // J/(mol K) -> J/(kg K)
311  }
312 
313 protected:
322  template <class Evaluation>
323  static Evaluation molarLiquidDensity_(Evaluation temperature)
324  {
325  temperature = min(temperature, 500.0); // regularization
326  temperature = max(temperature, 250.0);
327 
328  const Scalar Z_RA = 0.2556; // from equation
329  const Evaluation& expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
330  const Evaluation& V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
331 
332  return 1.0/V; // molar density [mol/m^3]
333  }
334 
335 };
336 
337 } // namespace Opm
338 
339 #endif
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of mesitylene vapor .
Definition: Mesitylene.hpp:180
static Evaluation vaporPressure(const Evaluation &temperature)
The saturation vapor pressure in of pure mesitylene at a given temperature according to Antoine afte...
Definition: Mesitylene.hpp:101
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
static Evaluation liquidViscosity(Evaluation temperature, const Evaluation &)
The dynamic viscosity of pure mesitylene.
Definition: Mesitylene.hpp:257
Relations valid for an ideal gas.
Abstract base class of a pure chemical species.
Definition: Component.hpp:43
static Scalar tripleTemperature()
Returns the temperature at mesitylene&#39;s triple point.
Definition: Mesitylene.hpp:84
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of pure mesitylene vapor at a given pressure and temperature .
Definition: Mesitylene.hpp:192
static Scalar criticalPressure()
Returns the critical pressure of mesitylene.
Definition: Mesitylene.hpp:72
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &, bool=true)
The dynamic viscosity of mesitylene vapor.
Definition: Mesitylene.hpp:231
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Mesitylene.hpp:214
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Mesitylene.hpp:220
Definition: Constants.hpp:41
Abstract base class of a pure chemical species.
static constexpr Scalar R
The ideal gas constant [J/(mol K)].
Definition: Constants.hpp:47
static Scalar triplePressure()
Returns the pressure at mesitylene&#39;s triple point.
Definition: Mesitylene.hpp:90
static Scalar molarMass()
The molar mass in of mesitylene.
Definition: Mesitylene.hpp:60
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific heat cap of liquid mesitylene .
Definition: Mesitylene.hpp:278
static Evaluation heatVap(const Evaluation &temperature, const Evaluation &)
Latent heat of vaporization for mesitylene .
Definition: Mesitylene.hpp:146
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &)
The density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:202
static Evaluation molarLiquidDensity_(Evaluation temperature)
The molar density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:323
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Mesitylene.hpp:208
Component for Mesitylene.
Definition: Mesitylene.hpp:46
static Scalar criticalTemperature()
Returns the critical temperature of mesitylene.
Definition: Mesitylene.hpp:66
static std::string_view name()
A human readable name for the mesitylene.
Definition: Mesitylene.hpp:54
static OPM_HOST_DEVICE Evaluation density(const Evaluation &avgMolarMass, const Evaluation &temperature, const Evaluation &pressure)
The density of the gas in , depending on pressure, temperature and average molar mass of the gas...
Definition: IdealGas.hpp:49
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid mesitylene .
Definition: Mesitylene.hpp:120
static Scalar boilingTemperature()
Returns the temperature at mesitylene&#39;s boiling point (1 atm).
Definition: Mesitylene.hpp:78