Examples¶
This page serves as a teaser of the functionality of CoolProp. These examples are written in the Python programming language. For more information see:
Sample Props Code¶
To use the PropsSI
function, import it and do some calls, do something like this
# Import the things you need
In [1]: from CoolProp.CoolProp import PropsSI
# Print some information on the currently used version of coolprop
In [2]: import CoolProp; print(CoolProp.__version__, CoolProp.__gitrevision__)
6.6.0 ba21c74fd1c3a4934bbecbf459936983dec424c2
# Density of carbon dioxide at 100 bar and 25C
In [3]: PropsSI('D', 'T', 298.15, 'P', 100e5, 'CO2')
Out[3]: 817.6273812375758
# Saturated vapor enthalpy [J/kg] of R134a at 25C
In [4]: PropsSI('H', 'T', 298.15, 'Q', 1, 'R134a')
Out[4]: 412333.95323186804
All the possible input and output parameters are listed in the High-Level API documentation
To understand more about what is going on under the hood, go to Pure and Pseudo-Pure fluid properties documentation.
Sample HAPropsSI Code¶
To use the HAPropsSI
function, import it and do some calls, do something like this
# import the things you need
In [5]: from CoolProp.HumidAirProp import HAPropsSI
# Enthalpy (J per kg dry air) as a function of temperature, pressure,
# and relative humidity at STP
In [6]: h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5); print(h)
50423.45039107799
# Temperature of saturated air at the previous enthalpy
In [7]: T = HAPropsSI('T','P',101325,'H',h,'R',1.0); print(T)
290.9620924692057
# Temperature of saturated air - order of inputs doesn't matter
In [8]: T = HAPropsSI('T','H',h,'R',1.0,'P',101325); print(T)
290.9620924692057
Or go to the Humid Air Properties documentation.