# Install CoolProp if it is missing (e.g., on Google Colab)
try:
import CoolProp
except ImportError:
%pip install -q CoolProp
import numpy as np
import pandas as pd
from CoolProp.CoolProp import PropsSI
pd.set_option('display.float_format', '{:.4f}'.format)
pd.set_option('display.max_columns', 20)Saturated R-32 Properties
Liquid and vapor density, enthalpy, and entropy of saturated R-32 (difluoromethane, CH₂F₂) at selected temperatures, computed using CoolProp.
fluid = 'R32'
temperatures = [253, 273, 283, 293, 308, 318, 328] # K
rows = []
for T in temperatures:
P_sat = PropsSI('P', 'T', T, 'Q', 0, fluid) / 1e5 # bar
rho_L = PropsSI('D', 'T', T, 'Q', 0, fluid) # kg/m³
h_L = PropsSI('H', 'T', T, 'Q', 0, fluid) / 1e3 # kJ/kg
s_L = PropsSI('S', 'T', T, 'Q', 0, fluid) / 1e3 # kJ/(kg·K)
rho_V = PropsSI('D', 'T', T, 'Q', 1, fluid) # kg/m³
h_V = PropsSI('H', 'T', T, 'Q', 1, fluid) / 1e3 # kJ/kg
s_V = PropsSI('S', 'T', T, 'Q', 1, fluid) / 1e3 # kJ/(kg·K)
rows.append({
'T (K)': T,
'P_sat (bar)': P_sat,
'ρ_L (kg/m³)': rho_L,
'h_L (kJ/kg)': h_L,
's_L (kJ/kg·K)': s_L,
'ρ_V (kg/m³)': rho_V,
'h_V (kJ/kg)': h_V,
's_V (kJ/kg·K)': s_V,
})
df = pd.DataFrame(rows).set_index('T (K)')print('Saturated R-32 Properties (CoolProp)')
print('=' * 80)
print(df.to_string())Saturated R-32 Properties (CoolProp)
================================================================================
P_sat (bar) ρ_L (kg/m³) h_L (kJ/kg) s_L (kJ/kg·K) ρ_V (kg/m³) h_V (kJ/kg) s_V (kJ/kg·K)
T (K)
253 4.0346 1121.0274 165.6900 0.8710 11.0963 509.9215 2.2316
273 8.0920 1055.7748 199.7380 0.9991 21.9846 515.2715 2.1549
283 11.0198 1020.2031 217.4720 1.0618 30.0934 516.6472 2.1190
293 14.6845 981.9809 235.8394 1.1243 40.6745 516.9034 2.0836
308 21.8159 917.7454 264.9994 1.2189 63.0679 514.5267 2.0290
318 27.8486 868.0674 285.9805 1.2837 84.4830 510.3765 1.9894
328 35.0803 809.2929 308.9210 1.3521 114.4470 503.0721 1.9440
# Styled display for notebooks
df.style \
.set_caption('Saturated R-32 Properties') \
.format({
'P_sat (bar)': '{:.4f}',
'ρ_L (kg/m³)': '{:.2f}',
'h_L (kJ/kg)': '{:.4f}',
's_L (kJ/kg·K)': '{:.6f}',
'ρ_V (kg/m³)': '{:.4f}',
'h_V (kJ/kg)': '{:.4f}',
's_V (kJ/kg·K)': '{:.6f}',
})| P_sat (bar) | ρ_L (kg/m³) | h_L (kJ/kg) | s_L (kJ/kg·K) | ρ_V (kg/m³) | h_V (kJ/kg) | s_V (kJ/kg·K) | |
|---|---|---|---|---|---|---|---|
| T (K) | |||||||
| 253 | 4.0346 | 1121.03 | 165.6900 | 0.870987 | 11.0963 | 509.9215 | 2.231586 |
| 273 | 8.0920 | 1055.77 | 199.7380 | 0.999054 | 21.9846 | 515.2715 | 2.154855 |
| 283 | 11.0198 | 1020.20 | 217.4720 | 1.061832 | 30.0934 | 516.6472 | 2.118988 |
| 293 | 14.6845 | 981.98 | 235.8394 | 1.124336 | 40.6745 | 516.9034 | 2.083599 |
| 308 | 21.8159 | 917.75 | 264.9994 | 1.218865 | 63.0679 | 514.5267 | 2.029018 |
| 318 | 27.8486 | 868.07 | 285.9805 | 1.283731 | 84.4830 | 510.3765 | 1.989379 |
| 328 | 35.0803 | 809.29 | 308.9210 | 1.352072 | 114.4470 | 503.0721 | 1.943996 |
# Export to CSV (opens directly in Excel)
# utf-8-sig adds a BOM so Excel recognises the encoding on both Mac and Windows
csv_path = 'R32_saturation.csv'
df.to_csv(csv_path, encoding='utf-8-sig')
print(f'Saved: {csv_path}')Saved: R32_saturation.csv