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)
water.WP02('rho.vapor',T)
water('rho',T=T,P='Psat')
# values of the density, Psat, Gibbs energy
water(c('rho','psat','G'),T=T,P='Psat')
# derivatives of the inverse of 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-T
## after Shock et al., 1992, Fig. 1
s <- c('NaCl','Na+','Cl-')
n <- c(-1,1,1)
T <- seq(200,1000,25)
P <- seq(1000,4000,500)
t <- subcrt(s,n,T=T,P=P,grid='P')
plot(t$out$T,t$out$logK,
xlim=c(0,1000),ylim=c(-5.5,1),
xlab=axis.label('T'),ylab='log K')
title(main=paste('NaCl = Na+ + Cl-<n>',
'1000 - 4000 bar, after Shock et al., 1992'))
## comparing the 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)
t <- water('Q',T=convert(T,'K'),P=P)
# the rest to make a readable table
t <- as.data.frame(matrix(t[[1]],nrow=5))
colnames(t) <- T[1:5*5]
rownames(t) <- P[1:5]
print(t)</n>
<references>Archer, D. G. and Wang, P. M., 1990. The dielectric constant of water and Debye-Huckel limiting law slopes. <em>J. Phys. Chem. Ref. Data</em>, 19, 371-411.
Haar, L., Gallagher, J. S. and Kell, G. S., 1984. <em>NBS/NRC Steam Tables</em>. Hemisphere, Washington, D. C., 320 p.
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. <em>Am. J. Sci.</em>, 274, 1089-1098.
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. <em>Am. J. Sci.</em>, 291, 541-648.
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. <em>Comp. Geosci.</em>, 18, 899-947.
Levelt-Sengers, J. M. H., Kamgarparsi, B., Balfour, F. W. and Sengers, J. V., 1983. Thermodynamic properties of steam in the critical region. <em>J. Phys. Chem. Ref. Data</em>, 12, 1-28.
Wagner, W. and Pruss, A., 2002. The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. <em>J. Phys. Chem. Ref. Data</em>, 31, 387-535.</references>
<keyword>misc</keyword>
Run the code above in your browser using DataLab