My Project
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 namespace Opm {
43 template <class Scalar>
44 class Mesitylene : public Component<Scalar, Mesitylene<Scalar> >
45 {
46  typedef Constants<Scalar> Consts;
47 
48 public:
52  static const char* name()
53  { return "mesitylene"; }
54 
58  static Scalar molarMass()
59  { return 0.120; }
60 
64  static Scalar criticalTemperature()
65  { return 637.3; }
66 
70  static Scalar criticalPressure()
71  { return 31.3e5; }
72 
76  static Scalar boilingTemperature()
77  { return 437.9; }
78 
82  static Scalar tripleTemperature()
83  { throw std::runtime_error("Not implemented: tripleTemperature for mesitylene"); }
84 
88  static Scalar triplePressure()
89  { throw std::runtime_error("Not implemented: triplePressure for mesitylene"); }
90 
98  template <class Evaluation>
99  static Evaluation vaporPressure(const Evaluation& temperature)
100  {
101  const Scalar A = 7.07638;
102  const Scalar B = 1571.005;
103  const Scalar C = 209.728;
104 
105  const Evaluation& T = temperature - 273.15;
106 
107  return 100 * 1.334 * pow(10.0, A - (B / (T + C)));
108  }
109 
110 
117  template <class Evaluation>
118  static Evaluation liquidEnthalpy(const Evaluation& temperature, const Evaluation& pressure)
119  {
120  // Gauss quadrature rule:
121  // Interval: [0K; temperature (K)]
122  // Gauss-Legendre-Integration with variable transformation:
123  // \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 )
124  // with: n=2, legendre -> x_i = +/- \sqrt(1/3), \apha_i=1
125  // here: a=0, b=actual temperature in Kelvin
126  // \leadsto h(T) = \int_0^T c_p(T) dT
127  // \approx 0.5 T * (cp( (0.5-0.5*\sqrt(1/3)) T) + cp((0.5+0.5*\sqrt(1/3)) T))
128  // = 0.5 T * (cp(0.2113 T) + cp(0.7887 T) )
129 
130  // enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input
131  return 0.5*temperature*(liquidHeatCapacity(Evaluation(0.2113*temperature), pressure)
132  + liquidHeatCapacity(Evaluation(0.7887*temperature), pressure));
133  }
134 
143  template <class Evaluation>
144  static Evaluation heatVap(const Evaluation& temperature, const Evaluation& /*pressure*/)
145  {
146  Evaluation T = min(temperature, criticalTemperature()); // regularization
147  T = max(T, 0.0); // regularization
148 
149  const Scalar T_crit = criticalTemperature();
150  const Scalar Tr1 = boilingTemperature()/criticalTemperature();
151  const Scalar p_crit = criticalPressure();
152 
153  // Chen method, eq. 7-11.4 (at boiling)
154  const Scalar DH_v_boil =
155  Consts::R * T_crit * Tr1
156  * (3.978 * Tr1 - 3.958 + 1.555*std::log(p_crit * 1e-5 /*Pa->bar*/ ) )
157  / (1.07 - Tr1); /* [J/mol] */
158 
159  /* Variation with temp according to Watson relation eq 7-12.1*/
160  const Evaluation& Tr2 = T/criticalTemperature();
161  const Scalar n = 0.375;
162  const Evaluation& DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n);
163 
164  return (DH_vap/molarMass()); // we need [J/kg]
165  }
166 
167 
177  template <class Evaluation>
178  static Evaluation gasEnthalpy(const Evaluation& temperature, const Evaluation& pressure)
179  {
180  return liquidEnthalpy(temperature,pressure) + heatVap(temperature, pressure);
181  }
182 
189  template <class Evaluation>
190  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
191  { return IdealGas<Scalar>::density(Evaluation(molarMass()), temperature, pressure); }
192 
199  template <class Evaluation>
200  static Evaluation liquidDensity(const Evaluation& temperature, const Evaluation& /*pressure*/)
201  { return molarLiquidDensity_(temperature)*molarMass(); }
202 
206  static bool gasIsCompressible()
207  { return true; }
208 
212  static bool gasIsIdeal()
213  { return true; }
214 
218  static bool liquidIsCompressible()
219  { return false; }
220 
228  template <class Evaluation>
229  static Evaluation gasViscosity(Evaluation temperature, const Evaluation& /*pressure*/, bool /*regularize*/=true)
230  {
231  temperature = min(temperature, 500.0); // regularization
232  temperature = max(temperature, 250.0);
233 
234  // reduced temperature
235  const Evaluation& Tr = temperature/criticalTemperature();
236 
237  Scalar Fp0 = 1.0;
238  Scalar xi = 0.00474;
239  const Evaluation& eta_xi =
240  Fp0*(0.807*pow(Tr,0.618)
241  - 0.357*exp(-0.449*Tr)
242  + 0.34*exp(-4.058*Tr)
243  + 0.018);
244 
245  return eta_xi/xi/1e7; // [Pa s]
246  }
247 
254  template <class Evaluation>
255  static Evaluation liquidViscosity(Evaluation temperature, const Evaluation& /*pressure*/)
256  {
257  temperature = min(temperature, 500.0); // regularization
258  temperature = max(temperature, 250.0);
259 
260  const Scalar A = -6.749;
261  const Scalar B = 2010.0;
262 
263  return exp(A + B/temperature)*1e-3; // [Pa s]
264  }
265 
275  template <class Evaluation>
276  static Evaluation liquidHeatCapacity(const Evaluation& temperature,
277  const Evaluation& /*pressure*/)
278  {
279  /* according Reid et al. : Missenard group contrib. method (s. example 5-8) */
280  /* Mesitylen: C9H12 : 3* CH3 ; 1* C6H5 (phenyl-ring) ; -2* H (this was to much!) */
281  /* linear interpolation between table values [J/(mol K)]*/
282  Evaluation H, CH3, C6H5;
283  if(temperature<298.) {
284  // extrapolation for temperature < 273K
285  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
286  CH3 = 40.0 + 1.6*(temperature-273.0)/25.; // 40 + 1.6 = 41.6 = CH3(T=298K)
287  C6H5 = 113.0 + 4.2*(temperature-273.0)/25.; // 113 + 4.2 =117.2 = C6H5(T=298K)
288  }
289  else if((temperature>=298.0)&&(temperature<323.)){ // i.e. interpolation of table values 298<T<323
290  H = 14.6 + 0.9*(temperature-298.0)/25.;
291  CH3 = 41.6 + 1.9*(temperature-298.0)/25.;
292  C6H5 = 117.2 + 6.2*(temperature-298.0)/25.;
293  }
294  else if((temperature>=323.0)&&(temperature<348.)){// i.e. interpolation of table values 323<T<348
295  H = 15.5 + 1.2*(temperature-323.0)/25.;
296  CH3 = 43.5 + 2.3*(temperature-323.0)/25.;
297  C6H5 = 123.4 + 6.3*(temperature-323.0)/25.;
298  }
299  else {
300  assert(temperature>=348.0);
301 
302  // extrapolation for temperature > 373K
303  H = 16.7+2.1*(temperature-348.0)/25.; // probably leads to underestimates
304  CH3 = 45.8+2.5*(temperature-348.0)/25.;
305  C6H5 = 129.7+6.3*(temperature-348.0)/25.;
306  }
307 
308  return (C6H5 + 3*CH3 - 2*H)/molarMass(); // J/(mol K) -> J/(kg K)
309  }
310 
311 protected:
320  template <class Evaluation>
321  static Evaluation molarLiquidDensity_(Evaluation temperature)
322  {
323  temperature = min(temperature, 500.0); // regularization
324  temperature = max(temperature, 250.0);
325 
326  const Scalar Z_RA = 0.2556; // from equation
327  const Evaluation& expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
328  const Evaluation& V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
329 
330  return 1.0/V; // molar density [mol/m^3]
331  }
332 
333 };
334 
335 } // namespace Opm
336 
337 #endif
Abstract base class of a pure chemical species.
A central place for various physical constants occuring in some equations.
Relations valid for an ideal gas.
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:41
static const Scalar R
The ideal gas constant [J/(mol K)].
Definition: Constants.hpp:45
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:48
Component for Mesitylene.
Definition: Mesitylene.hpp:45
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Mesitylene.hpp:218
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific heat cap of liquid mesitylene .
Definition: Mesitylene.hpp:276
static Scalar triplePressure()
Returns the pressure at mesitylene's triple point.
Definition: Mesitylene.hpp:88
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:99
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid mesitylene .
Definition: Mesitylene.hpp:118
static Scalar molarMass()
The molar mass in of mesitylene.
Definition: Mesitylene.hpp:58
static Scalar criticalTemperature()
Returns the critical temperature of mesitylene.
Definition: Mesitylene.hpp:64
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of pure mesitylene vapor at a given pressure and temperature .
Definition: Mesitylene.hpp:190
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:212
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of mesitylene vapor .
Definition: Mesitylene.hpp:178
static Scalar tripleTemperature()
Returns the temperature at mesitylene's triple point.
Definition: Mesitylene.hpp:82
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Mesitylene.hpp:206
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &)
The density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:200
static Evaluation liquidViscosity(Evaluation temperature, const Evaluation &)
The dynamic viscosity of pure mesitylene.
Definition: Mesitylene.hpp:255
static Evaluation molarLiquidDensity_(Evaluation temperature)
The molar density of pure mesitylene at a given pressure and temperature .
Definition: Mesitylene.hpp:321
static Scalar boilingTemperature()
Returns the temperature at mesitylene's boiling point (1 atm).
Definition: Mesitylene.hpp:76
static const char * name()
A human readable name for the mesitylene.
Definition: Mesitylene.hpp:52
static Scalar criticalPressure()
Returns the critical pressure of mesitylene.
Definition: Mesitylene.hpp:70
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &, bool=true)
The dynamic viscosity of mesitylene vapor.
Definition: Mesitylene.hpp:229