27#ifndef OPM_SIMPLE_HU_DUAN_H2O_HPP
28#define OPM_SIMPLE_HU_DUAN_H2O_HPP
34#include <opm/common/TimingMacros.hpp>
35#include <opm/common/OpmLog/OpmLog.hpp>
63template <
class Scalar>
78 OPM_HOST_DEVICE
static std::string_view
name()
141 template <
class Evaluation>
145 OPM_TIMEFUNCTION_LOCAL();
151 static constexpr Scalar n[10] = {
152 0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
153 0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
154 -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
158 Evaluation sigma = T + n[8]/(T - n[9]);
160 Evaluation A = (sigma + n[0])*sigma + n[1];
161 Evaluation B = (n[2]*sigma + n[3])*sigma + n[4];
162 Evaluation C = (n[5]*sigma + n[6])*sigma + n[7];
164 Evaluation tmp = 2.0*C/(sqrt(B*B - 4.0*A*C) - B);
177 template <
class Evaluation>
178 OPM_HOST_DEVICE
static Evaluation
gasEnthalpy(
const Evaluation& temperature,
180 {
return 1.976e3*temperature + 40.65e3/
molarMass(); }
186 template <
class Evaluation>
200 template <
class Evaluation>
203 {
return (temperature - 288.71) * (4.18060737e+03 + 8.64644981e-02 * (temperature - 288.71)); }
208 template <
class Evaluation>
226 template <
class Evaluation>
228 const Evaluation& pressure)
242 template <
class Evaluation>
244 const Evaluation& pressure,
258 template <
class Evaluation>
271 template <
class Evaluation>
284 template <
class Evaluation>
285 OPM_HOST_DEVICE
static Evaluation
gasDensity(
const Evaluation& temperature,
const Evaluation& pressure)
297 template <
class Evaluation>
298 OPM_HOST_DEVICE
static Evaluation
gasPressure(
const Evaluation& temperature,
const Evaluation& density)
312 template <
class Evaluation>
313 OPM_HOST_DEVICE
static Evaluation
liquidDensity(
const Evaluation& temperature,
const Evaluation& pressure,
316 return liquidDensity_(temperature, pressure, extrapolate);
325 template <
class Evaluation>
326 OPM_HOST_DEVICE
static Evaluation
liquidPressure(
const Evaluation& ,
const Evaluation& )
328#if OPM_IS_INSIDE_DEVICE_FUNCTION
329 assert(
false &&
"The liquid pressure is undefined for incompressible fluids");
331 throw std::logic_error(
"The liquid pressure is undefined for incompressible fluids");
342 template <
class Evaluation>
357 template <
class Evaluation>
358 OPM_HOST_DEVICE
static Evaluation
liquidViscosity(
const Evaluation& temperature,
const Evaluation& pressure,
361 if (temperature > 570) {
364#if !OPM_IS_INSIDE_DEVICE_FUNCTION
365 const std::string msg =
366 "Viscosity of water based on Hu et al is too "
367 "different from IAPWS for T above 570K and (T = " +
368 std::to_string(getValue(temperature)) +
")";
371 OpmLog::warning(msg);
379 assert(
false &&
"Viscosity of water based on Hu et al is too different from IAPWS for T above 570K");
384 const Evaluation rho =
liquidDensity(temperature, pressure, extrapolate);
398 template <
class Evaluation>
399 OPM_HOST_DEVICE
static Evaluation liquidDensity_(
const Evaluation& T,
const Evaluation& pressure,
bool extrapolate) {
403 OPM_TIMEBLOCK_LOCAL(liquidDensity_);
404 if (T > 647 || pressure > 100e6) {
405#if !OPM_IS_INSIDE_DEVICE_FUNCTION
406 const std::string msg =
407 "Density of water is only implemented for temperatures "
408 "below 647K and pressures below 100MPa. (T = " +
409 std::to_string(getValue(T)) +
", p=" +
410 std::to_string(getValue(pressure)) +
")";
413 OpmLog::warning(msg);
416 throw NumericalProblem(msg);
421 assert(
false &&
"Density of water is only implemented for temperatures below 647K and pressures below 100MPa");
426 Evaluation p = pressure / 1e6;
429 static constexpr Scalar k0[5] = { 3.27225e-07, -4.20950e-04, 2.32594e-01, -4.16920e+01, 5.71292e+03 };
430 static constexpr Scalar k1[5] = { -2.32306e-10, 2.91138e-07, -1.49662e-04, 3.59860e-02, -3.55071 };
431 static constexpr Scalar k2[3] = { 2.57241e-14, -1.24336e-11, 5.42707e-07 };
432 static constexpr Scalar k3[3] = { -4.42028e-18, 2.10007e-15, -8.11491e-11 };
433 Evaluation k0_eval = 1e-3 * (((k0[0]*T + k0[1])*T + k0[2])*T + k0[3] + k0[4]/T);
434 Evaluation k1_eval = 1e-2 * (((k1[0]*T + k1[1])*T + k1[2])*T + k1[3] + k1[4]/T);
435 Evaluation k2_eval = 1e-1 * ((k2[0]*T + k2[1])*T*T + k2[2]);
436 Evaluation k3_eval = (k3[0]*T + k3[1])*T*T + k3[2];
439 Evaluation vw = ((k3_eval*p + k2_eval)*p + k1_eval)*p + k0_eval;
Implements relations which are common for all regions of the IAPWS '97 formulation.
Abstract base class of a pure chemical species.
Provides the OPM specific exception classes.
Relations valid for an ideal gas.
Abstract base class of a pure chemical species.
Definition Component.hpp:44
Definition Constants.hpp:40
Implements relations which are common for all regions of the IAPWS '97 formulation.
Definition Common.hpp:56
static OPM_HOST_DEVICE Evaluation viscosity(const Evaluation &temperature, const Evaluation &rho)
The dynamic viscosity of pure water.
Definition Common.hpp:103
Relations valid for an ideal gas.
Definition IdealGas.hpp:39
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
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
static constexpr Scalar R
The ideal gas constant .
Definition IdealGas.hpp:42
Definition Exceptions.hpp:40
A simple version of pure water with density from Hu et al.
Definition SimpleHuDuanH2O.hpp:65
static OPM_HOST_DEVICE Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
The density of pure water at a given pressure and temperature .
Definition SimpleHuDuanH2O.hpp:313
static OPM_HOST_DEVICE Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
The dynamic viscosity of pure water.
Definition SimpleHuDuanH2O.hpp:358
static OPM_HOST_DEVICE Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition SimpleHuDuanH2O.hpp:285
static OPM_HOST_DEVICE Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a gas.
Definition SimpleHuDuanH2O.hpp:187
static OPM_HOST_DEVICE Scalar criticalTemperature()
Returns the critical temperature of water.
Definition SimpleHuDuanH2O.hpp:108
static OPM_HOST_DEVICE Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition SimpleHuDuanH2O.hpp:326
static OPM_HOST_DEVICE Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition SimpleHuDuanH2O.hpp:272
static OPM_HOST_DEVICE Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition SimpleHuDuanH2O.hpp:259
static OPM_HOST_DEVICE Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition SimpleHuDuanH2O.hpp:227
static OPM_HOST_DEVICE Evaluation liquidHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition SimpleHuDuanH2O.hpp:209
static OPM_HOST_DEVICE Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition SimpleHuDuanH2O.hpp:120
static OPM_HOST_DEVICE bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition SimpleHuDuanH2O.hpp:90
static OPM_HOST_DEVICE Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition SimpleHuDuanH2O.hpp:343
static OPM_HOST_DEVICE Scalar molarMass()
The molar mass in of water.
Definition SimpleHuDuanH2O.hpp:102
static OPM_HOST_DEVICE Scalar triplePressure()
Returns the pressure at water's triple point.
Definition SimpleHuDuanH2O.hpp:126
static OPM_HOST_DEVICE Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition SimpleHuDuanH2O.hpp:178
static OPM_HOST_DEVICE bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition SimpleHuDuanH2O.hpp:84
static OPM_HOST_DEVICE Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleHuDuanH2O.hpp:142
static OPM_HOST_DEVICE Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
Specific internal energy of liquid water .
Definition SimpleHuDuanH2O.hpp:243
static OPM_HOST_DEVICE std::string_view name()
A human readable name for the water.
Definition SimpleHuDuanH2O.hpp:78
static OPM_HOST_DEVICE Scalar criticalPressure()
Returns the critical pressure of water.
Definition SimpleHuDuanH2O.hpp:114
static OPM_HOST_DEVICE bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition SimpleHuDuanH2O.hpp:96
static OPM_HOST_DEVICE Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition SimpleHuDuanH2O.hpp:298
static OPM_HOST_DEVICE Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition SimpleHuDuanH2O.hpp:201
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30