Air.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) 2010-2013 by Andreas Lauser
5  Copyright (C) 2011 by Benjamin Faigle
6  Copyright (C) 2010 by Bernd Flemisch
7 
8  This file is part of the Open Porous Media project (OPM).
9 
10  OPM is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 2 of the License, or
13  (at your option) any later version.
14 
15  OPM is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with OPM. If not, see <http://www.gnu.org/licenses/>.
22 */
27 #ifndef OPM_AIR_HPP
28 #define OPM_AIR_HPP
29 
33 
34 #include <opm/common/Exceptions.hpp>
35 #include <opm/common/ErrorMacros.hpp>
36 
37 namespace Opm {
38 
46 template <class Scalar>
47 class Air : public Component<Scalar, Air<Scalar> >
48 {
50 
51 public:
55  static bool liquidIsCompressible()
56  { OPM_THROW(std::runtime_error, "Not implemented: Component::liquidIsCompressible()"); }
57 
61  static const char *name()
62  { return "Air"; }
63 
67  static bool gasIsCompressible()
68  { return true; }
69 
73  static bool gasIsIdeal()
74  { return true; }
75 
81  static Scalar molarMass()
82  { return 0.02896; /* [kg/mol] */ }
83 
88  { return 132.531 ; /* [K] */ }
89 
94  { return 37.86e5; /* [Pa] */ }
95 
102  template <class Evaluation>
103  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
104  { return IdealGas::density(Evaluation(molarMass()), temperature, pressure); }
105 
112  template <class Evaluation>
113  static Evaluation gasPressure(const Evaluation& temperature, Scalar density)
114  { return IdealGas::pressure(temperature, density/molarMass()); }
115 
137  template <class Evaluation>
138  static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
139  {
140  typedef MathToolbox<Evaluation> Toolbox;
141 
143  Scalar Vc = 84.525138; // critical specific volume [cm^3/mol]
144  Scalar omega = 0.078; // accentric factor
145  Scalar M = molarMass() * 1e3; // molar mas [g/mol]
146  Scalar dipole = 0.0; // dipole moment [debye]
147 
148  Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc);
149  mu_r4 *= mu_r4;
150  mu_r4 *= mu_r4;
151 
152  Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4;
153  Evaluation Tstar = 1.2593 * temperature/Tc;
154  Evaluation Omega_v =
155  1.16145*Toolbox::pow(Tstar, -0.14874) +
156  0.52487*Toolbox::exp(- 0.77320*Tstar) +
157  2.16178*Toolbox::exp(- 2.43787*Tstar);
158  return 40.7851e-7*Fc*Toolbox::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v);
159  }
160 
161  // simpler method, from old constrelAir.hh
162  template <class Evaluation>
163  static Evaluation simpleGasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
164  {
165  typedef MathToolbox<Evaluation> Toolbox;
166 
167  if(temperature < 273.15 || temperature > 660.) {
168  OPM_THROW(NumericalProblem,
169  "Air: Temperature (" << temperature << "K) out of range");
170  }
171  return 1.496e-6*Toolbox::pow(temperature, 1.5)/(temperature + 120);
172  }
173 
185  template <class Evaluation>
186  static Evaluation gasEnthalpy(const Evaluation& temperature, const Evaluation& /*pressure*/)
187  {
188  return 1005*(temperature - 273.15);
189  }
190 
202  template <class Evaluation>
203  static Evaluation gasInternalEnergy(const Evaluation& temperature,
204  const Evaluation& pressure)
205  {
206  return
207  gasEnthalpy(temperature, pressure)
208  - (IdealGas::R*temperature/molarMass()); // <- specific volume of an ideal gas
209  }
210 
222  template <class Evaluation>
223  static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
224  const Evaluation& /*pressure*/)
225  {
226  // Isobaric Properties for Nitrogen in: NIST Standard
227  // see http://webbook.nist.gov/chemistry/fluid/
228  // evaluated at p=.1 MPa, T=20°C
229  // Nitrogen: 0.025398
230  // Oxygen: 0.026105
231  // lambda_air is approximately 0.78*lambda_N2+0.22*lambda_O2
232  return 0.0255535;
233  }
234 
251  template <class Evaluation>
252  static Evaluation gasHeatCapacity(const Evaluation& temperature,
253  const Evaluation& /*pressure*/)
254  {
255  typedef MathToolbox<Evaluation> Toolbox;
256 
257  // scale temperature by reference temp of 100K
258  Evaluation phi = temperature/100;
259 
260  Evaluation c_p =
261  0.661738E+01
262  -0.105885E+01 * phi
263  +0.201650E+00 * Toolbox::pow(phi,2.)
264  -0.196930E-01 * Toolbox::pow(phi,3.)
265  +0.106460E-02 * Toolbox::pow(phi,4.)
266  -0.303284E-04 * Toolbox::pow(phi,5.)
267  +0.355861E-06 * Toolbox::pow(phi,6.);
268  c_p +=
269  -0.549169E+01 * Toolbox::pow(phi,-1.)
270  +0.585171E+01* Toolbox::pow(phi,-2.)
271  -0.372865E+01* Toolbox::pow(phi,-3.)
272  +0.133981E+01* Toolbox::pow(phi,-4.)
273  -0.233758E+00* Toolbox::pow(phi,-5.)
274  +0.125718E-01* Toolbox::pow(phi,-6.);
275  c_p *= IdealGas::R / (molarMass() * 1000); // in J/mol/K * mol / kg / 1000 = kJ/kg/K
276 
277  return c_p;
278  }
279 };
280 
281 } // namespace Opm
282 
283 #endif
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Air.hpp:73
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Air.hpp:55
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
static Scalar criticalPressure()
Returns the critical pressure of .
Definition: Air.hpp:93
Scalar Scalar
Definition: Component.hpp:45
static Scalar criticalTemperature()
Returns the critical temperature of .
Definition: Air.hpp:87
static const char * name()
A human readable name for the .
Definition: Air.hpp:61
Evaluation< Scalar, VarSetTag, numVars > sqrt(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:278
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of .
Definition: Air.hpp:203
static Evaluation pressure(const Evaluation &temperature, const Evaluation &rhoMolar)
The pressure of the gas in , depending on the molar density and temperature.
Definition: IdealGas.hpp:56
Evaluation< Scalar, VarSetTag, numVars > exp(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:295
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: Air.hpp:138
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of at a given pressure and temperature [kg/m^3].
Definition: Air.hpp:103
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific isobaric heat capacity of pure air.
Definition: Air.hpp:252
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:39
static Scalar molarMass()
The molar mass in of .
Definition: Air.hpp:81
static Evaluation simpleGasViscosity(const Evaluation &temperature, const Evaluation &)
Definition: Air.hpp:163
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: Air.hpp:223
Relations valid for an ideal gas.
Relations valid for an ideal gas.
Definition: IdealGas.hpp:35
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 bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Air.hpp:67
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis. See: W. Kays, M. Crawford, B. Weigand Convective heat and mass transfer, 4th edition (2005) p. 431ff.
Definition: Air.hpp:186
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
A simple class implementing the fluid properties of air.
Definition: Air.hpp:47
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of gaseous at a given density and temperature .
Definition: Air.hpp:113
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...