matplotlib

Table Of Contents

Previous topic

Downloading CoolProp

Next topic

Example Code for C++

This Page

Examples

The following examples are written in Python to demonstrate some of the functionalities of CoolProp. Similar calling conventions are used in the wrappers for other programming languages, as can be seen in the “other languages” section below:

Sample Props Code

To use the Props function, import it and do some calls, do something like this

#import the things you need
In [1]: from CoolProp.CoolProp import Props

# print the currently used version of coolprop
In [2]: import CoolProp; print(CoolProp.__version__)
4.2.5

#Density of carbon dioxide (R744) at 100 bar and 25C
In [3]: Props('D','T',298.15,'P',10000,'R744')
Out[3]: 817.6273812375756

#Saturated vapor enthalpy [kJ/kg] of R134a at STP
In [4]: Props('H','T',298.15,'Q',1,'R134a')
Out[4]: 412.3339532318681

Or go to the Fluid Properties documentation.

All the possible input and output parameters are listed in the CoolProp.CoolProp.Props() documentation

Sample HAProps Code

To use the HAProps function, import it and do some calls, do something like this

#import the things you need
In [5]: from CoolProp.HumidAirProp import HAProps, HAProps_Aux

#Enthalpy (kJ per kg dry air) as a function of temperature, pressure,
#    and relative humidity at STP
In [6]: h=HAProps('H','T',298.15,'P',101.325,'R',0.5); print h
50.4249283433

#Temperature of saturated air at the previous enthalpy
In [7]: T=HAProps('T','P',101.325,'H',h,'R',1.0); print T
290.962168888

#Temperature of saturated air - order of inputs doesn't matter
In [8]: T=HAProps('T','H',h,'R',1.0,'P',101.325); print T
290.962168888

Or go to the Humid Air Properties documentation.