60 template <
class Scalar>
68 static const Scalar Rs;
131 template <
class Evaluation>
153 template <
class Evaluation>
176 template <
class Evaluation>
178 const Evaluation& pressure)
182 std::ostringstream oss;
183 oss <<
"Enthalpy of steam is only implemented for temperatures below 623.15K and "
184 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
197 return enthalpyRegion2_<Evaluation>(temperature,
triplePressure() - 100);
210 enthalpyRegion2_(temperature, pv) +
211 (pressure - pv)*dh_dp;
214 return enthalpyRegion2_(temperature, pressure);
229 template <
class Evaluation>
231 const Evaluation& pressure)
235 std::ostringstream oss;
236 oss <<
"Enthalpy of water is only implemented for temperatures below 623.15K and "
237 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
247 const Evaluation& dh_dp =
254 enthalpyRegion1_(temperature, pv) +
255 (pressure - pv)*dh_dp;
258 return enthalpyRegion1_(temperature, pressure);
273 template <
class Evaluation>
275 const Evaluation& pressure)
279 std::ostringstream oss;
280 oss <<
"Heat capacity of steam is only implemented for temperatures below 623.15K and "
281 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
288 return heatCap_p_Region2_(temperature, Evaluation(
triplePressure() - 100));
293 return heatCap_p_Region2_(temperature, pv);
295 return heatCap_p_Region2_(temperature, pressure);
310 template <
class Evaluation>
312 const Evaluation& pressure)
316 std::ostringstream oss;
317 oss <<
"Heat capacity of water is only implemented for temperatures below 623.15K and "
318 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
327 return heatCap_p_Region1_(temperature, pv);
330 return heatCap_p_Region1_(temperature, pressure);
345 template <
class Evaluation>
347 const Evaluation& pressure)
351 std::ostringstream oss;
352 oss <<
"Internal Energy of water is only implemented for temperatures below 623.15K and "
353 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
360 Scalar pv = vaporPressure<Scalar>(scalarValue(temperature));
384 const Evaluation& uv = internalEnergyRegion1_(temperature, Evaluation(pv));
385 const Evaluation& uvPEps = internalEnergyRegion1_(temperature, Evaluation(pv + eps));
386 const Evaluation& du_dp = (uvPEps - uv)/eps;
387 return uv + du_dp*(pressure - pv);
390 return internalEnergyRegion1_(temperature, pressure);
405 template <
class Evaluation>
410 std::ostringstream oss;
411 oss <<
"Internal energy of steam is only implemented for temperatures below 623.15K and "
412 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
427 enthalpyRegion2_(temperature, Evaluation(
triplePressure() - 100.0))
459 const Evaluation& uv = internalEnergyRegion2_(temperature, Evaluation(pv));
460 const Evaluation& uvMEps = internalEnergyRegion2_(temperature, Evaluation(pv - eps));
461 const Evaluation& du_dp = (uv - uvMEps)/eps;
462 return uv + du_dp*(pressure - pv);
465 return internalEnergyRegion2_(temperature, pressure);
480 template <
class Evaluation>
482 const Evaluation& pressure)
486 std::ostringstream oss;
487 oss <<
"Heat capacity of water is only implemented for temperatures below 623.15K and "
488 "pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
499 return heatCap_v_Region1_(temperature, pv);
502 return heatCap_v_Region1_(temperature, pressure);
517 template <
class Evaluation>
522 std::ostringstream oss;
523 oss <<
"Heat capacity of steam is only implemented for temperatures below 623.15K and "
524 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
535 return heatCap_v_Region2_(temperature, pv);
538 return heatCap_v_Region2_(temperature, pressure);
565 template <
class Evaluation>
566 static Evaluation
gasDensity(
const Evaluation& temperature,
const Evaluation& pressure)
570 std::ostringstream oss;
571 oss <<
"Density of steam is only implemented for temperatures below 623.15K and "
572 "pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
580 const Evaluation& rho0IAPWS =
581 1.0/volumeRegion2_(temperature,
583 const Evaluation& rho0Id =
601 Scalar eps = scalarValue(pv)*1e-8;
602 Evaluation v0 = volumeRegion2_(temperature, pv);
603 Evaluation v1 = volumeRegion2_(temperature, pv + eps);
604 Evaluation dv_dp = (v1 - v0)/eps;
620 Evaluation drho_dp = - 1/(v0*v0)*dv_dp;
623 return 1.0/v0 + (pressure - pv)*drho_dp;
626 return 1.0/volumeRegion2_(temperature, pressure);
647 template <
class Evaluation>
648 static Evaluation
gasPressure(
const Evaluation& temperature, Scalar density)
650 Valgrind::CheckDefined(temperature);
651 Valgrind::CheckDefined(density);
656 Scalar eps = pressure*1e-7;
658 Evaluation deltaP = pressure*2;
659 Valgrind::CheckDefined(pressure);
660 Valgrind::CheckDefined(deltaP);
661 for (
int i = 0; i < 5 && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP)); ++i) {
662 Evaluation f =
gasDensity(temperature, pressure) - density;
665 df_dp =
gasDensity(temperature, pressure + eps);
666 df_dp -=
gasDensity(temperature, pressure - eps);
672 Valgrind::CheckDefined(pressure);
673 Valgrind::CheckDefined(deltaP);
691 template <
class Evaluation>
693 const Evaluation& pressure,
694 bool extrapolate =
false)
698 std::ostringstream oss;
699 oss <<
"Density of water is only implemented for temperatures below 623.15K and "
700 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
712 Scalar eps = scalarValue(pv)*1e-8;
713 Evaluation v0 = volumeRegion1_(temperature, pv);
714 Evaluation v1 = volumeRegion1_(temperature, pv + eps);
715 Evaluation dv_dp = (v1 - v0)/eps;
733 Evaluation drho_dp = - 1/(v0*v0)*dv_dp;
736 return 1.0/v0 + (pressure - pv)*drho_dp;
739 return 1/volumeRegion1_(temperature, pressure);
755 template <
class Evaluation>
762 Scalar eps = scalarValue(pressure)*1e-7;
764 Evaluation deltaP = pressure*2;
765 for (
int i = 0; i < 5 && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP)); ++i) {
766 Evaluation f =
liquidDensity(temperature, pressure) - density;
795 template <
class Evaluation>
796 static Evaluation
gasViscosity(
const Evaluation& temperature,
const Evaluation& pressure)
800 std::ostringstream oss;
801 oss <<
"Viscosity of steam is only implemented for temperatures below 623.15K and "
802 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
806 Evaluation rho =
gasDensity(temperature, pressure);
821 template <
class Evaluation>
823 const Evaluation& pressure,
824 bool extrapolate =
false)
828 std::ostringstream oss;
829 oss <<
"Viscosity of water is only implemented for temperatures below 623.15K and "
830 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
834 const Evaluation& rho =
liquidDensity(temperature, pressure, extrapolate);
851 template <
class Evaluation>
854 const Evaluation& rho =
liquidDensity(temperature, pressure);
871 template <
class Evaluation>
874 const Evaluation& rho =
gasDensity(temperature, pressure);
880 template <
class Evaluation>
881 static Evaluation enthalpyRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
890 template <
class Evaluation>
891 static Evaluation heatCap_p_Region1_(
const Evaluation& temperature,
const Evaluation& pressure)
900 template <
class Evaluation>
901 static Evaluation heatCap_v_Region1_(
const Evaluation& temperature,
const Evaluation& pressure)
908 - std::pow(tau, 2 ) *
914 template <
class Evaluation>
915 static Evaluation internalEnergyRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
924 template <
class Evaluation>
925 static Evaluation volumeRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
930 Rs * temperature / pressure;
934 template <
class Evaluation>
935 static Evaluation enthalpyRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
944 template <
class Evaluation>
945 static Evaluation internalEnergyRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
954 template <
class Evaluation>
955 static Evaluation heatCap_p_Region2_(
const Evaluation& temperature,
const Evaluation& pressure)
964 template <
class Evaluation>
965 static Evaluation heatCap_v_Region2_(
const Evaluation& temperature,
const Evaluation& pressure)
972 - std::pow(tau, 2 ) *
978 template <
class Evaluation>
979 static Evaluation volumeRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
984 Rs * temperature / pressure;
988 template <
class Scalar>
989 const Scalar H2O<Scalar>::Rs = Common::Rs;
Implements relations which are common for all regions of the IAPWS '97 formulation.
Abstract base class of a pure chemical species.
Provides the opm-material specific exception classes.
Relations valid for an ideal gas.
Implements the equations for region 1 of the IAPWS '97 formulation.
Implements the equations for region 2 of the IAPWS '97 formulation.
Implements the equations for region 4 of the IAPWS '97 formulation.
Some templates to wrap the valgrind client request macros.
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
Material properties of pure water .
Definition: H2O.hpp:62
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of pure water in at a given pressure and temperature.
Definition: H2O.hpp:692
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:92
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: H2O.hpp:566
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: H2O.hpp:544
static const char * name()
A human readable name for the water.
Definition: H2O.hpp:74
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: H2O.hpp:648
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:132
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:796
static Evaluation gasHeatCapacityConstVolume(const Evaluation &temperature, const Evaluation &pressure)
Specific isochoric heat capacity of steam and water vapor .
Definition: H2O.hpp:518
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: H2O.hpp:274
static const Scalar criticalMolarVolume()
Returns the molar volume of water at the critical point.
Definition: H2O.hpp:104
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:230
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:852
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: H2O.hpp:346
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:632
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition: H2O.hpp:98
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
static Evaluation vaporTemperature(const Evaluation &pressure)
The vapor temperature in of pure water at a given pressure.
Definition: H2O.hpp:154
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:550
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of pure water.
Definition: H2O.hpp:822
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam and water vapor .
Definition: H2O.hpp:406
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:872
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:177
static Evaluation liquidHeatCapacityConstVolume(const Evaluation &temperature, const Evaluation &pressure)
Specific isochoric heat capacity of liquid water .
Definition: H2O.hpp:481
static Evaluation liquidPressure(const Evaluation &temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: H2O.hpp:756
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:110
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of liquid water .
Definition: H2O.hpp:311
static const Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: H2O.hpp:116
Implements relations which are common for all regions of the IAPWS '97 formulation.
Definition: Common.hpp:55
static const Scalar criticalPressure
Critical pressure of water .
Definition: Common.hpp:67
static Evaluation viscosity(const Evaluation &temperature, const Evaluation &rho)
The dynamic viscosity of pure water.
Definition: Common.hpp:99
static const Scalar criticalMolarVolume
Critical molar volume of water .
Definition: Common.hpp:73
static const Scalar criticalTemperature
Critical temperature of water .
Definition: Common.hpp:64
static Evaluation thermalConductivityIAPWS(const Evaluation &T, const Evaluation &rho)
Thermal conductivity water (IAPWS) .
Definition: Common.hpp:159
static const Scalar tripleTemperature
Triple temperature of water .
Definition: Common.hpp:79
static const Scalar triplePressure
Triple pressure of water .
Definition: Common.hpp:82
static const Scalar molarMass
The molar mass of water .
Definition: Common.hpp:58
static const Scalar acentricFactor
The acentric factor of water .
Definition: Common.hpp:76
Implements the equations for region 1 of the IAPWS '97 formulation.
Definition: Region1.hpp:51
static Evaluation ddgamma_ddpi(const Evaluation &temperature, const Evaluation &pressure)
The second partial derivative of the Gibbs free energy to the normalized pressure for IAPWS region 1 ...
Definition: Region1.hpp:252
static Evaluation tau(const Evaluation &temperature)
Returns the reduced temperature for IAPWS region 1.
Definition: Region1.hpp:83
static Evaluation ddgamma_ddtau(const Evaluation &temperature, const Evaluation &pressure)
The second partial derivative of the Gibbs free energy to the normalized temperature for IAPWS region...
Definition: Region1.hpp:282
static Evaluation pi(const Evaluation &pressure)
Returns the reduced pressure for IAPWS region 1.
Definition: Region1.hpp:102
static Evaluation dgamma_dtau(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized temperature for IAPWS region 1 (i....
Definition: Region1.hpp:162
static bool isValid(const Evaluation &temperature, const Evaluation &pressure)
Returns true if IAPWS region 1 applies for a (temperature in , pressure in ) pair.
Definition: Region1.hpp:61
static Evaluation ddgamma_dtaudpi(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized pressure and to the normalized temp...
Definition: Region1.hpp:221
static Scalar dpi_dp(const Evaluation &)
Returns the derivative of the reduced pressure to the pressure for IAPWS region 1 in .
Definition: Region1.hpp:112
static Evaluation dgamma_dpi(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized pressure for IAPWS region 1 (i....
Definition: Region1.hpp:191
Implements the equations for region 2 of the IAPWS '97 formulation.
Definition: Region2.hpp:52
static Scalar dpi_dp(const Evaluation &)
Returns the derivative of the reduced pressure to the pressure for IAPWS region 2 in .
Definition: Region2.hpp:111
static Evaluation ddgamma_ddtau(const Evaluation &temperature, const Evaluation &pressure)
The second partial derivative of the Gibbs free energy to the normalized temperature for IAPWS region...
Definition: Region2.hpp:310
static Evaluation ddgamma_ddpi(const Evaluation &temperature, const Evaluation &pressure)
The second partial derivative of the Gibbs free energy to the normalized pressure for IAPWS region 2 ...
Definition: Region2.hpp:276
static Evaluation pi(const Evaluation &pressure)
Returns the reduced pressure (dimensionless) for IAPWS region 2.
Definition: Region2.hpp:101
static Evaluation dgamma_dtau(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized temperature for IAPWS region 2 (i....
Definition: Region2.hpp:170
static Evaluation tau(const Evaluation &temperature)
Returns the reduced temperature (dimensionless) for IAPWS region 2.
Definition: Region2.hpp:82
static Evaluation ddgamma_dtaudpi(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized pressure and to the normalized temp...
Definition: Region2.hpp:242
static bool isValid(const Evaluation &temperature, const Evaluation &pressure)
Returns true if IAPWS region 2 applies for a (temperature, pressure) pair.
Definition: Region2.hpp:62
static Evaluation dgamma_dpi(const Evaluation &temperature, const Evaluation &pressure)
The partial derivative of the Gibbs free energy to the normalized pressure for IAPWS region 2 (i....
Definition: Region2.hpp:209
Implements the equations for region 4 of the IAPWS '97 formulation.
Definition: Region4.hpp:52
static Evaluation vaporTemperature(const Evaluation &pressure)
Returns the saturation temperature in of pure water at a given pressure.
Definition: Region4.hpp:94
static Evaluation saturationPressure(const Evaluation &temperature)
Returns the saturation pressure in of pure water at a given temperature.
Definition: Region4.hpp:63
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:58
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:48
Definition: Exceptions.hpp:46