Physics · Intermediate

Heat diffusion in a rod

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

Heat diffusion in a rod is described by the heat equation, which says that temperature changes fastest where the temperature profile is most sharply curved. Heat flows from hot to cold, smoothing out differences over a timescale that grows with the square of the length.

Intuition

Picture a metal rod with one warm region. Each small segment exchanges heat with its neighbours: if its neighbours are hotter on average, it warms; if cooler, it cools. A straight-line temperature profile gives no net change, because what flows in from one side flows out the other. Only curvature matters. Sharp peaks flatten quickly, while broad gentle variations decay slowly. This is why doubling a rod's length makes it take about four times longer to equilibrate. The thermal diffusivity α sets how fast it happens: metals have large α, insulators small. In physiology the same mathematics describes how solutes or heat spread through tissue over short distances.

Key equations

q=−k∂T∂x
(1)

Fourier's law: heat flux flows down the temperature gradient, with thermal conductivity k.

ρc∂T∂t=k∂2T∂x2
(2)

Energy balance giving the 1D heat equation.

∂T∂t=α∂2T∂x2,α=kρc
(3)

Heat equation with thermal diffusivity α.

τ∼L2α
(4)

Characteristic diffusion time over length L.

T(x,t)=∑nbnsin⁡(nπxL)e−αn2π2t/L2
(5)

Solution for ends held at zero temperature: each sine mode decays at its own rate.

Derivation

  1. Take a thin slice of rod between x and x+dx with cross-sectional area A.
  2. Heat entering at x per unit time is qA; leaving at x+dx is q(x+dx)A.
  3. Net heat gain rate is -(∂q/∂x)A dx.
  4. This raises the slice's temperature: ρcA dx ∂T/∂t = -(∂q/∂x)A dx.
  5. Insert Fourier's law q = -k ∂T/∂x to get ρc ∂T/∂t = k ∂²T/∂x².
  6. Divide by ρc to obtain ∂T/∂t = α ∂²T/∂x².
  7. Separate variables T = X(x)G(t): G'/(αG) = X''/X = -λ.
  8. With ends fixed at zero, X = sin(nπx/L), λ = (nπ/L)², and G = e^{-αλt}.
  9. Superpose modes with coefficients bₙ fitted to the initial profile.

Worked example

Problem

A copper rod of length 0.50 m has alpha = 1.1e-4 m²/s. Estimate the time for temperature differences along it to decay substantially, using the slowest mode with both ends held at fixed temperature.

  1. The slowest mode is n = 1, with decay rate alpha π²/L².
  2. Compute L² = 0.25 m².
  3. Rate = 1.1e-4 × 9.87 / 0.25 = 4.34e-3 per second.
  4. Time constant tau = 1 / rate ≈ 230 s.
  5. Check: L²/alpha = 2270 s, and dividing by π² gives 230 s.

Answer About 230 s (roughly 4 minutes) for the slowest mode to fall to 1/e; full equilibration takes several time constants.

Common mistakes

  • Thinking heat flow depends on temperature itself rather than its gradient and curvature.
  • Forgetting that diffusion time scales as L squared, not L.
  • Confusing thermal conductivity k with diffusivity α.
  • Ignoring boundary conditions, which determine the allowed modes.
  • Assuming a linear steady-state profile means heat has stopped flowing; it flows at a constant rate.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(70 lines)
import sys
import numpy as np
from manim import *
from blocks import *

# Explicit finite-difference solver for u_t = alpha u_xx, ends held at 0
def simulate(n=41, alpha=1.0, dt=0.0002, steps=1500, snap_every=500):
    x = np.linspace(0.0, 1.0, n)
    dx = x[1] - x[0]
    u = np.where(np.abs(x - 0.5) < 0.1, 1.0, 0.0)
    u[0] = u[-1] = 0.0
    r = alpha * dt / dx**2
    snaps = [(0.0, u.copy())]
    for k in range(1, steps + 1):
        un = u.copy()
        un[1:-1] = u[1:-1] + r * (u[2:] - 2 * u[1:-1] + u[:-2])
        un[0] = un[-1] = 0.0
        u = un
        if k % snap_every == 0:
            snaps.append((k * dt, u.copy()))
    return x, snaps, r


X, SNAPS, R = simulate()


class Main(Scene):
    def construct(self):
        self.camera.background_color = "#14161c"
        TitleCard(self, "Heat diffusion in a rod", "u_t = alpha u_xx")
        axes = Axes(x_range=[0, 1, 0.25], y_range=[0, 1.1, 0.5],
                    x_length=9, y_length=4.2,
                    axis_config={"color": C_DIM, "include_tip": False})
        axes.move_to([0, -0.2, 0])
        xl = Text("position x", font_size=24).next_to(axes, DOWN, buff=0.15)
        yl = Text("temperature", font_size=24).next_to(axes, LEFT, buff=0.15).shift(UP * 1.5)
        yl.rotate(0)
        yl.next_to(axes.get_corner(UL), UP, buff=0.1).shift(RIGHT * 0.8)
        self.play(Create(axes), FadeIn(xl), FadeIn(yl))

        colors = [C_BAD, C_ACCENT, C_GOOD, C_MAIN]
        curves = []
        for i, (t, u) in enumerate(SNAPS):
            pts = [axes.c2p(a, b) for a, b in zip(X, u)]
            c = VMobject(color=colors[i % 4], stroke_width=4)
            c.set_points_as_corners(pts)
            curves.append(c)
        tlabel = Text("t = 0.00", font_size=28, color=C_ACCENT).to_corner(UR).shift(DOWN * 0.8)
        self.play(Create(curves[0]), FadeIn(tlabel))
        StepCaption(self, "A hot segment in the middle of a rod")
        cur = curves[0]
        for i in range(1, len(curves)):
            new_t = Text(f"t = {SNAPS[i][0]:.2f}", font_size=28, color=C_ACCENT)
            new_t.move_to(tlabel)
            self.play(Transform(cur.copy(), curves[i]) if False else FadeIn(curves[i]),
                      Transform(tlabel, new_t), run_time=1.5)
        StepCaption(self, "Heat spreads and the peak falls; cold ends drain it")
        self.wait(1)
        StepCaption(self, "Diffusion smooths temperature differences over time")
        self.wait(1)


if __name__ == "__main__" and "--selftest" in sys.argv:
    assert R <= 0.5, "explicit scheme stable"
    assert SNAPS[0][1].max() == 1.0
    peaks = [s[1].max() for s in SNAPS]
    assert all(a >= b for a, b in zip(peaks, peaks[1:]))
    assert SNAPS[-1][1][0] == 0 and SNAPS[-1][1][-1] == 0
    assert SNAPS[-1][1].sum() < SNAPS[0][1].sum()
    print("ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.