Python#

Python wrapper of the (Modern Fortran) iapws library.

Kw(T: ndarray, rhow: ndarray)#

Compute the ionization constant of water Kw. Validity range 273.13 K <= T <= 1273.15 K and 0 <= p <= 1000 MPa.

Parameters:
T: int, float or 1d-array.

Temperature in K.

rhow: int, float or 1d-array.

Mass density in g.cm-3.

Returns:
k: float or 1d-array

Ionization constant.

Tsat(ps)#

Compute the saturation temperature at pressure ps. Validity range 611.213 Pa <= ps <= 22.064 MPa.

Parameters:
ps: int, float or 1d-array.

Saturation pressure in MPa.

Returns:
Ts: float or 1d-array

Saturation temperatur in K. Is NaN if Ts is out of range of validity.

gases(heavywater: bool = False) List[str]#

Get the list of available gases.

Parameters:
heavywater: bool, optional.

Flag for indicating if solvent is heavywater (True) or water (False). Default to False.

Returns:
gases: list of str

List of available gases.

gases2(heavywater: bool = False) str#

Get the available gases as a string.

Parameters:
heavywater: bool, optional.

Flag for indicating if solvent is heavywater (True) or water (False). Default to False.

Returns:
gases: str

Available gases as comma separated string.

kd(T: ndarray, gas: str, heavywater: bool = False) ndarray | float#

Get the vapor-liquid constant for gas in H2O or D2O at T. If gas not found returns NaNs.

Parameters:
T: int, float, or 1d-array.

Temperature in K.

gas: str

Gas.

heavywater: bool, optional.

Flag for indicating if solvent is heavywater (True) or water (False). Default to False.

Returns:
kd: float or 1d-array

Adimensional liquid-vapor constant.

kh(T: ndarray, gas: str, heavywater: bool = False) ndarray | float#

Get the Henry constant for gas in H2O or D2O at T. If gas not found returns NaNs.

Parameters:
T: int, float or 1d-array.

Temperature in K.

gas: str

Gas.

heavywater: bool, optional.

Flag for indicating if solvent is heavywater (True) or water (False). Default to False.

Returns:
kh: float or 1d-array

Henry constant in MPa.

ngases(heavywater: bool = False) int#

Get the number of available gases.

Parameters:
heavywater: bool, optional.

Flag for indicating if solvent is heavywater (True) or water (False). Default to False.

Returns:
n: int

Number of available gases in water or heavywater.

psat(Ts)#

Compute the saturation pressure at temperature Ts. Validity range 273.13 K <= Ts <= 647.096 K.

Parameters:
Ts: int, float or 1d-array.

Saturation temperature in K.

Returns:
ps: float or 1d-array

Saturation pressure in MPa. Is NaN if Ts is out of range of validity.

wp(p, T, prop)#

Compute water properties at pressure p in MPa and temperature T in Kelvin. The adequate region is selected according to p and T.

Available properties:
  • v: specific volume in m3/kg

  • u: specific internal energy in kJ/kg

  • s: specific entropy in kJ/kg

  • h: specific enthalpy in kJ/kg/K

  • cp: specific isobaric heat capacity in kJ/kg/K

  • cv: specific isochoric heat capacity in kJ/kg/K

  • w: speed of sound in m/s

Parameters:
p: int, float or 1d-array.

Pressure in MPa.

T: int, float or 1d-array.

Temperature in K.

prop: str
Water property:
  • v: specific volume in m3/kg

  • u: specific internal energy in kJ/kg

  • s: specific entropy in kJ/kg

  • h: specific enthalpy in kJ/kg/K

  • cp: specific isobaric heat capacity in kJ/kg/K

  • cv: specific isochoric heat capacity in kJ/kg/K

  • w: speed of sound in m/s

Returns
——-
res: float or 1d-array

Computed property. Filled with NaN if no adequate region is found.

wph(p, T)#

Get the water phase corresponding to p and T.

Parameters:
p: int, float or 1d-array.

Pressure in MPa.

T: int, float or 1d-array.

Temperature in K.

Returns:
region: str or 1d-array

Phases: l(liquid), v(VAPOR), c(SUPER CRITICAL), s(SATURATION), n(UNKNOWN).

wr(p, T)#

Get the water region corresponding to p and T.

Parameters:
p: int, float or 1d-array.

Pressure in MPa.

T: int, float or 1d-array.

Temperature in K.

Returns:
region: int or 1d-array

Regions 1 to 5 or -1 when not found.