Loading...
Searching...
No Matches
SimpleH2O.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_SIMPLE_H2O_HPP
#define OPM_SIMPLE_H2O_HPP
#include "Component.hpp"
#include <opm/material/IdealGas.hpp>
#include <opm/material/common/MathToolbox.hpp>
#include <cmath>
#include <string_view>
namespace Opm {
template <class Scalar>
class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
{
typedef ::Opm::IdealGas<Scalar> IdealGas;
static const Scalar R; // specific gas constant of water
public:
static std::string_view name()
{ return "H2O"; }
static bool gasIsCompressible()
{ return true; }
static bool liquidIsCompressible()
{ return false; }
static bool gasIsIdeal()
{ return true; }
static Scalar molarMass()
{ return 18e-3; }
static Scalar criticalTemperature()
{ return 647.096; /* [K] */ }
static Scalar criticalPressure()
{ return 22.064e6; /* [N/m^2] */ }
static Scalar tripleTemperature()
{ return 273.16; /* [K] */ }
static Scalar triplePressure()
{ return 611.657; /* [N/m^2] */ }
template <class Evaluation>
static Evaluation vaporPressure(const Evaluation& T)
{
if (T > criticalTemperature())
return criticalPressure();
if (T < tripleTemperature())
return 0; // water is solid: We don't take sublimation into account
static const Scalar n[10] = {
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
0.65017534844798e3
};
Evaluation sigma = T + n[8]/(T - n[9]);
Evaluation A = (sigma + n[0])*sigma + n[1];
Evaluation B = (n[2]*sigma + n[3])*sigma + n[4];
Evaluation C = (n[5]*sigma + n[6])*sigma + n[7];
Evaluation tmp = 2.0*C/(sqrt(B*B - 4.0*A*C) - B);
tmp *= tmp;
tmp *= tmp;
return 1e6*tmp;
}
template <class Evaluation>
static Evaluation gasEnthalpy(const Evaluation& temperature,
const Evaluation& /*pressure*/)
{ return 1.976e3*temperature + 40.65e3/molarMass(); }
template <class Evaluation>
static Evaluation gasHeatCapacity(const Evaluation&,
const Evaluation&)
{ return 1.976e3; }
template <class Evaluation>
static Evaluation liquidEnthalpy(const Evaluation& temperature,
const Evaluation& /*pressure*/)
{ return 4180*temperature; }
template <class Evaluation>
static Evaluation liquidHeatCapacity(const Evaluation&,
const Evaluation&)
{ return 4.184e3; }
template <class Evaluation>
static Evaluation gasInternalEnergy(const Evaluation& temperature,
const Evaluation& pressure)
{
return
gasEnthalpy(temperature, pressure) -
1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
}
template <class Evaluation>
static Evaluation liquidInternalEnergy(const Evaluation& temperature,
const Evaluation& pressure)
{
return
liquidEnthalpy(temperature, pressure) -
pressure/liquidDensity(temperature, pressure);
}
template <class Evaluation>
static Evaluation liquidThermalConductivity(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/)
{
return 0.578078; // conductivity of liquid water [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
}
template <class Evaluation>
static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/)
{
return 0.028224; // conductivity of steam [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
}
template <class Evaluation>
static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
{
// Assume an ideal gas
return molarMass()*IdealGas::molarDensity(temperature, pressure);
}
template <class Evaluation>
static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
{
// Assume an ideal gas
return IdealGas::pressure(temperature, density/molarMass());
}
template <class Evaluation>
static Evaluation liquidDensity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
{
return 1000;
}
template <class Evaluation>
static Evaluation liquidPressure(const Evaluation& /*temperature*/, const Evaluation& /*density*/)
{
throw std::logic_error("The liquid pressure is undefined for incompressible fluids");
}
template <class Evaluation>
static Evaluation gasViscosity(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/)
{
return 1e-05;
}
template <class Evaluation>
static Evaluation liquidViscosity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
{
return 1e-03;
}
};
template <class Scalar>
const Scalar SimpleH2O<Scalar>::R = Constants<Scalar>::R / 18e-3;
} // namespace Opm
#endif
Component.hpp
Abstract base class of a pure chemical species.
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::Component
Abstract base class of a pure chemical species.
Definition Component.hpp:44
Opm::Constants::R
static constexpr Scalar R
The ideal gas constant [J/(mol K)].
Definition Constants.hpp:45
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::molarDensity
static OPM_HOST_DEVICE Evaluation molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition IdealGas.hpp:68
Opm::IdealGas::R
static constexpr Scalar R
The ideal gas constant .
Definition IdealGas.hpp:42
Opm::SimpleH2O
A simple version of pure water.
Definition SimpleH2O.hpp:57
Opm::SimpleH2O::gasInternalEnergy
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition SimpleH2O.hpp:210
Opm::SimpleH2O::gasHeatCapacity
static Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a gas.
Definition SimpleH2O.hpp:173
Opm::SimpleH2O::liquidIsCompressible
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition SimpleH2O.hpp:78
Opm::SimpleH2O::name
static std::string_view name()
A human readable name for the water.
Definition SimpleH2O.hpp:66
Opm::SimpleH2O::gasIsIdeal
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition SimpleH2O.hpp:84
Opm::SimpleH2O::gasThermalConductivity
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition SimpleH2O.hpp:254
Opm::SimpleH2O::tripleTemperature
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition SimpleH2O.hpp:108
Opm::SimpleH2O::liquidPressure
static Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition SimpleH2O.hpp:305
Opm::SimpleH2O::liquidHeatCapacity
static Evaluation liquidHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition SimpleH2O.hpp:192
Opm::SimpleH2O::vaporPressure
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleH2O.hpp:130
Opm::SimpleH2O::liquidDensity
static Evaluation liquidDensity(const Evaluation &, const Evaluation &)
The density of pure water at a given pressure and temperature .
Definition SimpleH2O.hpp:293
Opm::SimpleH2O::molarMass
static Scalar molarMass()
The molar mass in of water.
Definition SimpleH2O.hpp:90
Opm::SimpleH2O::criticalTemperature
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition SimpleH2O.hpp:96
Opm::SimpleH2O::liquidEnthalpy
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition SimpleH2O.hpp:184
Opm::SimpleH2O::gasViscosity
static Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition SimpleH2O.hpp:318
Opm::SimpleH2O::gasIsCompressible
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition SimpleH2O.hpp:72
Opm::SimpleH2O::gasEnthalpy
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition SimpleH2O.hpp:164
Opm::SimpleH2O::gasPressure
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition SimpleH2O.hpp:280
Opm::SimpleH2O::liquidInternalEnergy
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition SimpleH2O.hpp:226
Opm::SimpleH2O::liquidThermalConductivity
static Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition SimpleH2O.hpp:241
Opm::SimpleH2O::gasDensity
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition SimpleH2O.hpp:267
Opm::SimpleH2O::criticalPressure
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition SimpleH2O.hpp:102
Opm::SimpleH2O::triplePressure
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition SimpleH2O.hpp:114
Opm::SimpleH2O::liquidViscosity
static Evaluation liquidViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of pure water.
Definition SimpleH2O.hpp:331
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30