60 template <
class Scalar>
68 static const Scalar Rs;
137 template <
class Evaluation>
159 template <
class Evaluation>
182 template <
class Evaluation>
184 const Evaluation& pressure)
188 std::ostringstream oss;
189 oss <<
"Enthalpy of steam is only implemented for temperatures below 623.15K and "
190 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
203 return enthalpyRegion2_<Evaluation>(temperature,
triplePressure() - 100);
216 enthalpyRegion2_(temperature, pv) +
217 (pressure - pv)*dh_dp;
220 return enthalpyRegion2_(temperature, pressure);
235 template <
class Evaluation>
237 const Evaluation& pressure)
241 std::ostringstream oss;
242 oss <<
"Enthalpy of water is only implemented for temperatures below 623.15K and "
243 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
253 const Evaluation& dh_dp =
260 enthalpyRegion1_(temperature, pv) +
261 (pressure - pv)*dh_dp;
264 return enthalpyRegion1_(temperature, pressure);
279 template <
class Evaluation>
281 const Evaluation& pressure)
285 std::ostringstream oss;
286 oss <<
"Heat capacity of steam is only implemented for temperatures below 623.15K and "
287 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
294 return heatCap_p_Region2_(temperature, Evaluation(
triplePressure() - 100));
299 return heatCap_p_Region2_(temperature, pv);
301 return heatCap_p_Region2_(temperature, pressure);
316 template <
class Evaluation>
318 const Evaluation& pressure)
322 std::ostringstream oss;
323 oss <<
"Heat capacity of water is only implemented for temperatures below 623.15K and "
324 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
333 return heatCap_p_Region1_(temperature, pv);
336 return heatCap_p_Region1_(temperature, pressure);
351 template <
class Evaluation>
353 const Evaluation& pressure)
357 std::ostringstream oss;
358 oss <<
"Internal Energy of water is only implemented for temperatures below 623.15K and "
359 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
366 Scalar pv = vaporPressure<Scalar>(scalarValue(temperature));
390 const Evaluation& uv = internalEnergyRegion1_(temperature, Evaluation(pv));
391 const Evaluation& uvPEps = internalEnergyRegion1_(temperature, Evaluation(pv + eps));
392 const Evaluation& du_dp = (uvPEps - uv)/eps;
393 return uv + du_dp*(pressure - pv);
396 return internalEnergyRegion1_(temperature, pressure);
411 template <
class Evaluation>
416 std::ostringstream oss;
417 oss <<
"Internal energy of steam is only implemented for temperatures below 623.15K and "
418 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
433 enthalpyRegion2_(temperature, Evaluation(
triplePressure() - 100.0))
465 const Evaluation& uv = internalEnergyRegion2_(temperature, Evaluation(pv));
466 const Evaluation& uvMEps = internalEnergyRegion2_(temperature, Evaluation(pv - eps));
467 const Evaluation& du_dp = (uv - uvMEps)/eps;
468 return uv + du_dp*(pressure - pv);
471 return internalEnergyRegion2_(temperature, pressure);
486 template <
class Evaluation>
488 const Evaluation& pressure)
492 std::ostringstream oss;
493 oss <<
"Heat capacity of water is only implemented for temperatures below 623.15K and "
494 "pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
505 return heatCap_v_Region1_(temperature, pv);
508 return heatCap_v_Region1_(temperature, pressure);
523 template <
class Evaluation>
528 std::ostringstream oss;
529 oss <<
"Heat capacity of steam is only implemented for temperatures below 623.15K and "
530 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
541 return heatCap_v_Region2_(temperature, pv);
544 return heatCap_v_Region2_(temperature, pressure);
571 template <
class Evaluation>
572 static Evaluation
gasDensity(
const Evaluation& temperature,
const Evaluation& pressure)
576 std::ostringstream oss;
577 oss <<
"Density of steam is only implemented for temperatures below 623.15K and "
578 "pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
586 const Evaluation& rho0IAPWS =
587 1.0/volumeRegion2_(temperature,
589 const Evaluation& rho0Id =
607 Scalar eps = scalarValue(pv)*1e-8;
608 Evaluation v0 = volumeRegion2_(temperature, pv);
609 Evaluation v1 = volumeRegion2_(temperature, pv + eps);
610 Evaluation dv_dp = (v1 - v0)/eps;
626 Evaluation drho_dp = - 1/(v0*v0)*dv_dp;
629 return 1.0/v0 + (pressure - pv)*drho_dp;
632 return 1.0/volumeRegion2_(temperature, pressure);
653 template <
class Evaluation>
654 static Evaluation
gasPressure(
const Evaluation& temperature, Scalar density)
656 Valgrind::CheckDefined(temperature);
657 Valgrind::CheckDefined(density);
662 Scalar eps = pressure*1e-7;
664 Evaluation deltaP = pressure*2;
665 Valgrind::CheckDefined(pressure);
666 Valgrind::CheckDefined(deltaP);
667 for (
int i = 0; i < 5 && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP)); ++i) {
668 Evaluation f =
gasDensity(temperature, pressure) - density;
671 df_dp =
gasDensity(temperature, pressure + eps);
672 df_dp -=
gasDensity(temperature, pressure - eps);
678 Valgrind::CheckDefined(pressure);
679 Valgrind::CheckDefined(deltaP);
697 template <
class Evaluation>
699 const Evaluation& pressure,
700 bool extrapolate =
false)
704 std::ostringstream oss;
705 oss <<
"Density of water is only implemented for temperatures below 623.15K and "
706 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
718 Scalar eps = scalarValue(pv)*1e-8;
719 Evaluation v0 = volumeRegion1_(temperature, pv);
720 Evaluation v1 = volumeRegion1_(temperature, pv + eps);
721 Evaluation dv_dp = (v1 - v0)/eps;
739 Evaluation drho_dp = - 1/(v0*v0)*dv_dp;
742 return 1.0/v0 + (pressure - pv)*drho_dp;
745 return 1/volumeRegion1_(temperature, pressure);
761 template <
class Evaluation>
768 Scalar eps = scalarValue(pressure)*1e-7;
770 Evaluation deltaP = pressure*2;
771 for (
int i = 0; i < 5 && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP)); ++i) {
772 Evaluation f =
liquidDensity(temperature, pressure) - density;
801 template <
class Evaluation>
802 static Evaluation
gasViscosity(
const Evaluation& temperature,
const Evaluation& pressure)
806 std::ostringstream oss;
807 oss <<
"Viscosity of steam is only implemented for temperatures below 623.15K and "
808 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
812 Evaluation rho =
gasDensity(temperature, pressure);
827 template <
class Evaluation>
829 const Evaluation& pressure,
830 bool extrapolate =
false)
834 std::ostringstream oss;
835 oss <<
"Viscosity of water is only implemented for temperatures below 623.15K and "
836 <<
"pressures below 100MPa. (T = " << temperature <<
", p=" << pressure;
840 const Evaluation& rho =
liquidDensity(temperature, pressure, extrapolate);
857 template <
class Evaluation>
860 const Evaluation& rho =
liquidDensity(temperature, pressure);
877 template <
class Evaluation>
880 const Evaluation& rho =
gasDensity(temperature, pressure);
886 template <
class Evaluation>
887 static Evaluation enthalpyRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
896 template <
class Evaluation>
897 static Evaluation heatCap_p_Region1_(
const Evaluation& temperature,
const Evaluation& pressure)
906 template <
class Evaluation>
907 static Evaluation heatCap_v_Region1_(
const Evaluation& temperature,
const Evaluation& pressure)
914 - std::pow(tau, 2 ) *
920 template <
class Evaluation>
921 static Evaluation internalEnergyRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
930 template <
class Evaluation>
931 static Evaluation volumeRegion1_(
const Evaluation& temperature,
const Evaluation& pressure)
936 Rs * temperature / pressure;
940 template <
class Evaluation>
941 static Evaluation enthalpyRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
950 template <
class Evaluation>
951 static Evaluation internalEnergyRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
960 template <
class Evaluation>
961 static Evaluation heatCap_p_Region2_(
const Evaluation& temperature,
const Evaluation& pressure)
970 template <
class Evaluation>
971 static Evaluation heatCap_v_Region2_(
const Evaluation& temperature,
const Evaluation& pressure)
978 - std::pow(tau, 2 ) *
984 template <
class Evaluation>
985 static Evaluation volumeRegion2_(
const Evaluation& temperature,
const Evaluation& pressure)
990 Rs * temperature / pressure;
994 template <
class Scalar>
995 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:698
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:572
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: H2O.hpp:550
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:654
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:138
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:802
static Evaluation gasHeatCapacityConstVolume(const Evaluation &temperature, const Evaluation &pressure)
Specific isochoric heat capacity of steam and water vapor .
Definition: H2O.hpp:524
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: H2O.hpp:280
static const Scalar criticalMolarVolume()
Returns the molar volume of water at the critical point.
Definition: H2O.hpp:110
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:236
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:858
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:352
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:638
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:160
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:556
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of pure water.
Definition: H2O.hpp:828
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam and water vapor .
Definition: H2O.hpp:412
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:878
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:183
static Evaluation liquidHeatCapacityConstVolume(const Evaluation &temperature, const Evaluation &pressure)
Specific isochoric heat capacity of liquid water .
Definition: H2O.hpp:487
static Evaluation liquidPressure(const Evaluation &temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: H2O.hpp:762
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:116
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of liquid water .
Definition: H2O.hpp:317
static const Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: H2O.hpp:122
static const Scalar criticalVolume()
Returns the critical volume of water.
Definition: H2O.hpp:104
Implements relations which are common for all regions of the IAPWS '97 formulation.
Definition: Common.hpp:55
static const Scalar criticalVolume
Critical volume of water .
Definition: Common.hpp:73
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:102
static const Scalar criticalMolarVolume
Critical molar volume of water .
Definition: Common.hpp:76
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:162
static const Scalar tripleTemperature
Triple temperature of water .
Definition: Common.hpp:82
static const Scalar triplePressure
Triple pressure of water .
Definition: Common.hpp:85
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:79
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