Thermodynamic data for water and steam¶

thermopy.iapws¶

class thermopy.iapws.Water

Bases: object

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)

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)
(391.79850876242563, 4.1313215739117547e+21)
>>> w.T_ph(3,4000)
(-14923984.403552555, 1010.7757656610391)
>>> w.T_ph(0.001,3000)
(-103213.84623418792, 534.43324138173193)
>>> w.T_ph(3,500)
(391.79850876242563, 4.1313215739117547e+21)
>>> w.T_ph(80,500)
(378.10862587940176, -6.0291236598288914e+28)
>>> w.T_ph(80,1500)
(611.04122940266484, -5.5726211553407323e+22)
```
Tsat(p)

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.75591861133762
>>> w.Tsat(1200000)
461.11464162130039
>>> 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)

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

```>>> w = Water()
>>> w.h(3000000,300)
115.33127302143839
>>> w.h(3500,300)
2549.9114508400203
```

There are also error codes

Results checked against the reference.

psat(T)

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
```
thermopy.iapws.test()