Learn R Programming

CHNOSZ (version 0.9-7)

water: Properties of Water

Description

Calculate thermodynamic and electrostatic properties of water.

Usage

water(property = NULL, T = thermo$opt$Tr, P = "Psat")
  water.SUPCRT92(property, T = 298.15, P = 1, isat = 0)
  water.IAPWS95(property, T = 298.15, rho = 1000)
  water.WP02(property, T = 298.15)
  water.AW90(T = 298.15, rho = 1000, P = 0.1)

Arguments

property
character, name(s) of property(s) to calculate.
T
numeric, temperature (K).
P
character or numeric, Psat; or pressure (bar for water, water.SUPCRT92; MPa for water.AW90, water.IAPWS95, water.WP02).
isat
numeric, if $1$, calculate values of Psat
rho
numeric, density (kg m$^{-3}$).

Value

  • For water, water.SUPCRT92 and water.IAPWS, a dataframe the number of rows of which corresponds to the number of input temperature, pressure and/or density values. water.AW90 returns a numeric vector with length corresponding to the number of temperature values.

Details

These functions compute the thermodynamic (Gibbs energy and it derivatives) and electrostatic (dielectric constant and its derivatives) properties of liquid or supercritical $\mathrm{H_2O}$ using equations of state taken from the literature. The wrapper function water responds to two computational options. The default option (for thermo$opt$water equal to SUPCRT) indicates to retrieve thermodynamic and electrostatic properties as a function of temperature and pressure using a FORTRAN subroutine taken from the SUPCRT92 software package (Johnson et al., 1992). If thermo$opt$water is set to IAPWS, the thermodynamic properties are calculated using an implementation in Rcode (hence relatively slow) of the IAPWS-95 formulation (Wagner and Pruss, 2002) and electrostatic properties are calculated using the equations of Archer and Wang, 1990.

The allowed propertys for water are one or more of those given below, depending on the computational option (availability is shown by an asterisk). The names of properties in the arguments are not case sensitive, and some of the properties that can actually be calculated using the equations of state are not implemented here.

lllll{ Property Description Units IAPWS SUPCRT A Helmholtz energy cal mol$^{-1}$ * * G Gibbs energy cal mol$^{-1}$ * * S Entropy cal K$^{-1}$ mol$^{-1}$ * * U Internal energy cal mol$^{-1}$ * * H Enthalpy cal mol$^{-1}$ * * Cv Isochoric heat capacity cal K$^{-1}$ mol$^{-1}$ * * Cp Isobaric heat capacity cal K$^{-1}$ mol$^{-1}$ * * w (Speed) Speed of sound cm s$^{-1}$ NA * E Isobaric expansivity cm$^3$ K$^{-1}$ NA * kT Isothermal compressibility cm$^3$ bar$^{-1}$ NA * alpha Coefficient of isobaric expansivity K$^{-1}$ NA * beta Coefficient of isothermal compressibility bar$^{-1}$ NA * epsilon (diel) Dielectric constant dimensionless NA * visc Dynamic viscosity g cm$^{-1}$ s$^{-1}$ NA * tcond Thermal conductivity cal cm$^{-1}$ s$^{-1}$ K$^{-1}$ NA * tdiff Thermal diffusivity cm$^2$ s$^{-1}$ NA * Prndtl Prandtl number dimensionless NA * visck Kinematic viscosity cm$^2$ s$^{-1}$ NA * albe Isochoric expansivity bar K$^{-1}$ NA * -compressibility Z (ZBorn) Z Born function dimensionless NA * Y (YBorn) Y Born function K$^{-1}$ * * Q (QBorn) Q Born function bar$^{-1}$ * * daldT Isobaric temperature derivative K$^{-2}$ NA * of expansibility X (XBorn) X Born function K$^{-2}$ * * N N Born function bar$^{-2}$ * NA UBorn U Born function bar$^{-1}$ K$^{-1}$ * NA V Volume cm$^3$ mol$^{-1}$ * * rho Density kg cm$^3$ * * Psat Saturation vapor pressure bar * * P Pressure bar * NA de.dT Temperature derivative K$^{-1}$ * NA of dielectric constant de.dP Pressure derivative bar$^{-1}$ * NA of dielectric constant }

UBorn refers to the $U$ Born function, U to internal energy. The coefficients of isobaric expansivity and of isothermal compressibility are defined as $(1/V)(dV/dT)_P$ and $-(1/V)(dV/dP)_T$ respectively. All of the properties are calculated as a function of temperature and pressure except Psat f(T) (values supplied in the argument P are ignored) and P f(T,rho). Except for those of rho, the units used are as in Johnson and Norton, 1991. Names of properties that are used in water.SUPCRT92 (but not in water) are shown in parentheses.

water.SUPCRT92 interfaces to the FORTRAN subroutine taken from the SUPCRT92 package (H2O92D.F) for calculating properties of water. These calculations are based on data and equations of Levelt-Sengers et al., 1983, Haar et al., 1984, and Johnson and Norton, 1991, among others (see Johnson et al., 1992). If isat is equal to $1$ (or TRUE), the values of P are ignored and values of Psat are returned. Psat refers to one bar below 100 $^{\circ}$C, otherwise to the vapor-liquid saturation pressure at temperatures below the critical point (Psat is not available at temperatures above the critical point). water.SUPCRT92 function provides a limited interface to the FORTRAN subroutine; some functions provided there are not made available here (e.g., using variable density instead of pressure, or calculating the properties of steam). The properties of steam in CHNOSZ, as in SUPCRT92, are calculated using general equations for crystalline, gaseous and liquid species (cgl). The IAPWS-95 formulation also has provisions for computing the properties of steam, but these are currently not used by CHNOSZ.

water.IAPWS95 provides an implementation of the IAPWS-95 formulation for properties (including pressure) calculated as a function of temperature and density. To compute the thermodynamic and electrostatic properties of water as a function of temperature and pressure using water.IAPWS95, water applies a root-finding function (uniroot) to determine the corresponding values of density. Electrostatic properties in this case are derived from values of the static dielectric constant (epsilon) calculated using equations given by Archer and Wang, 1990 and coded in water.AW90. Note that the water.AW90 computes the static dielectric constant at given temperatures and pressures, so water contains routines for calculating its derivatives with respect to temperature and pressure. A keyword, test, may be given as property to water.IAPWS95, which causes the printing of two tables, one representing the ideal-gas and residual contributions to the Helmholtz free energy (Table 6.6 of Wagner and Pruss, 2002), and a second with a selection of calculated properties for the liquid and vapor at the triple and boiling points.

The water.IAPWS95 function returns values of thermodynamic properties in specific units (per gram) which are converted to molar properties by water. The IAPWS-95 formulation follows the triple point convention used in engineering (values of internal energy and entropy are taken to be zero at the triple point). For compatibility with geochemical modeling conventions, the values of Gibbs energy, enthalpy and entropy output by water.IAPWS95 are converted by water to the triple point reference state adopted in SUPCRT92 (Johnson and Norton, 1991; Helgeson and Kirkham, 1974). Auxiliary equations to the IAPWS-95 formulation (Wagner and Pruss, 2002) are provided in water.WP02; 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}$).

The stated temperature limits of validity of calculations in water.SUPCRT92 are from the greater of 0 $^{\circ}$C or the melting temperature at pressure to 2250 $^{\circ}$C (Johnson et al., 1992); for water.IAPWS the upper temperature limit of validity is 1000 $^{\circ}$C, but extrapolation to much higher temperatures is possible (Wagner and Pruss, 2002). Valid pressures are from the greater of zero bar or the melting pressure at temperature to 30000 bar (water.SUPCRT92) or 10000 bar (water.IAPWS95; again, with the provision for extrapolation to more extreme conditions). The present functions do not check these limits and will attempt calculations for any range of input parameters, but may return NA for properties that fail to be calculated at given temperatures and pressures and/or produce warnings or even errors when problems are encountered.

References

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

Haar, L., Gallagher, J. S. and Kell, G. S. (1984) NBS/NRC Steam Tables. Hemisphere, Washington, D. C., 320 p. http://www.worldcat.org/oclc/301304139

Helgeson, H. C. and Kirkham, D. H. (1974) Theoretical prediction of the thermodynamic behavior of aqueous electrolytes at high pressures and temperatures. I. Summary of the thermodynamic/electrostatic properties of the solvent. Am. J. Sci. 274, 1089--1098. http://www.ajsonline.org/cgi/content/abstract/274/10/1089

Johnson, J. W. and Norton, D. (1991) Critical phenomena in hydrothermal systems: state, thermodynamic, electrostatic, and transport properties of H$_2$O in the critical region. Am. J. Sci. 291, 541--648. http://www.ajsonline.org/cgi/content/abstract/291/6/541

Johnson, J. W., Oelkers, E. H. and Helgeson, H. C. (1992) SUPCRT92: A software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000$^{\circ}$C. Comp. Geosci. 18, 899--947. http://dx.doi.org/10.1016/0098-3004(92)90029-Q

Levelt-Sengers, J. M. H., Kamgarparsi, B., Balfour, F. W. and Sengers, J. V. (1983) Thermodynamic properties of steam in the critical region. J. Phys. Chem. Ref. Data 12, 1--28. http://www.nist.gov/srd/PDFfiles/jpcrd214.pdf

Wagner, W. and Pruss, 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

See Also

uniroot is the root finder used in water to back out values of the density (rho) from those of T and P when the IAPWS option is set in thermo$opt$water. Equations of state for species other than water are coded in hkf and cgl.

Examples

Run this code
data(thermo)
  ## set temperature, density
  T <- 500; rho <- 838.0235
  # calculate pressure 				
  P <- as.numeric(water.IAPWS95('P',T=T,rho=rho))
  # output table of test values
  water.IAPWS95('test')	
  # calculate dielectric constant 	
  water.AW90(T=T,rho=rho,P=P)	
  # find water density for this T, P		
  water('rho',T=T,P=convert(P,'bar'))
  
  ## density along saturation curve
  T <- seq(273.15,623.15,25)
  water.WP02(T=T)  # liquid from WP02
  water.WP02('rho.vapor',T)  # steam from WP02	
  water('rho',T=T,P='Psat')  # liquid from SUPCRT92
  # values of the density, Psat, Gibbs energy	
  water(c('rho','psat','G'),T=T,P='Psat') 
  # derivatives of the dielectric constant (Born functions)
  water(c('Q','Y','X','U'),T=T)
  # now at constant pressure
  water(c('Q','Y','X','U'),T=T,P=2000)
## NaCl dissocation logK f(T,P)
  # after Shock et al., 1992, Fig. 1
  # make note of the warning in the subcrt help page
  species <- c('NaCl','Na+','Cl-')
  coeffs <- c(-1,1,1)
  # start a new plot with the experimental data
  thermo.plot.new(xlim=c(0,1000),ylim=c(-5.5,1),
    xlab=axis.label("T"),ylab=axis.label("logK"))
  expt <- read.csv(system.file("extdata/cpetc/SOJSH.csv",package="CHNOSZ"))
  points(expt$T,expt$logK,pch=expt$pch)
  T <- list(seq(0,370,25),seq(265,465,25),
    seq(285,760,25),seq(395,920,25))
  for(i in 5:9) T[[i]] <- seq(400,1000,25)
  P <- list("Psat",500,1000,1500,2000,2500,3000,3500,4000)
  for(i in 1:length(T)) {
    s <- subcrt(species,coeffs,T=T[[i]],P=P[[i]])
    lines(s$out$T,s$out$logK)
  }
  legend("bottomleft",pch=unique(expt$pch),
    legend=unique(expt$source))
  title(main=paste('NaCl(aq) = Na+ + Cl-\n',
    'Psat and 500-4000 bar, after Shock et al., 1992'))

  ## comparing the computational options
  prop <- c('A','G','S','U','H','Cv','Cp','w','epsilon',
    'Y','Q','X','rho','Psat')
  thermo$opt$water <- 'SUPCRT'
  print(water(prop,T=convert(c(25,100,200,300),'K')))
  thermo$opt$water <- 'IAPWS'
  print(water(c(prop,'N','UBorn'),T=convert(c(25,100,200,300),'K')))
  # fixme: things seem to be working except speed of
  # sound in our IAPWS calculations

  # calculating Q Born function
  # after Table 22 of Johnson and Norton, 1991
  thermo$opt$water <- 'SUPCRT'
  T <- rep(c(375,400,425,450,475),each=5)
  P <- rep(c(250,300,350,400,450),5)
  w <- water('Q',T=convert(T,'K'),P=P)
  # the rest is to make a readable table
  w <- as.data.frame(matrix(w[[1]],nrow=5))
  colnames(w) <- T[1:5*5]
  rownames(w) <- P[1:5]
  print(w)

Run the code above in your browser using DataLab