Welcome to iapws’s documentation!

Build Status Windows Build Status coveralls.io analysis codecov.io analysis Code Health Documentation Status

Introduction

Python implementation of standard from IAPWS (http://www.iapws.org/release.html).

Dependences

  • python 2x, 3x, compatible with both versions

  • Numpy-scipy: library with mathematic and scientific tools

Installation

In debian you can find in official repositories in jessie, testing and sid. In ubuntu it’s in official repositories from ubuntu saucy (13.10). In other system you can install using pip:

pip install iapws

or directly cloning the github repository:

git clone https://github.com/jjgomera/iapws.git

and adding the folder to a python path.

Features

This module implements almost the full set of standards:

Releases:

  • R1-76(2014): Revised Release on the Surface Tension of Ordinary Water Substance, iapws._iapws._Tension()

  • R2-83(1992): Release on the Values of Temperature, Pressure and Density of Ordinary and Heavy Water Substances at their Respective Critical Points, iapws._iapws()

  • R5-85(1994): Release on Surface Tension of Heavy Water Substance, iapws._iapws._D2O_Tension()

  • R6-95(2018): Revised Release on the IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use, iapws.iapws95.IAPWS95()

  • R7-97(2012): Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, iapws.iapws97()

  • 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, iapws._iapws._Dielectric()

  • R9-97: Release on the Refractive Index of Ordinary Water Substance as a Function of Wavelength, Temperature and Pressure, iapws._iapws._Refractive()

  • R10-06(2009): Revised Release on the Equation of State 2006 for H2O Ice Ih, iapws._iapws._Ice()

  • R11-24(2024): Release on the Ionization Constant of H2O, iapws._iapws._Kw()

  • R12-08: Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance, iapws._iapws._Viscosity()

  • R13-08: Release on the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, iapws.iapws08()

  • R14-08(2011): Revised Release on the Pressure along the Melting and Sublimation Curves of Ordinary Water Substance, iapws._iapws._Melting_Pressure(), iapws._iapws._Sublimation_Pressure()

  • R15-11: Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance, iapws._iapws._ThCond()

  • R16-17(2018): Release on the IAPWS Formulation 2017 for the Thermodynamic Properties of Heavy Water, iapws.iapws95.D2O()

  • R17-20: Release on the IAPWS Formulation 2020 for the Viscosity of Heavy Water, iapws._iapws._D2O_Viscosity()

  • R18-21: Release on the IAPWS Formulation 2021 for the Thermal Conductivity of Heavy Water, iapws._iapws._D2O_ThCond()

Supplementary Releases:

Guidelines:

  • G1-90: Electrolytic Conductivity (Specific Conductance) of Liquid and Dense Supercritical Water from 0°C to 800°C and Pressures up to 1000 MPa, iapws._iapws._Conductivity()

  • G2-90(1994): Solubility of Sodium Sulfate in Aqueous Mixtures of Sodium Chloride and Sulfuric Acid from Water to Concentrated Solutions, from 250 °C to 350 °C, iapws.iapws08._solNa2SO4()

  • G3-00(2012): Revised Guideline on the Critical Locus of Aqueous Solutions of Sodium Chloride, iapws.iapws08._critNaCl()

  • G4-01: Guideline on the IAPWS Formulation 2001 for the Thermodynamic Properties of Ammonia-Water Mixtures, iapws.ammonia()

  • G5-01(2016): Guideline on the Use of Fundamental Physical Constants and Basic Constants of Water, iapws._iapws()

  • G6-03: Guideline on the Tabular Taylor Series Expansion (TTSE) Method for Calculation of Thermodynamic Properties of Water and Steam Applied to IAPWS-95 as an Example (Not implemented)

  • G7-04: Guideline on the Henry’s Constant and Vapor-Liquid Distribution Constant for Gases in H2O and D2O at High Temperatures, iapws._iapws._Henry(), iapws._iapws._Kvalue()

  • G8-10: Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, iapws.humidAir.HumidAir()

  • G9-12: Guideline on a Low-Temperature Extension of the IAPWS-95 Formulation for Water Vapor, iapws.iapws95.IAPWS95._phiex()

  • G10-15: Guideline on the Thermal Conductivity of Seawater, iapws.iapws08._ThCond_SeaWater()

  • G11-15: Guideline on a Virial Equation for the Fugacity of H2O in Humid Air, iapws.humidAir._virial()

  • G12-15: Guideline on Thermodynamic Properties of Supercooled Water, iapws._iapws._Supercooled()

  • G13-15: Guideline on the Fast Calculation of Steam and Water Properties with the Spline-Based Table Look-Up Method (SBTL) (Not implemented)

  • G14-19: Guideline on the Surface Tension of Seawater, iapws.iapws08._Tension_SeaWater()

Advisory Notes:

  • AN1-03: Uncertainties in Enthalpy for the IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use (IAPWS-95) and the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam (IAPWS-IF97)

  • AN2-04(2013): Role of Various IAPWS Documents Concerning the Thermodynamic Properties of Ordinary Water Substance

  • AN3-07(2018): Thermodynamic Derivatives from IAPWS Formulations, iapws._utils.deriv_G(), iapws._utils.deriv_H()

  • AN4-09: Roles of IAPWS and CIPM Standards for the Density of Water

  • AN5-13(2016): Industrial Calculation of the Thermodynamic Properties of Seawater, iapws.iapws08.Seawater._waterIF97(), iapws.iapws08._Tb(), iapws.iapws08._Tf(), iapws.iapws08._Triple(), iapws.iapws08._OsmoticPressure()

  • AN6-16: Relationship between Various IAPWS Documents and the International Thermodynamic Equation of Seawater - 2010 (TEOS-10)

Documentation

You can navigate the full documentation of package:

For a rapid usage demostration, see this examples

IAPWS-IF97 (see full documentation)

from iapws import IAPWS97
sat_steam = IAPWS97(P=1,x=1)                #saturated steam with known P
sat_liquid = IAPWS97(T=370, x=0)            #saturated liquid with known T
steam = IAPWS97(P=2.5, T=500)               #steam with known P and T
print(sat_steam.h, sat_liquid.h, steam.h) #calculated enthalpies

IAPWS-95 (see full documentation)

from iapws import IAPWS95
sat_steam = IAPWS95(P=1,x=1)                #saturated steam with known P
sat_liquid = IAPWS95(T=370, x=0)            #saturated liquid with known T
steam = IAPWS95(P=2.5, T=500)               #steam with known P and T
print(sat_steam.h, sat_liquid.h, steam.h) #calculated enthalpies

For calculation of multiple states is possible use multiprocessing to speed up calculation, 6x in my laptop. Method valid too for D2O

from iapws import IAPWS95
from numpy import arange
from time import time

x = arange(0, 1.01, 0.01)

def fi(x):
    return IAPWS95(P=20.8, x=x)

start = time()
for xi in x:
    fi(xi)
print(f'Without multiprocessing: {time() - start}')

start = time()
states = IAPWS95.from_list("P", 20.8, "x", x)
print(f'With multiprocessing: {time() - start}')

IAPWS-17 for Heavy water (see full documentation)

from iapws import D2O
sat_liquid = D2O(T=370, x=0)            #saturated liquid with known T
print(sat_liquid.h)                   #calculated enthalpy

IAPWS-06 for Ice Ih (see full documentation)

from iapws import _Ice
ice = _Ice(273.15, 0.101325)            #Ice at normal melting point
print(ice["rho"])                     #Calculated density

IAPWS-08 for seawater (see full documentation)

from iapws import SeaWater
state = SeaWater(T=300, P=0.101325, S=0.001)    #Seawater with 0.1% Salinity
print(state.cp)                                 # Get cp

TODO

  • TODO: Improve convergence in two phase region for IAPWS95 and D2O class

  • TODO: Implement SBTL method for fast calculation

  • TODO: Implement TTSE method for fast calculation

Ammonia-water mixture:

  • TODO: Add equilibrium routine

I’ve tried to test all code and use all values for computer verification the standards give, but anyway the code can have hidden problem. For any suggestions, comments, bugs … you can usage the github issue section, or contact directly with me at email.

Indices and tables