Refrigeration & Heat Pumps | Thermodynamics with Python | Skill-Lync Resources

50% OFF - Ends Soon!

Lesson 9 of 13 25 min

Refrigeration & Heat Pumps

Your refrigerator, air conditioner, and the heat pump warming a modern home all run the same thermodynamic cycle in reverse: they spend work to move heat from a cold space to a warm one. In this lesson we build the vapor-compression cycle from the ground up and analyze it in Python with real refrigerant data.

Moving Heat "Uphill"

Heat flows naturally from hot to cold. A refrigerator forces the opposite — pulling heat $Q_L$ out of a cold reservoir at $T_L$ and rejecting $Q_H$ to a warm reservoir at $T_H$ — and the price is work input $W$:

$$Q_H = Q_L + W$$

Sponsored

April batch closing soon — only 42 seats remaining

Join 3,000+ engineers who got placed at top companies

Reserve Your Seat

We measure performance with the coefficient of performance (COP), which is the useful effect divided by the work spent. The "useful effect" differs for the two machines:

DeviceUseful effectCOP
Refrigerator / ACHeat removed $Q_L$$\text{COP}_R = \dfrac{Q_L}{W}$
Heat pumpHeat delivered $Q_H$$\text{COP}_{HP} = \dfrac{Q_H}{W}$

Because $Q_H = Q_L + W$, the two are always related by:

$$\text{COP}_{HP} = \text{COP}_R + 1$$

Sponsored

175+ hours of industry projects & 12 IIT faculty sessions

Master CATIA, NX, LS-DYNA, HyperMesh and more

View Full Curriculum

Note the COP can (and usually does) exceed 1 — we are moving heat, not creating it.

The Reversed Carnot Cycle

The most efficient cycle operating between two reservoirs is the reversed Carnot cycle. It sets the upper limit on COP:

$$\text{COP}_{R,\text{Carnot}} = \frac{T_L}{T_H - T_L}, \qquad \text{COP}_{HP,\text{Carnot}} = \frac{T_H}{T_H - T_L}$$

Sponsored

Harshal got placed at Fiat Chrysler as Design Engineer

Watch his video testimonial on how the program helped him

See His Journey

with temperatures in kelvin. Two lessons here: (1) the smaller the temperature lift $T_H - T_L$, the higher the COP — pushing heat over a small gap is cheap; (2) real cycles cannot reach the Carnot limit because two of its four processes (isothermal heat exchange inside the two-phase dome, and isentropic expansion of a wet vapor) are impractical with real hardware.

# Reversed Carnot COP limits for a typical AC duty
T_L = 5 + 273.15    # evaporator (cold space) in K
T_H = 40 + 273.15   # condenser (ambient) in K

cop_ref = T_L / (T_H - T_L)
cop_hp  = T_H / (T_H - T_L)
print(f"Carnot COP (refrigerator): {cop_ref:.2f}")
print(f"Carnot COP (heat pump):    {cop_hp:.2f}")
print(f"Check COP_HP = COP_R + 1:  {cop_ref + 1:.2f}")
Output:
Carnot COP (refrigerator): 7.95
Carnot COP (heat pump):    8.95
Check COP_HP = COP_R + 1:  8.95

The Vapor-Compression Cycle

Practical refrigeration uses the vapor-compression cycle, which replaces the impractical Carnot steps with four real components arranged in a loop:

#ProcessComponentWhat happens
1 → 2Isentropic compressionCompressorSaturated vapor compressed to high pressure; temperature rises
2 → 3Constant-pressure heat rejectionCondenserSuperheated vapor cooled and condensed to saturated liquid
3 → 4ThrottlingExpansion valveLiquid flashed to low pressure; $h$ constant, temperature drops
4 → 1Constant-pressure heat absorptionEvaporatorWet mixture boils, absorbing $Q_L$ from the cold space

The four state points define the cycle. Per unit mass of refrigerant:

$$q_L = h_1 - h_4 \quad(\text{refrigeration effect}), \qquad w_c = h_2 - h_1 \quad(\text{compressor work})$$

$$q_H = h_2 - h_3 \quad(\text{heat rejected}), \qquad \text{COP}_R = \frac{q_L}{w_c} = \frac{h_1 - h_4}{h_2 - h_1}$$

The throttling valve is the key idea: it is an isenthalpic device ($h_3 = h_4$), so the cold liquid expands and partially flashes to vapor, dropping to the low evaporator temperature without any moving parts.

🎯 3,000+ Engineers Placed
Sponsored
Harshal Sukenkar

Harshal

Fiat Chrysler

Abhishek

Abhishek

TATA ELXSI

Srinithin

Srinithin

Xitadel

Ranjith

Ranjith

Core Automotive

Gaurav Jadhav

Gaurav

Automotive Company

Bino K Biju

Bino

Design Firm

Aseem Shrivastava

Aseem

EV Company

Puneet

Puneet

Automotive Company

Vishal Kumar

Vishal

EV Startup

The Pressure-Enthalpy (p-h) Diagram

Refrigeration engineers live on the p-h diagram because three of the four processes are simply straight lines on it:

  • 1 → 2 (compression): a curve leaning right, following lines of constant entropy
  • 2 → 3 (condensation): a horizontal line at $p_H$, ending on the saturated-liquid curve
  • 3 → 4 (throttling): a vertical line ($h$ = constant) dropping to $p_L$
  • 4 → 1 (evaporation): a horizontal line at $p_L$, ending on the saturated-vapor curve

The refrigeration effect is the horizontal width of the evaporator line, and the work is the horizontal width of the compression curve — you can read the COP almost by eye.

Refrigerants

The working fluid must boil at the desired cold temperature for a convenient pressure, be safe, and have low environmental impact. Common choices:

RefrigerantTypeNotes
R134aHFCLong-standing automotive/AC fluid; high GWP, being phased down
R1234yfHFOLow-GWP replacement for R134a
R290 (propane)NaturalExcellent properties, flammable
R717 (ammonia)NaturalIndustrial; high efficiency, toxic
R744 (CO₂)NaturalTranscritical cycle; low GWP

Cycle Analysis in Python with CoolProp

[CoolProp](http://www.coolprop.org) gives us accurate refrigerant properties. We compute all four state points for an R134a cycle and find the COP directly.

from CoolProp.CoolProp import PropsSI

fluid = "R134a"
T_evap = -10 + 273.15    # evaporator temperature, K
T_cond = 40 + 273.15     # condenser temperature, K

# Saturation pressures at the two temperatures
p_low  = PropsSI("P", "T", T_evap, "Q", 1, fluid)   # evaporator pressure
p_high = PropsSI("P", "T", T_cond, "Q", 0, fluid)   # condenser pressure

# State 1: saturated vapor leaving evaporator
h1 = PropsSI("H", "T", T_evap, "Q", 1, fluid)
s1 = PropsSI("S", "T", T_evap, "Q", 1, fluid)

# State 2: isentropic compression to p_high (s2 = s1)
h2 = PropsSI("H", "P", p_high, "S", s1, fluid)
T2 = PropsSI("T", "P", p_high, "S", s1, fluid)

# State 3: saturated liquid leaving condenser
h3 = PropsSI("H", "T", T_cond, "Q", 0, fluid)

# State 4: throttling, h constant
h4 = h3
x4 = PropsSI("Q", "P", p_low, "H", h4, fluid)   # quality after valve

# Energy balances (per kg)
q_L = h1 - h4      # refrigeration effect
w_c = h2 - h1      # compressor work
q_H = h2 - h3      # heat rejected
cop_R  = q_L / w_c
cop_HP = q_H / w_c

print(f"Low/high pressure:    {p_low/1e5:.2f} / {p_high/1e5:.2f} bar")
print(f"Compressor outlet T2: {T2-273.15:.1f} C")
print(f"Quality after valve:  {x4:.3f}")
print(f"Refrigeration effect: {q_L/1000:.1f} kJ/kg")
print(f"Compressor work:      {w_c/1000:.1f} kJ/kg")
print(f"Heat rejected:        {q_H/1000:.1f} kJ/kg")
print(f"COP (refrigerator):   {cop_R:.2f}")
print(f"COP (heat pump):      {cop_HP:.2f}")
Output:
Low/high pressure:    2.01 / 10.17 bar
Compressor outlet T2: 47.7 C
Quality after valve:  0.279
Refrigeration effect: 145.9 kJ/kg
Compressor work:      24.7 kJ/kg
Heat rejected:        170.6 kJ/kg
COP (refrigerator):   5.91
COP (heat pump):      6.91

Notice the ideal cycle COP of 5.91 falls below the Carnot limit (about 7.6 for these temperatures) — exactly as the second law demands.

Adding the Refrigeration Capacity

For a real machine we also need a mass flow rate. If the unit must remove 3.5 kW (one "ton" of refrigeration ≈ 3.517 kW):

Q_dot = 3517      # cooling load, W
m_dot = Q_dot / q_L
W_dot = m_dot * w_c
print(f"Mass flow rate:   {m_dot*1000:.2f} g/s")
print(f"Compressor power: {W_dot:.0f} W")
Output:
Mass flow rate:   24.11 g/s
Compressor power: 595 W

COP vs. Evaporator Temperature

The single biggest lever on COP is the temperature lift. Let's sweep the evaporator temperature with a fixed condenser and watch the COP climb as the lift shrinks.

import numpy as np
import matplotlib.pyplot as plt
from CoolProp.CoolProp import PropsSI

fluid = "R134a"
T_cond = 40 + 273.15
p_high = PropsSI("P", "T", T_cond, "Q", 0, fluid)
h3 = PropsSI("H", "T", T_cond, "Q", 0, fluid)

T_evap_C = np.linspace(-25, 10, 30)
cop = []
for Tc in T_evap_C:
    Te = Tc + 273.15
    p_low = PropsSI("P", "T", Te, "Q", 1, fluid)
    h1 = PropsSI("H", "T", Te, "Q", 1, fluid)
    s1 = PropsSI("S", "T", Te, "Q", 1, fluid)
    h2 = PropsSI("H", "P", p_high, "S", s1, fluid)
    h4 = h3
    cop.append((h1 - h4) / (h2 - h1))

plt.figure(figsize=(9, 5))
plt.plot(T_evap_C, cop, "b-o", ms=4)
plt.xlabel("Evaporator temperature (°C)")
plt.ylabel("COP (refrigerator)")
plt.title("R134a Cycle: COP vs Evaporator Temperature (T_cond = 40 °C)")
plt.grid(True, alpha=0.3)
plt.show()

print(f"COP at -25 C: {cop[0]:.2f}")
print(f"COP at +10 C: {cop[-1]:.2f}")
Output:
COP at -25 C: 3.49
COP at +10 C: 8.96

The lesson is clear: every degree you can raise the evaporator (or lower the condenser) buys efficiency. This is why oversized evaporator coils and clean condenser fins matter so much in practice.

Heat Pumps

A heat pump is the same hardware used for heating: it absorbs heat from cold outdoor air and delivers $Q_H$ indoors. Because $\text{COP}_{HP} = \text{COP}_R + 1$, a heat pump with $\text{COP}_{HP} = 4$ delivers four units of heat per unit of electricity — far better than the single unit a resistance heater gives. A reversing valve lets one box do both jobs across the seasons.

Actual vs. Ideal Cycle

Real cycles depart from the ideal in several ways:

  • Superheat at the evaporator exit (state 1 is a few degrees above saturation) to protect the compressor from liquid slugging.
  • Subcooling at the condenser exit (state 3 below saturation) to ensure pure liquid reaches the valve — this increases refrigeration effect for free.
  • Non-isentropic compression: real compressors have isentropic efficiency $\eta_c$, so $w_{c,\text{actual}} = (h_{2s} - h_1)/\eta_c$, raising the work and lowering COP.
  • Pressure drops in the heat exchangers and lines.

$$w_{c,\text{actual}} = \frac{h_{2s} - h_1}{\eta_c}$$

Absorption Refrigeration

Where waste heat or solar heat is cheap, absorption systems replace the electric compressor with a thermally driven "thermal compressor." A water–lithium-bromide or ammonia–water pair uses a generator (heated), absorber, and a small solution pump. The work input is tiny (just the pump), but the heat input is large, so the COP defined on electricity is high while the COP on total energy is modest (around 0.7). They shine when the driving heat would otherwise be wasted.

Common Pitfalls

  • Using Celsius in Carnot COP. $T_L/(T_H - T_L)$ requires absolute temperature. Always convert to kelvin.
  • Forgetting the throttling valve is isenthalpic, not isentropic. $h_3 = h_4$; entropy increases across the valve.
  • Confusing COP_R and COP_HP. They differ by exactly 1 — check which "useful effect" the problem wants.
  • Expecting to beat Carnot. Any computed COP above $T_L/(T_H - T_L)$ means an error in your states.
  • Reading evaporator/condenser pressures off the wrong saturation point. Use Q=1 at the evaporator, Q=0 at the condenser.

Key Takeaways

  • Refrigerators and heat pumps spend work $W$ to move heat from cold to hot; $Q_H = Q_L + W$.
  • $\text{COP}_R = Q_L/W$, $\text{COP}_{HP} = Q_H/W$, and $\text{COP}_{HP} = \text{COP}_R + 1$.
  • The reversed Carnot cycle sets the ceiling: $\text{COP}_R = T_L/(T_H - T_L)$ — smaller lift means higher COP.
  • The vapor-compression cycle has four parts — compressor, condenser, expansion valve, evaporator — with $\text{COP}_R = (h_1 - h_4)/(h_2 - h_1)$.
  • CoolProp makes a full cycle analysis a few lines of code; superheat, subcooling, and compressor efficiency move the real cycle away from the ideal.

In the next lesson, we leave pure refrigerants behind and study mixtures of dry air and water vapor — the world of psychrometrics and HVAC.

3,000+ Engineers Placed in Top Companies
Career Growth

3,000+ Engineers Placed in Top Companies

Join the ranks of successful engineers at Bosch, Tata, L&T, and 500+ hiring partners.