opm-common
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  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_AIR_HPP
28 #define OPM_AIR_HPP
29 
31 
35 
36 #include <string_view>
37 
38 namespace Opm {
39 
47 template <class Scalar>
48 class Air : public Component<Scalar, Air<Scalar> >
49 {
50  typedef ::Opm::IdealGas<Scalar> IdealGas;
51 
52 public:
53  using Component<Scalar, Air<Scalar>>::isTabulated;
54 
58  static bool liquidIsCompressible()
59  { throw std::runtime_error("Not implemented: Component::liquidIsCompressible()"); }
60 
64  static std::string_view name()
65  { return "Air"; }
66 
70  static bool gasIsCompressible()
71  { return true; }
72 
76  static bool gasIsIdeal()
77  { return true; }
78 
84  static Scalar molarMass()
85  { return 0.02896; /* [kg/mol] */ }
86 
90  static Scalar criticalTemperature()
91  { return 132.531 ; /* [K] */ }
92 
96  static Scalar criticalPressure()
97  { return 37.86e5; /* [Pa] */ }
98 
105  template <class Evaluation>
106  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
107  { return IdealGas::density(Evaluation(molarMass()), temperature, pressure); }
108 
115  template <class Evaluation>
116  static Evaluation gasPressure(const Evaluation& temperature, Scalar density)
117  { return IdealGas::pressure(temperature, density/molarMass()); }
118 
140  template <class Evaluation>
141  static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
142  {
143  Scalar Tc = criticalTemperature();
144  Scalar Vc = 84.525138; // critical specific volume [cm^3/mol]
145  Scalar omega = 0.078; // accentric factor
146  Scalar M = molarMass() * 1e3; // molar mas [g/mol]
147  Scalar dipole = 0.0; // dipole moment [debye]
148 
149  Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc);
150  mu_r4 *= mu_r4;
151  mu_r4 *= mu_r4;
152 
153  Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4;
154  Evaluation Tstar = 1.2593 * temperature/Tc;
155  Evaluation Omega_v =
156  1.16145*pow(Tstar, -0.14874) +
157  0.52487*exp(- 0.77320*Tstar) +
158  2.16178*exp(- 2.43787*Tstar);
159  return 40.7851e-7*Fc*sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v);
160  }
161 
162  // simpler method, from old constrelAir.hh
163  template <class Evaluation>
164  static Evaluation simpleGasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
165  {
166  if(temperature < 273.15 || temperature > 660.) {
167  throw NumericalProblem("Air: Temperature "+std::to_string(scalarValue(temperature))+"K out of range");
168  }
169  return 1.496e-6*pow(temperature, 1.5)/(temperature + 120);
170  }
171 
183  template <class Evaluation>
184  static Evaluation gasEnthalpy(const Evaluation& temperature, const Evaluation& /*pressure*/)
185  {
186  return 1005.0*temperature;
187  }
188 
200  template <class Evaluation>
201  static Evaluation gasInternalEnergy(const Evaluation& temperature,
202  const Evaluation& pressure)
203  {
204  return
205  gasEnthalpy(temperature, pressure)
206  - (IdealGas::R*temperature/molarMass()); // <- pressure times specific volume of an ideal gas
207  }
208 
220  template <class Evaluation>
221  static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
222  const Evaluation& /*pressure*/)
223  {
224  // Isobaric Properties for Nitrogen in: NIST Standard
225  // see http://webbook.nist.gov/chemistry/fluid/
226  // evaluated at p=.1 MPa, T=20°C
227  // Nitrogen: 0.025398
228  // Oxygen: 0.026105
229  // lambda_air is approximately 0.78*lambda_N2+0.22*lambda_O2
230  return 0.0255535;
231  }
232 
249  template <class Evaluation>
250  static Evaluation gasHeatCapacity(const Evaluation&,
251  const Evaluation&)
252  {
253  return 1005.0;
254  }
255 };
256 
257 } // namespace Opm
258 
259 #endif
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Air.hpp:70
static OPM_HOST_DEVICE Evaluation pressure(const Evaluation &temperature, const Evaluation &rhoMolar)
The pressure of the gas in , depending on the molar density and temperature.
Definition: IdealGas.hpp:59
Definition: Exceptions.hpp:39
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
static std::string_view name()
A human readable name for the .
Definition: Air.hpp:64
Relations valid for an ideal gas.
Abstract base class of a pure chemical species.
Definition: Component.hpp:43
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of .
Definition: Air.hpp:201
static Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of pure air.
Definition: Air.hpp:250
static Scalar criticalPressure()
Returns the critical pressure of .
Definition: Air.hpp:96
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Air.hpp:58
static constexpr Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:42
Provides the OPM specific exception classes.
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Air.hpp:76
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: Air.hpp:141
static Scalar criticalTemperature()
Returns the critical temperature of .
Definition: Air.hpp:90
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static Scalar molarMass()
The molar mass in of .
Definition: Air.hpp:84
A simple class implementing the fluid properties of air.
Definition: Air.hpp:48
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of at a given pressure and temperature [kg/m^3].
Definition: Air.hpp:106
Abstract base class of a pure chemical species.
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: Air.hpp:221
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition: Air.hpp:184
Relations valid for an ideal gas.
Definition: IdealGas.hpp:38
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of gaseous at a given density and temperature .
Definition: Air.hpp:116
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