Heat Transfer Basics | Thermodynamics with Python | Skill-Lync Resources

50% OFF - Ends Soon!

Lesson 11 of 13 30 min

Heat Transfer Basics

Thermodynamics tells us how much energy can move and in which direction; heat transfer tells us how fast. A perfectly insulated wall and a single pane of glass obey the same first law, but one keeps a house warm overnight and the other does not. In this lesson we cover the three modes of heat transfer and analyze them in Python.

The Three Modes

ModeMechanismNeeds a medium?Governing law
ConductionMolecular/lattice vibration, free electronsYes (solid/fluid)Fourier's law
ConvectionBulk fluid motion carrying energyYes (moving fluid)Newton's law of cooling
RadiationElectromagnetic wavesNo (works in vacuum)Stefan–Boltzmann law

Most real problems combine all three, and we stitch them together with the powerful idea of thermal resistance.

Conduction: Fourier's Law

Heat flows down a temperature gradient. For one-dimensional steady conduction through a plane wall of thickness $L$, area $A$, and thermal conductivity $k$:

Sponsored

Get an IIT Jammu PG certification

Recognized by Mahindra, Bosch, TATA ELXSI & 500+ companies

See Program Details

$$\dot Q = -kA\frac{dT}{dx} \quad\Rightarrow\quad \dot Q = \frac{kA}{L}\,(T_1 - T_2)$$

By analogy with Ohm's law ($I = \Delta V / R$), we define a conduction thermal resistance:

$$R_{cond} = \frac{L}{kA} \qquad [\text{K/W}]$$

Sponsored

70% of India's auto industry trusts Skill-Lync

For training their engineers in CAD, CAE & simulation

Learn More

so that $\dot Q = \Delta T / R_{cond}$. Typical conductivities:

Material$k$ (W/m·K)
Copper400
Steel50
Glass1.0
Brick0.7
Fiberglass insulation0.04
Air (still)0.026

Composite Walls — Resistances in Series

A real wall is layers stacked back to back. Because the same heat flux passes through each, their resistances add in series, exactly like resistors:

$$R_{total} = \sum_i \frac{L_i}{k_i A}, \qquad \dot Q = \frac{T_{in} - T_{out}}{R_{total}}$$

Sponsored

April batch closing soon — only 42 seats remaining

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

Reserve Your Seat

Parallel paths (e.g. a wall with studs and insulation side by side) combine like parallel resistors.

🎯 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

Convection: Newton's Law of Cooling

When a fluid moves past a surface, heat exchange depends on the convective heat transfer coefficient $h$:

$$\dot Q = h A\,(T_s - T_\infty), \qquad R_{conv} = \frac{1}{hA}$$

where $T_s$ is the surface temperature and $T_\infty$ the bulk fluid temperature. The coefficient $h$ is not a material property — it depends on geometry, fluid, and flow:

Situation$h$ (W/m²·K)
Free convection, gases2 – 25
Free convection, liquids50 – 1000
Forced convection, gases25 – 250
Forced convection, liquids100 – 20,000
Boiling / condensation2500 – 100,000
Free (natural) convection is driven by buoyancy alone; forced convection adds a fan or pump and dramatically raises $h$.

Radiation: Stefan–Boltzmann Law

Every surface above absolute zero radiates energy. The net heat exchanged between a surface (area $A$, emissivity $\varepsilon$, temperature $T_s$) and large surroundings at $T_{surr}$ is:

$$\dot Q_{rad} = \varepsilon \sigma A \,(T_s^4 - T_{surr}^4)$$

where $\sigma = 5.67\times10^{-8}\ \text{W/m}^2\text{K}^4$ is the Stefan–Boltzmann constant and $\varepsilon$ (0 to 1) is the emissivity — 1 for a perfect black body, about 0.9 for most paints and oxidized metals, and as low as 0.05 for polished aluminum. Temperatures must be in kelvin, and the fourth-power dependence makes radiation dominant at high temperatures.

It is often convenient to linearize radiation into an effective coefficient $h_{rad}$ so it can join a resistance network:

$$h_{rad} = \varepsilon \sigma (T_s^2 + T_{surr}^2)(T_s + T_{surr})$$

Overall Heat Transfer Coefficient U

For a wall with fluid on both sides, the full path is: inside convection → conduction layers → outside convection, all in series. The overall heat transfer coefficient $U$ bundles them:

$$\frac{1}{UA} = R_{total} = \frac{1}{h_i A} + \sum_i \frac{L_i}{k_i A} + \frac{1}{h_o A}, \qquad \dot Q = U A\,(T_{in} - T_{out})$$

$U$ (W/m²·K) is the standard figure of merit for windows, walls, and heat-exchanger surfaces — lower $U$ means better insulation.

Python: Composite-Wall Resistance Network Solver

Let's build a small solver that takes layers and the two surface convection coefficients, returns $U$, the heat flux, and the temperature at every interface.

import numpy as np

def composite_wall(layers, h_in, h_out, T_in, T_out, A=1.0):
    """
    layers: list of (name, thickness_m, k_W_mK)
    h_in, h_out: convection coefficients (W/m^2K)
    T_in, T_out: bulk temperatures (C)
    Returns U, heat flow, and interface temperatures.
    """
    R = [("inside film", 1.0 / (h_in * A))]
    for name, L, k in layers:
        R.append((name, L / (k * A)))
    R.append(("outside film", 1.0 / (h_out * A)))

    R_total = sum(r for _, r in R)
    U = 1.0 / (R_total * A)
    Q = (T_in - T_out) / R_total            # W

    # March through resistances accumulating temperature drops
    T = T_in
    temps = [("inside air", T_in)]
    for name, r in R:
        T = T - Q * r
        temps.append((f"after {name}", T))
    return U, Q, R, temps

# Example: brick + insulation + plaster wall on a winter day
layers = [
    ("brick",      0.10, 0.70),
    ("fiberglass", 0.08, 0.04),
    ("plaster",    0.02, 0.50),
]
U, Q, R, temps = composite_wall(layers, h_in=8, h_out=25,
                                T_in=21, T_out=-5, A=1.0)

print(f"Overall U-value: {U:.3f} W/m^2K")
print(f"Heat loss:       {Q:.1f} W per m^2\n")
print("Resistances (K/W per m^2):")
for name, r in R:
    print(f"  {name:14s} {r:.3f}")
print("\nTemperatures through the wall (C):")
for name, t in temps:
    print(f"  {name:24s} {t:6.1f}")
Output:
Overall U-value: 0.434 W/m^2K
Heat loss:       11.3 W per m^2

Resistances (K/W per m^2):
  inside film    0.125
  brick          0.143
  fiberglass     2.000
  plaster        0.040
  outside film   0.040

Temperatures through the wall (C):
  inside air                 21.0
  after inside film          19.6
  after brick                17.9
  after fiberglass          -10.7
  after plaster             -11.2
  after outside film         -5.0

The fiberglass layer ($R = 2.0$) carries 85% of the temperature drop — the insulation is doing nearly all the work, which is exactly its job.

Python: Combined Convection + Radiation Heat Loss

A hot surface loses heat by both convection and radiation simultaneously; the two act in parallel. Consider a bare steam pipe wall at 120 °C in a 20 °C room.

import numpy as np

sigma = 5.67e-8
A = 1.0                 # m^2
Ts = 120 + 273.15       # surface temp, K
Tinf = 20 + 273.15      # surroundings, K
h_conv = 10.0           # W/m^2K, natural convection
eps = 0.85              # emissivity of oxidized steel

# Convective loss
Q_conv = h_conv * A * (Ts - Tinf)

# Radiative loss
Q_rad = eps * sigma * A * (Ts**4 - Tinf**4)

# Equivalent radiation coefficient (for resistance networks)
h_rad = eps * sigma * (Ts**2 + Tinf**2) * (Ts + Tinf)

Q_total = Q_conv + Q_rad
print(f"Convective loss: {Q_conv:.1f} W")
print(f"Radiative loss:  {Q_rad:.1f} W")
print(f"h_radiation:     {h_rad:.2f} W/m^2K")
print(f"Total heat loss: {Q_total:.1f} W per m^2")
print(f"Radiation share: {100*Q_rad/Q_total:.0f}%")
Output:
Convective loss: 1000.0 W
Radiative loss:  866.5 W
h_radiation:     8.67 W/m^2K
Total heat loss: 1866.5 W per m^2
Radiation share: 46%

Even at a modest 120 °C, radiation accounts for nearly half the loss — a reminder never to ignore it when surfaces are hot.

Python: Temperature Distribution in a Plane Wall

In steady 1-D conduction with no internal generation, the temperature profile through a single homogeneous wall is linear. Let's confirm and plot it for our composite wall using the interface temperatures we computed.

import numpy as np
import matplotlib.pyplot as plt

# Reuse the composite wall result (brick / fiberglass / plaster)
layer_names = ["brick", "fiberglass", "plaster"]
thick = [0.10, 0.08, 0.02]
# Interface temperatures (surface-to-surface) from the solver above:
T_nodes = [19.6, 17.9, -10.7, -11.2]   # C, at each layer boundary

x_edges = np.concatenate(([0], np.cumsum(thick))) * 1000  # mm
plt.figure(figsize=(9, 5))
plt.plot(x_edges, T_nodes, "ro-", lw=2)
# Shade each layer
colors = ["#d9b38c", "#fff2b2", "#cccccc"]
for i, (n, c) in enumerate(zip(layer_names, colors)):
    plt.axvspan(x_edges[i], x_edges[i+1], color=c, alpha=0.5)
    plt.text((x_edges[i]+x_edges[i+1])/2, 5, n, ha="center", fontsize=9)

plt.axhline(0, color="k", lw=0.5)
plt.xlabel("Position through wall (mm)")
plt.ylabel("Temperature (°C)")
plt.title("Temperature Distribution Through a Composite Wall")
plt.grid(True, alpha=0.3)
plt.show()
Output:
(A plot shows a piecewise-linear temperature profile dropping from 19.6 °C
to -11.2 °C across the wall. The slope is steepest across the fiberglass
layer — steep gradient means high resistance and most of the temperature drop.)

The slope of each segment is inversely proportional to its conductivity: low-$k$ insulation produces a steep drop, high-$k$ brick a gentle one.

Fins (Briefly)

When convection from a surface is the bottleneck, we add fins — extensions that increase area $A$. A fin's effectiveness depends on a balance: conducting heat out along the fin vs. shedding it by convection, captured by the parameter $m = \sqrt{hP/(kA_c)}$ (with $P$ the perimeter, $A_c$ the cross-section). High-conductivity, thin fins in a high-$h$ flow work best — which is why CPU heat sinks are aluminum or copper with many thin blades.

Heat Exchangers: LMTD (Intro)

In a heat exchanger, the temperature difference between hot and cold streams varies along its length, so we use the log-mean temperature difference:

$$\dot Q = U A \,\Delta T_{lm}, \qquad \Delta T_{lm} = \frac{\Delta T_1 - \Delta T_2}{\ln(\Delta T_1/\Delta T_2)}$$

where $\Delta T_1$ and $\Delta T_2$ are the temperature differences at the two ends. For a counter-flow exchanger $\Delta T_{lm}$ is larger than for parallel flow at the same terminal temperatures, which is why counter-flow is preferred.

import numpy as np
# Counter-flow: hot 90->60 C, cold 25->50 C
dT1 = 90 - 50    # hot-in vs cold-out
dT2 = 60 - 25    # hot-out vs cold-in
LMTD = (dT1 - dT2) / np.log(dT1 / dT2)
UA = 500         # W/K
Q = UA * LMTD
print(f"LMTD: {LMTD:.2f} C")
print(f"Heat duty: {Q/1000:.2f} kW")
Output:
LMTD: 37.45 C
Heat duty: 18.73 kW

Common Pitfalls

  • Celsius in radiation. $T^4$ requires kelvin. Using °C gives wildly wrong (often negative) results.
  • Adding $h$ values directly. Combine convection and radiation as parallel resistances (or add coefficients $h_{conv} + h_{rad}$), not by summing resistances.
  • Treating $h$ as a material constant. It depends on flow and geometry — look it up for your specific case.
  • Forgetting the film resistances. Indoor/outdoor air films are real resistances in series with the wall; omitting them overestimates heat loss.
  • Series vs parallel confusion. Layers stacked through the heat path are in series; side-by-side paths are in parallel.

Key Takeaways

  • Conduction follows Fourier's law $\dot Q = kA\,\Delta T/L$ with resistance $R = L/(kA)$.
  • Convection follows Newton's cooling $\dot Q = hA\,(T_s - T_\infty)$, with $R = 1/(hA)$; forced convection beats free convection.
  • Radiation follows Stefan–Boltzmann $\dot Q = \varepsilon\sigma A(T_s^4 - T_{surr}^4)$ in kelvin and dominates at high temperature.
  • Thermal resistances add in series/parallel like circuits; the overall $U$ bundles the whole path: $\dot Q = UA\,\Delta T$.
  • Heat exchangers use $\dot Q = UA\,\Delta T_{lm}$ with the log-mean temperature difference.

In the next lesson, we bring the whole course together in a capstone Python project: a complete Rankine cycle analyzer.

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.