Loading...
Searching...
No Matches
Air.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_AIR_HPP
#define OPM_AIR_HPP
#include <opm/common/Exceptions.hpp>
#include <opm/material/components/Component.hpp>
#include <opm/material/common/MathToolbox.hpp>
#include <opm/material/IdealGas.hpp>
#include <string_view>
namespace Opm {
template <class Scalar>
class Air : public Component<Scalar, Air<Scalar> >
{
typedef ::Opm::IdealGas<Scalar> IdealGas;
public:
using Component<Scalar, Air<Scalar>>::isTabulated;
static bool liquidIsCompressible()
{ throw std::runtime_error("Not implemented: Component::liquidIsCompressible()"); }
static std::string_view name()
{ return "Air"; }
static bool gasIsCompressible()
{ return true; }
static bool gasIsIdeal()
{ return true; }
static Scalar molarMass()
{ return 0.02896; /* [kg/mol] */ }
static Scalar criticalTemperature()
{ return 132.531 ; /* [K] */ }
static Scalar criticalPressure()
{ return 37.86e5; /* [Pa] */ }
template <class Evaluation>
static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
{ return IdealGas::density(Evaluation(molarMass()), temperature, pressure); }
template <class Evaluation>
static Evaluation gasPressure(const Evaluation& temperature, Scalar density)
{ return IdealGas::pressure(temperature, density/molarMass()); }
template <class Evaluation>
static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
{
Scalar Tc = criticalTemperature();
Scalar Vc = 84.525138; // critical specific volume [cm^3/mol]
Scalar omega = 0.078; // accentric factor
Scalar M = molarMass() * 1e3; // molar mas [g/mol]
Scalar dipole = 0.0; // dipole moment [debye]
Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc);
mu_r4 *= mu_r4;
mu_r4 *= mu_r4;
Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4;
Evaluation Tstar = 1.2593 * temperature/Tc;
Evaluation Omega_v =
1.16145*pow(Tstar, -0.14874) +
0.52487*exp(- 0.77320*Tstar) +
2.16178*exp(- 2.43787*Tstar);
return 40.7851e-7*Fc*sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v);
}
// simpler method, from old constrelAir.hh
template <class Evaluation>
static Evaluation simpleGasViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
{
if(temperature < 273.15 || temperature > 660.) {
throw NumericalProblem("Air: Temperature "+std::to_string(scalarValue(temperature))+"K out of range");
}
return 1.496e-6*pow(temperature, 1.5)/(temperature + 120);
}
template <class Evaluation>
static Evaluation gasEnthalpy(const Evaluation& temperature, const Evaluation& /*pressure*/)
{
return 1005.0*temperature;
}
template <class Evaluation>
static Evaluation gasInternalEnergy(const Evaluation& temperature,
const Evaluation& pressure)
{
return
gasEnthalpy(temperature, pressure)
- (IdealGas::R*temperature/molarMass()); // <- pressure times specific volume of an ideal gas
}
template <class Evaluation>
static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/)
{
// Isobaric Properties for Nitrogen in: NIST Standard
// see http://webbook.nist.gov/chemistry/fluid/
// evaluated at p=.1 MPa, T=20°C
// Nitrogen: 0.025398
// Oxygen: 0.026105
// lambda_air is approximately 0.78*lambda_N2+0.22*lambda_O2
return 0.0255535;
}
template <class Evaluation>
static Evaluation gasHeatCapacity(const Evaluation&,
const Evaluation&)
{
return 1005.0;
}
};
} // namespace Opm
#endif
Component.hpp
Abstract base class of a pure chemical species.
Exceptions.hpp
Provides the OPM specific exception classes.
IdealGas.hpp
Relations valid for an ideal gas.
MathToolbox.hpp
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Opm::Air
A simple class implementing the fluid properties of air.
Definition Air.hpp:49
Opm::Air::gasThermalConductivity
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition Air.hpp:221
Opm::Air::gasHeatCapacity
static Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of pure air.
Definition Air.hpp:250
Opm::Air::criticalPressure
static Scalar criticalPressure()
Returns the critical pressure of .
Definition Air.hpp:96
Opm::Air::gasDensity
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
Opm::Air::gasPressure
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of gaseous at a given density and temperature .
Definition Air.hpp:116
Opm::Air::molarMass
static Scalar molarMass()
The molar mass in of .
Definition Air.hpp:84
Opm::Air::name
static std::string_view name()
A human readable name for the .
Definition Air.hpp:64
Opm::Air::gasInternalEnergy
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of .
Definition Air.hpp:201
Opm::Air::gasIsCompressible
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition Air.hpp:70
Opm::Air::gasIsIdeal
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition Air.hpp:76
Opm::Air::liquidIsCompressible
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition Air.hpp:58
Opm::Air::gasEnthalpy
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition Air.hpp:184
Opm::Air::criticalTemperature
static Scalar criticalTemperature()
Returns the critical temperature of .
Definition Air.hpp:90
Opm::Air::gasViscosity
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition Air.hpp:141
Opm::Component
Abstract base class of a pure chemical species.
Definition Component.hpp:44
Opm::IdealGas::pressure
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
Opm::IdealGas::density
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
Opm::IdealGas::R
static constexpr Scalar R
The ideal gas constant .
Definition IdealGas.hpp:42
Opm::NumericalProblem
Definition Exceptions.hpp:40
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30