Back to the blog

Enthalpy calculation with CoolProp

Enthalpy \(h\) is one of the most widely used thermodynamic properties in engineering: it appears in energy balances of heat exchangers, turbines, compressors, boilers, chemical reactions, and power cycles (Rankine, Brayton, refrigeration). Calculating it "by hand" from steam tables or \(c_p(T)\) data is tedious and error-prone — with CoolProp it is a single line.

The general definition:

\[h = u + P\,v\]

where \(u\) is specific internal energy, \(P\) is pressure, and \(v\) is specific volume. Its variation with temperature follows the fundamental relation:

\[dh = c_p(T)\,dT + \left[v - T\left(\frac{\partial v}{\partial T}\right)_P\right]dP\]

For ideal gases the second term vanishes and \(dh = c_p\,dT\); for real fluids (liquid phases or near the critical point) both terms matter. CoolProp integrates these equations against reference equations of state and returns the numerical value directly.

Typical applications:

  • Design of thermodynamic processes (sizing of heat exchangers, coolers, compressors)
  • Analysis of power and refrigeration cycles
  • Energy balances in chemical reactions
import CoolProp.CoolProp as CP

# Define the input variables
T = 298.15     # Temperature [K]
P = 101325     # Pressure [Pa]

# Calculation of the enthalpy of air
H = CP.PropsSI('H', 'T', T, 'P', P, 'Air')

print(f"The enthalpy of air at {T} K and {P} Pa is {H:.4f} J/kg.")

Output:

The enthalpy of air at 298.15 K and 101325 Pa is 424436.0439 J/kg.

Curves \(h(T)\) at \(1\,\text{atm}\) for several common fluids:

Enthalpy vs temperature

Observations from the graph:

  • Water (red) shows the classic vaporization jump near \(373\,\text{K}\): enthalpy spikes due to the latent heat of vaporization (\(\approx 2260\,\text{kJ/kg}\)).
  • Air, \(\text{N}_2\), and \(\text{CO}_2\) increase nearly linearly — none change phase in that range, so \(h \approx c_p \cdot T + \text{const}\).
  • The slope depends on \(c_p\): steeper for CO\(_2\) (polyatomic, more degrees of freedom) than for air or N\(_2\) (diatomic).

Other properties via PropsSI:

  • "D" — density \(\rho\) [kg/m³]
  • "S" — specific entropy \(s\) [J/kg·K]
  • "U" — specific internal energy \(u\) [J/kg]
  • "C" — \(c_p\) [J/kg·K]
  • "V" — dynamic viscosity \(\mu\) [Pa·s]
  • "L" — thermal conductivity \(k\) [W/m·K]

The syntax is always CP.PropsSI(prop, var1, val1, var2, val2, fluid) — two state variables are sufficient (for pure substances in equilibrium) to fix the entire thermodynamic state.

Installation:

pip install coolprop

CoolProp includes NIST reference data for over 120 pure fluids and hundreds of mixtures. See the complete list at coolprop.org/fluid_properties/PurePseudoPure.html.

Back to the blog