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  Copyright (C) 2009-2013 by Andreas Lauser
5  Copyright (C) 2010 by Felix Bode
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
26 #ifndef OPM_MESITYLENE_HPP
27 #define OPM_MESITYLENE_HPP
28 
32 
34 
35 namespace Opm {
42 template <class Scalar>
43 class Mesitylene : public Component<Scalar, Mesitylene<Scalar> >
44 {
46 
47 public:
51  static const char *name()
52  { return "mesitylene"; }
53 
57  static Scalar molarMass()
58  { return 0.120; }
59 
64  { return 637.3; }
65 
70  { return 31.3e5; }
71 
76  { return 437.9; }
77 
82  { OPM_THROW(std::runtime_error, "Not implemented: tripleTemperature for mesitylene"); }
83 
88  { OPM_THROW(std::runtime_error, "Not implemented: triplePressure for mesitylene"); }
89 
97  template <class Evaluation>
98  static Evaluation vaporPressure(const Evaluation& temperature)
99  {
100  typedef MathToolbox<Evaluation> Toolbox;
101 
102  const Scalar A = 7.07638;
103  const Scalar B = 1571.005;
104  const Scalar C = 209.728;
105 
106  const Evaluation& T = temperature - 273.15;
107 
108  return 100 * 1.334 * Toolbox::pow(10.0, A - (B / (T + C)));
109  }
110 
111 
118  template <class Evaluation>
119  static Evaluation liquidEnthalpy(const Evaluation& temperature, const Evaluation& pressure)
120  {
121  // Gauss quadrature rule:
122  // Interval: [0K; temperature (K)]
123  // Gauss-Legendre-Integration with variable transformation:
124  // \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 )
125  // with: n=2, legendre -> x_i = +/- \sqrt(1/3), \apha_i=1
126  // here: a=0, b=actual temperature in Kelvin
127  // \leadsto h(T) = \int_0^T c_p(T) dT
128  // \approx 0.5 T * (cp( (0.5-0.5*\sqrt(1/3)) T) + cp((0.5+0.5*\sqrt(1/3)) T))
129  // = 0.5 T * (cp(0.2113 T) + cp(0.7887 T) )
130 
131  // enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input
132  return 0.5*temperature*(liquidHeatCapacity(0.2113*temperature, pressure) + liquidHeatCapacity(0.7887*temperature, pressure));
133  }
134 
143  template <class Evaluation>
144  static Evaluation heatVap(const Evaluation& temperature, const Evaluation& /*pressure*/)
145  {
146  typedef MathToolbox<Evaluation> Toolbox;
147 
148  Evaluation T = Toolbox::min(temperature, criticalTemperature()); // regularization
149  T = Toolbox::max(T, 0.0); // regularization
150 
151  const Scalar T_crit = 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 * Toolbox::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  typedef MathToolbox<Evaluation> Toolbox;
234 
235  temperature = Toolbox::min(temperature, 500.0); // regularization
236  temperature = Toolbox::max(temperature, 250.0);
237 
238  // reduced temperature
239  const Evaluation& Tr = temperature/criticalTemperature();
240 
241  Scalar Fp0 = 1.0;
242  Scalar xi = 0.00474;
243  const Evaluation& eta_xi =
244  Fp0*(0.807*Toolbox::pow(Tr,0.618)
245  - 0.357*Toolbox::exp(-0.449*Tr)
246  + 0.34*Toolbox::exp(-4.058*Tr)
247  + 0.018);
248 
249  return eta_xi/xi/1e7; // [Pa s]
250  }
251 
258  template <class Evaluation>
259  static Evaluation liquidViscosity(Evaluation temperature, const Evaluation& /*pressure*/)
260  {
261  typedef MathToolbox<Evaluation> Toolbox;
262 
263  temperature = Toolbox::min(temperature, 500.0); // regularization
264  temperature = Toolbox::max(temperature, 250.0);
265 
266  const Scalar A = -6.749;
267  const Scalar B = 2010.0;
268 
269  return Toolbox::exp(A + B/temperature)*1e-3; // [Pa s]
270  }
271 
281  template <class Evaluation>
282  static Evaluation liquidHeatCapacity(const Evaluation& temperature,
283  const Evaluation& /*pressure*/)
284  {
285  /* according Reid et al. : Missenard group contrib. method (s. example 5-8) */
286  /* Mesitylen: C9H12 : 3* CH3 ; 1* C6H5 (phenyl-ring) ; -2* H (this was to much!) */
287  /* linear interpolation between table values [J/(mol K)]*/
288  Evaluation H, CH3, C6H5;
289  if(temperature<298.) {
290  // extrapolation for temperature < 273K
291  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
292  CH3 = 40.0 + 1.6*(temperature-273.0)/25.; // 40 + 1.6 = 41.6 = CH3(T=298K)
293  C6H5 = 113.0 + 4.2*(temperature-273.0)/25.; // 113 + 4.2 =117.2 = C6H5(T=298K)
294  }
295  else if((temperature>=298.0)&&(temperature<323.)){ // i.e. interpolation of table values 298<T<323
296  H = 14.6 + 0.9*(temperature-298.0)/25.;
297  CH3 = 41.6 + 1.9*(temperature-298.0)/25.;
298  C6H5 = 117.2 + 6.2*(temperature-298.0)/25.;
299  }
300  else if((temperature>=323.0)&&(temperature<348.)){// i.e. interpolation of table values 323<T<348
301  H = 15.5 + 1.2*(temperature-323.0)/25.;
302  CH3 = 43.5 + 2.3*(temperature-323.0)/25.;
303  C6H5 = 123.4 + 6.3*(temperature-323.0)/25.;
304  }
305  else {
306  assert(temperature>=348.0);
307 
308  // extrapolation for temperature > 373K
309  H = 16.7+2.1*(temperature-348.0)/25.; // probably leads to underestimates
310  CH3 = 45.8+2.5*(temperature-348.0)/25.;
311  C6H5 = 129.7+6.3*(temperature-348.0)/25.;
312  }
313 
314  return (C6H5 + 3*CH3 - 2*H)/molarMass(); // J/(mol K) -> J/(kg K)
315  }
316 
317 protected:
326  template <class Evaluation>
327  static Evaluation molarLiquidDensity_(Evaluation temperature)
328  {
329  typedef MathToolbox<Evaluation> Toolbox;
330 
331  temperature = Toolbox::min(temperature, 500.0); // regularization
332  temperature = Toolbox::max(temperature, 250.0);
333 
334  const Scalar Z_RA = 0.2556; // from equation
335  const Evaluation& expo = 1.0 + Toolbox::pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
336  const Evaluation& V = Consts::R*criticalTemperature()/criticalPressure()*Toolbox::pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
337 
338  return 1.0/V; // molar density [mol/m^3]
339  }
340 
341 };
342 
343 } // namespace Opm
344 
345 #endif
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
static const Scalar R
The ideal gas constant [J/(mol K)].
Definition: Constants.hpp:44
Component for Mesitylene.
Definition: Mesitylene.hpp:43
static Scalar tripleTemperature()
Returns the temperature at mesitylene's triple point.
Definition: Mesitylene.hpp:81
static Scalar triplePressure()
Returns the pressure at mesitylene's triple point.
Definition: Mesitylene.hpp:87
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
Scalar Scalar
Definition: Component.hpp:45
Evaluation< Scalar, VarSetTag, numVars > max(const Evaluation< Scalar, VarSetTag, numVars > &x1, const Evaluation< Scalar, VarSetTag, numVars > &x2)
Definition: Math.hpp:114
static Scalar criticalTemperature()
Returns the critical temperature of mesitylene.
Definition: Mesitylene.hpp:63
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of mesitylene vapor .
Definition: Mesitylene.hpp:180
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Mesitylene.hpp:220
static const char * name()
A human readable name for the mesitylene.
Definition: Mesitylene.hpp:51
A central place for various physical constants occuring in some equations.
Evaluation< Scalar, VarSetTag, numVars > log(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:369
Evaluation< Scalar, VarSetTag, numVars > exp(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:295
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 Evaluation molarLiquidDensity_(Evaluation temperature)
The molar density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:327
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &, bool=true)
The dynamic viscosity of mesitylene vapor.
Definition: Mesitylene.hpp:231
Evaluation< Scalar, VarSetTag, numVars > min(const Evaluation< Scalar, VarSetTag, numVars > &x1, const Evaluation< Scalar, VarSetTag, numVars > &x2)
Definition: Math.hpp:61
Relations valid for an ideal gas.
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Mesitylene.hpp:208
static Evaluation heatVap(const Evaluation &temperature, const Evaluation &)
Latent heat of vaporization for mesitylene .
Definition: Mesitylene.hpp:144
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Mesitylene.hpp:214
static Scalar boilingTemperature()
Returns the temperature at mesitylene's boiling point (1 atm).
Definition: Mesitylene.hpp:75
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid mesitylene .
Definition: Mesitylene.hpp:119
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &)
The density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:202
Abstract base class of a pure chemical species.
Evaluation< Scalar, VarSetTag, numVars > pow(const Evaluation< Scalar, VarSetTag, numVars > &base, Scalar exp)
Definition: Math.hpp:312
static Scalar criticalPressure()
Returns the critical pressure of mesitylene.
Definition: Mesitylene.hpp:69
static 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:46
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific heat cap of liquid mesitylene .
Definition: Mesitylene.hpp:282
static Evaluation liquidViscosity(Evaluation temperature, const Evaluation &)
The dynamic viscosity of pure mesitylene.
Definition: Mesitylene.hpp:259
static Scalar molarMass()
The molar mass in of mesitylene.
Definition: Mesitylene.hpp:57
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39
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:98
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...