IdealGas.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 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_IDEAL_GAS_HPP
26 #define OPM_IDEAL_GAS_HPP
27 
29 
30 namespace Opm {
34 template <class Scalar>
35 class IdealGas
36 {
37 public:
39  static const Scalar R;
40 
45  template <class Evaluation>
46  static Evaluation density(const Evaluation& avgMolarMass,
47  const Evaluation& temperature,
48  const Evaluation& pressure)
49  { return pressure*avgMolarMass/(R*temperature); }
50 
55  template <class Evaluation>
56  static Evaluation pressure(const Evaluation& temperature,
57  const Evaluation& rhoMolar)
58  { return R*temperature*rhoMolar; }
59 
64  template <class Evaluation>
65  static Evaluation molarDensity(const Evaluation& temperature,
66  const Evaluation& pressure)
67  { return pressure/(R*temperature); }
68 };
69 
70 template <class Scalar>
71 const Scalar IdealGas<Scalar>::R = Opm::Constants<Scalar>::R;
72 
73 } // namespace Opm
74 
75 #endif
Definition: Air_Mesitylene.hpp:31
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
A central place for various physical constants occuring in some equations.
static Evaluation molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: IdealGas.hpp:65
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:39
Relations valid for an ideal gas.
Definition: IdealGas.hpp:35
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 central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39