Files
opm-common/opm/material/IdealGas.hpp
Andreas Lauser f386599669 remove all vim and emacs modelines
for emacs, add a toplevel .dir-locals.el file instead...
2014-01-16 18:41:00 +01:00

73 lines
2.0 KiB
C++

/*
Copyright (C) 2009-2013 by Andreas Lauser
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
* \copydoc Opm::IdealGas
*/
#ifndef OPM_IDEAL_GAS_HPP
#define OPM_IDEAL_GAS_HPP
#include <opm/material/Constants.hpp>
namespace Opm
{
/*!
* \brief Relations valid for an ideal gas.
*/
template <class Scalar>
class IdealGas
{
public:
//! The ideal gas constant \f$\mathrm{[J/mol/K]}\f$
static const Scalar R;
/*!
* \brief The density of the gas in \f$\mathrm{[kg/m^3]}\f$, depending on
* pressure, temperature and average molar mass of the gas.
*/
static Scalar density(Scalar avgMolarMass,
Scalar temperature,
Scalar pressure)
{ return pressure*avgMolarMass/(R*temperature); }
/*!
* \brief The pressure of the gas in \f$\mathrm{[N/m^2]}\f$, depending on
* the molar density and temperature.
*/
static Scalar pressure(Scalar temperature,
Scalar rhoMolar)
{ return R*temperature*rhoMolar; }
/*!
* \brief The molar density of the gas \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
*/
static Scalar molarDensity(Scalar temperature,
Scalar pressure)
{ return pressure/(R*temperature); }
};
template <class Scalar>
const Scalar IdealGas<Scalar>::R = Opm::Constants<Scalar>::R;
} // namespace Opm
#endif