Utility functions for properties of water and steam.

1 2 3 | ```
WP02.auxiliary(property, T = 298.15)
rho.IAPWS95(T = 298.15, P = 1, state="", trace=0)
water.AW90(T = 298.15, rho = 1000, P = 0.1)
``` |

`property` |
character, property to calculate |

`T` |
numeric, temperature (K) |

`P` |
numeric, pressure (units of bar, except MPa for |

`state` |
character, state or phase of H2O |

`trace` |
integer number |

`rho` |
numeric, density (kg m |

Auxiliary equations to the IAPWS-95 formulation (Wagner and Pruß, 2002) are provided in `WP02.auxiliary`

.
The `property`

for this function can be one of P.sigma (saturation vapor pressure in MPa), dP.sigma.dT (derivative of saturation vapor pressure with respect to temperature), or rho.liquid or rho.vapor (density of liquid or vapor in kg m*^-3*).

`rho.IAPWS95`

implements a root-finding technique (using `uniroot`

) to determine the values of density for the stable phase of H2O at the given temperature and pressure.
The `state`

option is used internally in order to determine the stable phase at conditions close to saturation (0.9999*Psat <= P <= 1.00005*Psat, where Psat is the saturation pressure calculated by `WP02.auxiliary`

).
Alternatively, the user can specify a `state`

of liquid or vapor to force the calculation of density for the corresponding phase, even if it is metastable (e.g. superheated water, supercooled steam; this option has no effect in the supercritical region).
The `state`

is set in calls by `water.IAPWS95`

to the value in `thermo$opt$IAPWS.sat`

(default liquid) so that higher-level functions (`water`

, `subcrt`

) take properties for that state along the saturation curve.
Diagnostic messages are printed if `trace`

is positive (it is also included in the call to `uniroot`

).

`water.AW90`

provides values of the static dielectric constant (`diel`

) calculated using equations given by Archer and Wang, 1990.

Archer, D. G. and Wang, P. M. (1990) The dielectric constant of water and Debye-Hückel limiting law slopes. *J. Phys. Chem. Ref. Data* **19**, 371–411. http://www.nist.gov/data/PDFfiles/jpcrd383.pdf

Wagner, W. and Pruß, A. (2002) The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. *J. Phys. Chem. Ref. Data* **31**, 387–535. http://dx.doi.org/10.1063/1.1461829

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
# calculate density of stable phase at 500 K, 500 bar
rho <- rho.IAPWS95(T=500, P=500)
# calculate pressure (= 50 MPa) at this density
IAPWS95("P", T=500, rho=rho)
# calculate dielectric constant
water.AW90(T=500, rho=rho, P=50)
# density along saturation curve
T <- seq(273.15, 623.15, 25)
WP02.auxiliary(T=T) # liquid from WP02
WP02.auxiliary("rho.vapor", T) # vapor from WP02
# WP02.auxiliary gives a close estimate of saturation pressure...
T <- 445:455
P.sigma <- WP02.auxiliary("P.sigma", T)
# ... but alternates between being just on the liquid or vapor side
# (low rho: steam; high rho: water)
rho.IAPWS95(T, convert(P.sigma, "bar"))
# thermo$opt$IAPWS.sat allows for choosing liquid or vapor or ""
thermo$opt$IAPWS.sat <<- ""
# shows artifactual vapor-liquid transition
water.IAPWS95("V", T, "Psat")
# the calculated Psat, while not exact, should be close enough for most
# geochemical calculations to select liquid or vapor
thermo$opt$water <<- "IAPWS95"
thermo$opt$IAPWS.sat <<- "vapor"
V.vapor <- subcrt("water", T=convert(445:455, "C"))$out[[1]]$V
thermo$opt$IAPWS.sat <<- "liquid" # the default
V.liquid <- subcrt("water", T=convert(445:455, "C"))$out[[1]]$V
stopifnot(all(V.vapor > V.liquid))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.