IAPWS

class thermochem.iapws.Water[source]

Taken from

The International Association for the Properties of Water and Steam. Lucerne, Switzerland. August 2007. Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

Functions implemented:

Saturation line h(p,T) region1, region2 and no warnings yet

T_ph(p, h)[source]

Returns the temperature (K) given the pressure (MPa) and specific enthalpy (kJ/kg). Only region 2a implemented (p<4MPa) (Reimplement).

>>> w = Water()
>>> w.T_ph(3,500)[0]
391.798...
>>> w.T_ph(3,500)[1]
4.1313...e+21
Tsat(p)[source]

Returns the saturation temperature of water at a given pressure.

Remember that pressure must be between 0.000611213MPa (triple point) and 22.064MPa (critical point)

Temperatures in K, pressures in MPa.

>>> w = Water()
>>> w.Tsat(100000)
372.7559186113...
>>> w.Tsat(1200000)
461.1146416213...
>>> w.Tsat(100)
Traceback (most recent call last):
  File "/usr/lib/python2.5/doctest.py", line 1228, in __run
    compileflags, 1) in test.globs
  File "<doctest __main__.Water.Tsat[3]>", line 1, in <module>
    w.Tsat(100)
  File "iapws.py", line 193, in Tsat
    raise ValueError('No saturation temperature for this pressure')
ValueError: No saturation temperature for this pressure
>>> w.Tsat(101325)
373.12430000048056
h(p, T)[source]

Returns specific enthalpy (J/kg) for a given pressure (Pa) and Temperature (K).

>>> w = Water()
>>> round(w.h(3000000,300), 6)
115.331273
>>> w.h(3500,300)
2549.9114508400203

There are also error codes

Results checked against the reference.

psat(T)[source]

Returns the saturation pressure of water at a given temperature.

Remember that temperature must be between 273.15K (triple point) and 647.096K (critical point)

Temperatures in K, Pressures in Pa.

>>> w = Water()
>>> w.psat(300)
3536.5894130130105
>>> w.psat(130)
Traceback (most recent call last):
  File "/usr/lib/python2.5/doctest.py", line 1228, in __run
    compileflags, 1) in test.globs
  File "<doctest __main__.Water.psat[2]>", line 1, in <module>
    w.psat(130)
  File "iapws.py", line 153, in psat
    'No saturation pressure for this temperature')
ValueError: No saturation pressure for this temperature
>>> w.psat(700)
Traceback (most recent call last):
  File "/usr/lib/python2.5/doctest.py", line 1228, in __run
    compileflags, 1) in test.globs
  File "<doctest __main__.Water.psat[3]>", line 1, in <module>
     w.psat(700)
  File "iapws.py", line 146, in psat
    'No saturation pressure for this temperature')
ValueError: No saturation pressure for this temperature