Package 'iapws'

Title: Formulations of the International Association for the Properties of Water and Steam
Description: Implementation of some of the formulations for the thermodynamic and transport properties released by the International Association for the Properties of Water and Steam (IAPWS). More specifically, the releases R1-76(2014), R5-85(1994), R6-95(2018), R7-97(2012), R8-97, R9-97, R10-06(2009), R11-07(2019), R12-08, R15-11, R16-17(2018), R17-20 and R18-21 at <http://iapws.org>.
Authors: Jonathan Debove [aut, cre]
Maintainer: Jonathan Debove <[email protected]>
License: GPL (>= 3)
Version: 1.1
Built: 2024-11-08 06:33:55 UTC
Source: CRAN

Help Index


IAPWS-17 Formulation in Single Phase Regions

Description

Compute thermodynamic and transport properties of heavy water and steam using the IAPWS formulation 2017.

Usage

heavy17(what, p, t, rho, state = NULL)

Arguments

what

a character vector listing the output properties. See Details for available properties.

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

rho

a numeric vector giving the density values in kg/m3^3.

state

NULL or a character vector giving the physical state. One of "liquid", "gas" or "supercritical". In case of NULL, the state is determined by the function heavy17_state().

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

  • "eta": the dynamic viscosity in μ\muPa.s.

  • "lambda": the thermal conductivity in mW/K/m.

A valid pair of p, rho and t is needed: either (p, t) or (rho, t).

Value

A numeric matrix of dimension c(n, length(what)) with n the maximum length of either rho, p, t or state.

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R16-17(2018), Revised Release on the IAPWS Formulation 2017 for the Thermodynamic Properties of Heavy Water.

International Association for the Properties of Water and Steam, IAPWS R17-20, Release on the IAPWS Formulation 2020 for the Viscosity of Heavy Water.

International Association for the Properties of Water and Steam, IAPWS R18-21, Release on the IAPWS Formulation 2021 for the Thermal Conductivity of Heavy Water.

Examples

# IAPWS-17 Tab. 7
M <- 20.027508  # g/mol
tab <- heavy17(c("p", "cv", "w", "s"),
               t = c(300, 300, 300,
                     500, 500, 500, 500, 500,
                     643.8,
                     800, 800),
               rho = c(0.55126e2, 0.6e2, 0.65e2,
                       0.5e-1, 0.5, 0.4626e2, 0.5e2, 0.6e2,
                       0.2e2,
                       0.1e-1, 0.25) * M)
tab[, c("cv", "s")] <- tab[, c("cv", "s")] / M
format(tab, scientific = TRUE, digits = 9)


# Viscosity Tab. 3
tab <- heavy17("eta", t = c(298.15, 298.15, 298.15, 373.15,
                            775.0, 775.0, 775.0),
               rho = c(0, 1105, 1130, 1064, 1, 100, 400))
format(tab, digits = 8)

# Viscosity Tab. 4
tab <- heavy17("eta", t = 644.101, rho = c(145, 245, 295, 345, 395, 445))
format(tab, digits = 8)


# Thermal conductivity Tab. 3
tab <- heavy17("lambda", t = c(298.15, 298.15, 298.15, 825),
	       rho = c(0, 1104.5, 1200, 0))
format(tab, digits = 6)


# Thermal conductivity Tab. 4
tab <- heavy17("lambda", t = 644.10,
	       rho = c(1, 106, 256, 306, 356, 406, 456, 750))
format(tab, digits = 6)

IAPWS-17 Formulation in the Saturation Region

Description

Compute thermodynamic and transport properties of heavy water along the saturated line according to the IAPWS formulation 2017.

Usage

heavy17_sat(what, p, t)

Arguments

what

a character vector listing the output properties. See Details for available properties.

t

a numeric vector giving the temperature values in K.

p

a numeric vector giving the pressure values in MPa.

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

  • "eta": the dynamic viscosity in μ\muPa.s.

  • "lambda": the thermal conductivity in mW/K/m.

Only one of t or p is needed. If both arguments are given, p is ignored.

Value

A numeric array of dimension c(n, length(what), 2L) with n the length of either p or t. The last dimension indicate the physical state ("liquid" or "gas").

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R16-17(2018), Revised Release on the IAPWS Formulation 2017 for the Thermodynamic Properties of Heavy Water.

Examples

# IAPWS-17 Tab. 8
M <- 20.027508  # g/mol
tab <- heavy17_sat(c("p", "rho", "h", "s"), t = c(280, 450, 625))
format(tab, scientific = TRUE, digits = 9)

IAPWS-17 Physical States

Description

Identify the physical state of heavy water according to the IAPWS formulation 2017.

Usage

heavy17_state(p, t, rho)

Arguments

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

rho

a numeric vector giving the density values in kg/m3^3.

Details

A valid pair of p, rho, t is needed: either (p, t) or (rho, t).

Value

A character vector giving the physical state. One of "solid", "liquid", "gas", "supercritical", "saturated" or "undef".

Author(s)

Jonathan Debove

Examples

heavy17_state(p = c(.1, .1, 23), t = c(293.15, 393.15, 650))
heavy17_state(rho = c(1200, .1, 500, 500),
              t = c(293.15, 373.15, 650, 373.15))

Constants built into iapws

Description

IAPWS and IAPWS95 contain constants relative to ordinary water substance. HEAVY17 is the same but for heavy water.

Usage

IAPWS
IAPWS95
HEAVY17

Format

IAPWS, IAPWS95 and HEAVY17 are numeric verctors with with the following named elements:

"R"

molar gas constant in J/K/mol.

"M"

molar mass in g/mol.

"Pc"

critical pressure in MPa.

"Tc"

critical temperature in K.

"RHOc"

critical density in kg/m3^3.

"Pt"

triple-point pressure in MPa.

"Tt"

triple-point temperature in K.

Examples

# Convert critical density of water in mol/L
IAPWS["RHOc"] / IAPWS["M"]

IAPWS Formulations for Electrostatic Properties of Water

Description

Compute the dielectric constant, refractive index and ionization constant of water.

Usage

iapws_epsilon(rho, t)
iapws_n(rho, t, lambda)
iapws_pk(rho, t)

Arguments

rho

a numeric vector giving the density values in kg/m3^3.

t

a numeric vector giving the temperature values in K.

lambda

a numeric vector giving the wavelenth values in μ\mum.

Details

For calculating the properties as function of pressure, the function iapws95() should be employed.

Value

A numeric vector.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R8-97, Release on the Static Dielectric Constant of Ordinary Water Substance for Temperatures from 238 K to 873 K and Pressures up to 1000 MPa.

International Association for the Properties of Water and Steam, IAPWS R9-97, Release on the Refractive Index of Ordinary Water Substance as Function of Wavelength, Temperature and Pressure.

International Association for the Properties of Water and Steam, IAPWS R11-07(2019), Revised Release on the Ionization Constant of H2O.

Examples

# Dielectric constant Tab. 4
t <- c(240, 300, 300, 300, 650, 650, 650, 870, 870, 870)
rho <- iapws95("rho", t = t,
               p = c(0.1013125, 0.1013125, 10, 1000,
                     10, 100, 500, 10, 100, 500),
               state = c(rep("liquid", 4),
                         "gas", rep("supercritical", 2),
                         "gas", rep("supercritical", 2)))
tab <- iapws_epsilon(rho, t)
print(tab, digits = 6)


# Refractive index Tab. 3
d <- expand.grid(t = c(0, 100, 200, 500) + 273.15,
		 p = c(0.1, 1, 10, 100),
                 lambda = c(0.2265, 0.589, 1.01398))
d$state <- iapws95_state(p = d$p, t = d$t)
d$state[d$state == "solid"] <- "liquid"
d$rho <- drop(iapws95("rho", t = d$t, p = d$p, state = d$state))
tab <- iapws_n(d$rho, d$t, d$lambda)
dim(tab) <- c(4, 4, 3)
print(tab, digits = 8)

# Ionization constant Tab. 3
tab <- iapws_pk(rho = c(1, 0.07, 0.7, 0.2, 1.2) * 1e3,
                t = c(300, 600, 600, 800, 800))
print(tab, digits = 7)

IAPWS Formulations for Surface Tension

Description

Compute the surface tension of ordinary and heavy water.

Usage

iapws_sigma(t)
heavy17_sigma(t)

Arguments

t

a numeric vector giving the temperature values in K.

Value

A numeric vector giving the values of surface tension in mN/m.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R1-76(2014), Revised Release on Surface Tension of Ordinary Water Substance.

International Association for the Properties of Water and Steam, IAPWS R5-85(1994), IAPWS Release on Surface Tension of Heavy Water Substance.

Examples

print(iapws_sigma(seq(5, 370, by = 5) + 273.15), digits = 2)
print(heavy17_sigma(seq(5, 370, by = 5) + 273.15), digits = 1)

IAPWS-95 Formulation in Single Phase Regions

Description

Compute thermodynamic and transport properties of water and steam using the IAPWS formulation 1995.

Usage

iapws95(what, p, t, rho, h, state = NULL)

Arguments

what

a character vector listing the output properties. See Details for available properties.

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

rho

a numeric vector giving the density values in kg/m3^3.

h

a numeric vector giving the specific enthalpy values in kJ/kg.

state

NULL or a character vector giving the physical state. One of "liquid", "gas" or "supercritical". In case of NULL, the state is determined by the function iapws95_state().

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

  • "eta": the dynamic viscosity in μ\muPa.s.

  • "lambda": the thermal conductivity in mW/K/m.

A valid pair of p, rho, t and h is needed: either (p, t), (rho, t) or (p, h).

Value

A numeric matrix of dimension c(n, length(what)) with n the maximum length of either rho, p, t, h or state.

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R6-95(2018), Revised Release on the IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use.

International Association for the Properties of Water and Steam, IAPWS R12-08(2008), Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance.

International Association for the Properties of Water and Steam, IAPWS R15-11(2011), Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance.

Examples

# IAPWS-95 Tab. 7
tab <- iapws95(c("p", "cv", "w", "s"),
               t = c(300, 300, 300,
                     500, 500, 500, 500,
                     647,
                     900, 900, 900),
               rho = c(0.9965560e3, 0.1005308e4, 0.1188202e4,
                       0.4350000e0, 0.4532000e1, 0.8380250e3, 0.1084564e4,
                       0.3580000e3,
                       0.2410000e0, 0.5261500e2, 0.8707690e3))
format(tab, scientific = TRUE, digits = 9)


# Viscosity Tab. 4
tab <- iapws95("eta",
               t = c(298.15, 298.15, 373.15,
                     433.15, 433.15,
                     873.15, 873.15, 873.15,
                     1173.15, 1173.15, 1173.15),
               rho = c(998, 1200, 1000,
                       1, 1000,
                       1, 100, 600,
                       1, 100, 400))
format(tab, digits = 8)


# Viscosity Tab. 5
tab <- iapws95("eta", t = 647.35, rho = c(122, 222, 272, 322, 372, 422))
format(tab, digits = 8)


# Thermal conductivity Tab. 4
tab <- iapws95("lambda", t = c(298.15, 298.15, 298.15, 873.15),
               rho = c(0, 998, 1200, 0))
format(tab, digits = 9)


# Thermal conductivity Tab. 5
tab <- iapws95("lambda", t = 647.35,
               rho = c(1, 122, 222, 272, 322, 372, 422, 750))
format(tab, digits = 9)

IAPWS-95 Formulation in the Saturation Region

Description

Compute thermodynamic and transport properties of water and steam along the saturated line according to the IAPWS formulation 1995.

Usage

iapws95_sat(what, p, t)

Arguments

what

a character vector listing the output properties. See Details for available properties.

t

a numeric vector giving the temperature values in K.

p

a numeric vector giving the pressure values in MPa.

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

  • "eta": the dynamic viscosity in μ\muPa.s.

  • "lambda": the thermal conductivity in mW/K/m.

Only one of t or p is needed. If both arguments are given, p is ignored.

Value

A numeric array of dimension c(n, length(what), 2L) with n the length of either p or t. The last dimension indicate the physical state ("liquid" or "gas").

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R6-95(2018), Revised Release on the IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use.

Examples

# IAPWS-95 Tab. 8
tab <- iapws95_sat(c("p", "rho", "h", "s"), t = c(275, 450, 625))
format(tab, scientific = TRUE, digits = 9)

IAPWS-95 Physical States

Description

Identify the physical state of water according to the IAPWS formulation 1995.

Usage

iapws95_state(p, t, rho)

Arguments

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

rho

a numeric vector giving the density values in kg/m3^3.

Details

A valid pair of p, rho, t is needed: either (p, t) or (rho, t).

Value

A character vector giving the physical state. One of "solid", "liquid", "gas", "supercritical", "saturated" or "undef".

Author(s)

Jonathan Debove

Examples

iapws95_state(p = c(.1, .1, 23), t = c(293.15, 373.15, 650))
iapws95_state(rho = c(1000, .1, 500, 500),
              t = c(293.15, 373.15, 650, 373.15))

Equation of State 2006 for Ice Ih

Description

Compute thermodynamic properties of ice Ih using the Equation of State 2006.

Usage

ice06(what, p, t)

Arguments

what

a character vector listing the output properties. See Details for available properties.

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

Value

A numeric matrix of dimension c(n, length(what)) with n the maximum length of either p or t.

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R10-06(2009), Revised Release on the Equation of State 2006 for H2O Ice Ih.

Examples

tab <- ice06(c("g", "h", "f", "u", "s", "cp", "rho", "alpha", "beta", "kappat"),
              p = c(611.657e-6, .101325, 100), t = c(273.16, 273.152519, 100))
format(tab, scientific = TRUE, digits = 11)

IAPWS-IF97 Equations for Regions 1, 2, 3 and 5

Description

Compute thermodynamic and transport properties of water and steam using the IAPWS industrial formulation 1997.

Usage

if97(what, p, t, h, state = NULL)

Arguments

what

a character vector listing the output properties. See Details for available properties.

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

h

a numeric vector giving the specific enthalpy values in kJ/kg.

state

NULL or a character vector giving the physical state. One of "liquid", "gas" or "supercritical". In case of NULL, the state is determined by the function if97_state().

Details

The available properties for what are:

  • "f": the specific free energy in kJ/kg.

  • "g": the specific Gibbs enthalpy in kJ/kg.

  • "u": the specific internal energy in kJ/kg.

  • "h": the specific enthalpy in kJ/kg.

  • "s": the specific entropy in kJ/K/kg.

  • "t": the temperature in K.

  • "p": the pressure in MPa.

  • "v": the specific volume in m3^3/kg.

  • "rho": the mass density in kg/m3^3.

  • "cv": the specific isochoric heat capacity in kJ/K/kg.

  • "cp": the specific isobaric heat capacity in kJ/K/kg.

  • "alpha": the expansion coefficient in 1/K

  • "beta": the pressure coefficient in MPa/K.

  • "kappat": the isothermal compressibility in 1/MPa.

  • "w": the speed of sound in m/s.

  • "eta": the dynamic viscosity in μ\muPa.s.

  • "lambda": the thermal conductivity in mW/K/m.

A valid pair of p, t and h is needed: either (p, t) or (p, h).

Value

A numeric matrix of dimension c(n, length(what)) with n the maximum length of either p, t, h or state.

Note

Computing several properties in a single call may be more efficient than separately because most of the computation time is shared.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R7-97(2012), Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

International Association for the Properties of Water and Steam, IAPWS R12-08(2008), Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance.

International Association for the Properties of Water and Steam, IAPWS R15-11(2011), Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance.

Examples

what <- c("v", "h", "u", "s", "cp", "w")

# Region 1 Tab. 5
tab5 <- if97(what, t = c(300, 300, 500), p = c(3, 80, 3))
format(tab5, scientific = TRUE, digits = 9)

# Region 2 Tab. 15
tab15 <- if97(what, t = c(300, 700, 700), p = c(3.5e-3, 3.5e-3, 30))
format(tab15, scientific = TRUE, digits = 9)

# Region 2 metastable Tab. 18
tab18 <- if97(what, t = c(450, 440, 450), p = c(1, 1, 1.5), state = "gas")
format(tab18, scientific = TRUE, digits = 9)

# Region 3 Tab. 33
tab33 <- if97(what, t = c(650, 650, 750),
              p = c(0.255837018e2, 0.222930643e2, 0.783095639e2))
format(tab33, scientific = TRUE, digits = 9)

# Region 5 Tab. 42
tab42 <- if97(what, t = c(1500, 1500, 2000), p = c(0.5, 30, 30))
format(tab42, scientific = TRUE, digits = 9)



# Viscosity and thermal conductivity
what <- c("lambda", "eta")

# Region 1 Tab. 7
tab7 <- if97(what, p = c(20, 50), t = c(620, 620))
format(tab7, scientific = TRUE, digits = 9)

# Region 2 Tab. 8
tab8 <- if97(what, p = c(0.3, 50), t = c(650, 800))
format(tab8, scientific = TRUE, digits = 9)

## Region 3 Tab. 9
#tab9 <- if97_rhot(c("lambda", "rho", "cp", "cv", "eta"),
#      rho = c(0.3, 50), t = c(222, 322)),
#format(tab9, scientific = TRUE, digits = 9)

IAPWS-IF97 Equations in Region 4

Description

Compute the pressure and the temperature along the saturated line according to the IAPWS industrial formulation 1997.

Usage

if97_psat(t)
if97_tsat(p)

Arguments

t

a numeric vector giving the temperature values in K.

p

a numeric vector giving the pressure values in MPa.

Value

A numeric vector containing the saturation-pressure (MPa) or the saturation-temperature (K). Return NA for inputs outside of the range of validity.

Author(s)

Jonathan Debove

References

International Association for the Properties of Water and Steam, IAPWS R7-97(2012), Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

Examples

# Region 4
format(if97_psat(t = c(300, 500, 600)), scientific = TRUE, digits = 9)
format(if97_tsat(p = c(0.1, 1.0, 10.0)), scientific = TRUE, digits = 9)

IAPWS-IF97 Physical States

Description

Identify the physical state of water according to the IAPWS industrial formulation 1997.

Usage

if97_state(p, t)

Arguments

p

a numeric vector giving the pressure values in MPa.

t

a numeric vector giving the temperature values in K.

Value

A character vector giving the physical state. One of "solid", "liquid", "gas", "supercritical", "saturated" or "undef".

Author(s)

Jonathan Debove

Examples

if97_state(p = c(.1, .1, 23), t = c(293.15, 373.15, 650))