N2.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) 2011 by Benjamin Faigle
6  Copyright (C) 2010 by Katherina Baber
7  Copyright (C) 2011-2012 by Philipp Nuske
8 
9  This file is part of the Open Porous Media project (OPM).
10 
11  OPM is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 2 of the License, or
14  (at your option) any later version.
15 
16  OPM is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OPM. If not, see <http://www.gnu.org/licenses/>.
23 */
28 #ifndef OPM_N2_HPP
29 #define OPM_N2_HPP
30 
33 
34 #include "Component.hpp"
35 
36 #include <cmath>
37 
38 namespace Opm
39 {
40 
48 template <class Scalar>
49 class N2 : public Component<Scalar, N2<Scalar> >
50 {
52 
53 public:
57  static const char *name()
58  { return "N2"; }
59 
63  static Scalar molarMass()
64  { return 28.0134e-3;}
65 
70  { return 126.192; /* [K] */ }
71 
76  { return 3.39858e6; /* [N/m^2] */ }
77 
82  { return 63.151; /* [K] */ }
83 
88  { return 12.523e3; /* [N/m^2] */ }
89 
104  template <class Evaluation>
105  static Evaluation vaporPressure(const Evaluation& temperature)
106  {
107  typedef MathToolbox<Evaluation> Toolbox;
108 
109  if (temperature > criticalTemperature())
110  return criticalPressure();
111  if (temperature < tripleTemperature())
112  return 0; // N2 is solid: We don't take sublimation into
113  // account
114 
115  // note: this is the ancillary equation given on page 1368
116  const Evaluation& sigma = 1.0 - temperature/criticalTemperature();
117  const Evaluation& sqrtSigma = Toolbox::sqrt(sigma);
118  const Scalar N1 = -6.12445284;
119  const Scalar N2 = 1.26327220;
120  const Scalar N3 = -0.765910082;
121  const Scalar N4 = -1.77570564;
122  return
123  criticalPressure() *
124  Toolbox::exp(criticalTemperature()/temperature*
125  (sigma*(N1 +
126  sqrtSigma*N2 +
127  sigma*(sqrtSigma*N3 +
128  sigma*sigma*sigma*N4))));
129  }
130 
137  template <class Evaluation>
138  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
139  {
140  // Assume an ideal gas
141  return IdealGas::density(Evaluation(molarMass()), temperature, pressure);
142  }
143 
147  static bool gasIsCompressible()
148  { return true; }
149 
153  static bool gasIsIdeal()
154  { return true; }
155 
162  template <class Evaluation>
163  static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
164  {
165  // Assume an ideal gas
166  return IdealGas::pressure(temperature, density/molarMass());
167  }
168 
178  template <class Evaluation>
179  static Evaluation gasEnthalpy(const Evaluation& temperature,
180  const Evaluation& /*pressure*/)
181  {
182  // method of Joback
183  const Scalar cpVapA = 31.15;
184  const Scalar cpVapB = -0.01357;
185  const Scalar cpVapC = 2.680e-5;
186  const Scalar cpVapD = -1.168e-8;
187 
188  // calculate: \int_0^T c_p dT
189  return
190  1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
191 
192  temperature*(cpVapA + temperature*
193  (cpVapB/2 + temperature*
194  (cpVapC/3 + temperature*
195  (cpVapD/4))));
196 
197 //#warning NIST DATA STUPID INTERPOLATION
198 // Scalar T2 = 300.;
199 // Scalar T1 = 285.;
200 // Scalar h2 = 311200.;
201 // Scalar h1 = 295580.;
202 // Scalar h = h1+ (h2-h1) / (T2-T1) * (T-T1);
203 // return h ;
204  }
205 
219  template <class Evaluation>
220  static Evaluation gasInternalEnergy(const Evaluation& temperature,
221  const Evaluation& pressure)
222  {
223  return
224  gasEnthalpy(temperature, pressure) -
225  1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
226  IdealGas::R*temperature; // = pressure * spec. volume for an ideal gas
227  }
228 
236  template <class Evaluation>
237  static Evaluation gasHeatCapacity(const Evaluation& temperature,
238  const Evaluation& /*pressure*/)
239  {
240  // method of Joback
241  const Scalar cpVapA = 31.15;
242  const Scalar cpVapB = -0.01357;
243  const Scalar cpVapC = 2.680e-5;
244  const Scalar cpVapD = -1.168e-8;
245 
246  return
247  1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
248 
249  cpVapA + temperature*
250  (cpVapB + temperature*
251  (cpVapC + temperature*
252  (cpVapD)));
253  }
254 
268  template <class Evaluation>
269  static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
270  {
271  typedef MathToolbox<Evaluation> Toolbox;
272 
273  const Scalar Tc = criticalTemperature();
274  const Scalar Vc = 90.1; // critical specific volume [cm^3/mol]
275  const Scalar omega = 0.037; // accentric factor
276  const Scalar M = molarMass() * 1e3; // molar mas [g/mol]
277  const Scalar dipole = 0.0; // dipole moment [debye]
278 
279  Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc);
280  mu_r4 *= mu_r4;
281  mu_r4 *= mu_r4;
282 
283  Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4;
284  const Evaluation& Tstar = 1.2593 * temperature/Tc;
285  const Evaluation& Omega_v =
286  1.16145*Toolbox::pow(Tstar, -0.14874) +
287  0.52487*Toolbox::exp(- 0.77320*Tstar) +
288  2.16178*Toolbox::exp(- 2.43787*Tstar);
289  const Evaluation& mu = 40.785*Fc*Toolbox::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v);
290 
291  // convertion from micro poise to Pa s
292  return mu/1e6 / 10;
293  }
294 
306  template <class Evaluation>
307  static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
308  const Evaluation& /*pressure*/)
309  { return 0.024572; }
310 };
311 
312 } // namespace Opm
313 
314 #endif
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
static Scalar tripleTemperature()
Returns the temperature at molecular nitrogen's triple point.
Definition: N2.hpp:81
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: N2.hpp:147
static Scalar molarMass()
The molar mass in of molecular nitrogen.
Definition: N2.hpp:63
static Scalar criticalTemperature()
Returns the critical temperature of molecular nitrogen.
Definition: N2.hpp:69
Properties of pure molecular nitrogen .
Definition: N2.hpp:49
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: N2.hpp:75
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: N2.hpp:269
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
Scalar Scalar
Definition: Component.hpp:45
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of gas at a given pressure and temperature.
Definition: N2.hpp:138
Evaluation< Scalar, VarSetTag, numVars > sqrt(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:278
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of pure nitrogen gas.
Definition: N2.hpp:179
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
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of pure nitrogen gas.
Definition: N2.hpp:220
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: N2.hpp:153
Evaluation< Scalar, VarSetTag, numVars > exp(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:295
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: N2.hpp:307
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of gaseous in at a given density and temperature.
Definition: N2.hpp:163
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:39
Relations valid for an ideal gas.
static Scalar triplePressure()
Returns the pressure at molecular nitrogen's triple point.
Definition: N2.hpp:87
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 Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific isobaric heat capacity of pure nitrogen gas.
Definition: N2.hpp:237
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 vaporPressure(const Evaluation &temperature)
The vapor pressure in of pure molecular nitrogen at a given temperature.
Definition: N2.hpp:105
static const char * name()
A human readable name for nitrogen.
Definition: N2.hpp:57
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...