This Vignette exemplifies the use of some functions of the Package IAPWS95, which calculates water thermodynamic and transport properties as function of different combinations of Temperature, Density, Pressure, Enthalphy and Entropy. The functions presented are used to return single values or generate tables of thermodynamic properties, being useful for scientists and engineers who analyze thermal and hydraulic experimental data or are involved with projects and equipment development, like turbines or nuclear reactors. This Vignette shows too few examples, but each function is documented with examples.
The name IAPWS95 comes from the “IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use”, a formulation developed by “The International Association for the Properties of Water and Steam”, revised in 2014. http://www.iapws.org/
IAPWS-95 formulation is based on the fundamental equation of Helmholtz free energy as a function of temperature and density, f = f(T, ρ). Other thermodynamic properties are obtained by differentiation and algebraic manipulation without the use of any other information. IAPWS-95 defines accurately the thermodynamic properties of the fluid phases of ordinary water substance, with complete thermodynamic consistency among these properties, over a wide range of states (pressures up to 1000 MPa and temperatures from the melting and sublimation temperatures to 1273 K). In this package the lower temperature limit is the triple point temperature, 273.16 K. The definition of properties includes those on the liquid–vapor equilibrium line.
The transport properties programmed were based on different IAPWS Releases: “Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance”; “Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance”; “Revised Release on Surface Tension of Ordinary Water Substance” (2014). The melting pressure was based on the “Revised Release on the Pressure along the Melting and Sublimation Curves of Ordinary Water Substance” (2011). The vapor pressure function introduced in this version was based on the Wagner and Pruß equation (1993).
This package was developed under a research project on water properties conducted at the “Energetic and Nuclear Research Institute”, a Research Institute of the “Brazilian Nuclear Energy Commission” (CNEN), by the author, who is the Representative of Brazil, an Associate Member of IAPWS.
This project was possible with the assistance of Dr. Allan Harvey, of the National Institute of Standards and Technology (NIST) and Chair of the Working Group of “Thermophysical Properties of Water and Steam” of the IAPWS.
After Dr. Benedito Dias Baptista Filho’s passing in 2018, this package will be maintained by Shawn Way.
# Entropy Function of Pressure, with Temperature Constant library(IAPWS95) library(pander) # Initial Pressure <- 10. p1 # Final Pressure <- 100. p2 # Pressure increment <- 10. dp # Temperature <- 450. T capture.output( Tabs <- spTcteTab(p1, p2, dp, T), file='NUL') ::pandoc.table(Tabs)pander
|Temp [K]||p [K]||s [kJ kg-1 K-1]|
# Saturation Properties Function of Temperature library(IAPWS95) library(pander) # Initial Temperature <- 300. T1 # Final Temperature <- 400. T2 # Temperature increment <- 10. dT capture.output( TabT <- satTabvT(T1, T2, dT), file='NUL') ::pandoc.table(TabT)pander
# Dynamic Viscosity [ Pa s ] library(IAPWS95) # Temperature <- 500. T # Density <- 838.025 D ViscTD(T,D)
# Specific Enthalpy [ kJ kg-1 ] hTD(T,D)
# Pressure [ MPa ] pTD(T,D)
# Specific Internal Energy [ kJ kg-1 ] library(IAPWS95) # Temperature <- 500. T # Pressure <- 10.0003858 p uTp(T,p)
# Specific Enthalpy [ kJ kg-1 ] #hTp(T,p)
If the values given to any function is out of validity range,
represent incorrect inputs, or generate convergence problems, an error
message is printed. The errors are defined in the table listed as:
# Error Codes library(IAPWS95) library(pander) capture.output( errorT <- errorCodes, file='NUL') ::pandoc.table(errorT)pander
|-1001||Outside limits of Temperature|
|-1101||Outside limits of Temperature in two phase routine:
|-1028||Outside limits of Temperature in an inner routine|
|-1002||Outside limits of pressure|
|-1212||Outside Pressure-Temperature Range|
|-1003||Outside limits of Density|
|-1103||Density did not converge in two phase routine|
|-1113||Density D < DgTR|
|-1004||Steam Quality did not converge in two phase routines|
|-1005||Outside limits of Entropy|
|-1555||Entropy s > sgTR in a two phase routine|
|-1006||Enthalpy below minimum value|
|-9999||Enthalpy over upper limit by Entropy|
|-1111||Enthalpy under lower limit by Entropy|
|-1011||Temperature did not converge|
|-1013||Density did not converge|
|-3001||Temperature T < 50K (for sublimation pressure)|
|-3002||Temperature T >715K (over temp. limits for melting pressure)|
This package does not have any graphics function yet, but you can make use of any R graphic function or package.
library(IAPWS95) library(ggplot2) # Initial Temperature <- 275. T1 # Final Temperature <- 647. T2 # Temperature increment <- 3. dT capture.output( Tab <- satTabT(T1, T2, dT), file='NUL') <- Tab[,6] x1 <- rev(Tab[,7]) x2 <- append(x1, x2) s <- Tab[,4] y1 <- rev(Tab[,5]) y2 <- append(y1, y2) h # h- Graph plot(s,h, type = "o", pch=20) grid() <- as.data.frame(s) dados $h <- h dados::ggplot(dados, ggplot2::aes(x=s, y=h)) + ggplot2::geom_line()ggplot2