Heat Equation Simulator

Simulation #81 NEW Thermal Physics A-Level / Engineering FDTD Finite Difference
Click anywhere on the canvas to add a temporary heat source (700 �C, 8-cell radius, fades after ~400 ticks)
Preset Scenario
Thermal Diffusivity a0.120
Source Strength1.0�
Simulation Speed4�
Controls
Keyboard shortcuts:
P Pause   R Reset   S Save PNG
16 Switch preset
Colour map (fire palette):
Black = 0 �C (cold)
Dark red = ~180 �C
Orange = ~550 �C
Yellow = ~720 �C
White = 1000 �C (max)
Grid: 200 � 200 cells
Method: Explicit FDTD (Euler)
Stability: r = a�?t/?x� = 0.24
BCs: Dirichlet (fixed T) + Neumann zero-flux edges

The Fourier Heat Equation

The heat (or diffusion) equation is one of the three fundamental second-order linear PDEs of mathematical physics � alongside the wave equation and Laplace equation. Derived by Joseph Fourier in 1822, it describes how temperature diffuses through a material over time:

?T/?t = a ?�T = a (?�T/?x� + ?�T/?y�) [2-D form]

Where T(x, y, t) is temperature, t is time, and a is thermal diffusivity (m�/s). The Laplacian ?�T captures the local curvature of the temperature field � regions where temperature curves upward (surrounded by hotter neighbours) heat up, and regions where it curves downward cool down.

Origin: Fourier's Law of Conduction

The heat equation follows directly from two physical laws combined:

Together: ?c ?T/?t = k ?�T ? ?T/?t = (k/?c) ?�T = a ?�T.

Thermal Diffusivity of Real Materials

Materialk (W/m�K)? (kg/m�)c (J/kg�K)a (�10?6 m�/s)
Copper4018960385116
Aluminium237270090097.5
Steel (carbon)50785047013.6
Glass1.025008400.48
Water (20 �C)0.6099841820.143
Wood (oak)0.1770017000.143
Air (20 �C)0.0261.2100521.5

Finite-Difference Method (FDTD)

The simulator solves the heat equation numerically using the explicit Euler finite-difference scheme, discretising space into a 200 � 200 grid with spacing ?x = ?y = 1 (normalised), and advancing time in steps ?t.

Discretisation Stencil

T[i,j]^{n+1} = T[i,j]^n + r�(T[i+1,j] + T[i-1,j] + T[i,j+1] + T[i,j-1] - 4�T[i,j]) where r = a�?t / ?x� (must satisfy r = 0.25 in 2-D for stability)

The 5-point star (Laplacian stencil): each cell's new temperature depends on itself plus its four orthogonal neighbours. This is the spatial second derivative by central differences: ?�T/?x� � (T[i+1,j] - 2T[i,j] + T[i-1,j]) / ?x�.

Stability � CFL Condition

The explicit scheme is only conditionally stable. If the stability parameter r = a�?t/?x� exceeds 0.25 (in 2-D), small errors grow exponentially � the grid "explodes". The simulator automatically clamps r = 0.24 at all alpha-slider values, so you can safely explore the full diffusivity range.

Boundary Conditions Implemented

TypeMathematical formPhysical meaningUsed in preset
DirichletT|_boundary = T_bcFixed temperature at boundaryAll presets (edges / fins)
Neumann (zero flux)?T/?n|_boundary = 0Insulated surface, no heat leavesDefault edge treatment
Interior sourceT[i,j] = T_sourceConstant-temperature heat source/sink within domainHeat Sink (CPU die)
Zone diffusivitya_local � a_globalLow-conductivity insulation layerInsulated Wall

Preset Scenarios Explained

🌡️ Rod Heating

The classic 1-D Fourier experiment: a long metal rod held at 600 �C at the left end and 20 �C at the right end. At steady state (?T/?t = 0), the temperature profile becomes linear � T(x) = T_hot - (T_hot - T_cold) � x/L. The simulator shows the transient approach to this linear profile, with the heat front advancing from left to right.

🔥 Plate Cooling

A square plate initially at 800 �C cools through its four edges (held at 20 �C). The solution is a 2-D Fourier series. Symmetry means the centre stays hottest longest. The characteristic "bull's-eye" cooling pattern is directly visible in the fire colour map.

💨 Heat Sink

Models a CPU die (constant 200 �C central source) with aluminium cooling fins along the top edge. Fins are represented as thin Dirichlet columns held at 25 �C. Real heat-sink fins work identically: the fin efficiency ? = tanh(mL)/(mL), where m = v(hP/kA) (h = convective coefficient, P = fin perimeter).

🧱 Insulated Wall

Two zones: hot interior (600 �C, left) and cold exterior (20 �C, right), separated by an insulation layer with a reduced to 5% of the bulk value. The temperature jump across the thin insulation layer demonstrates thermal resistance R = L/(kA): thicker or lower-k insulation gives a steeper T-drop.

🔄 Phase Change

A heat front propagates from the left boundary (900 �C) into a cold domain (20 �C), analogous to the advance of a solidification or melting front. In a real material undergoing phase change, a Stefan condition ?L dS/dt = k ?T/?x|_front must be added (where L is latent heat and S is the front position). This preset shows the pure diffusion component.

⚠️ Thermal Shock

A ceramic disc at 900 �C is suddenly quenched in cold water (20 �C, pinned at all edges). The large, rapid thermal gradient creates biaxial thermal stress s_thermal = E�a_thermal�?T/(1-?), which can exceed material fracture toughness. This is why ceramics, glass, and graphite crack when thermally shocked. The simulation shows the steep radial gradient propagating inward.

Analytical Solutions

Steady-State Rod (1-D, Dirichlet BCs)

d�T/dx� = 0 ? T(x) = T_L + (T_R - T_L) � x/L (linear profile)

Cooling Plate (2-D, Fourier Series)

T(x,y,t) = S_{m,n} A_{mn} � sin(mpx/L) � sin(npy/L) � exp(-a(mp/L)� + (np/L)�)�t) where A_{mn} = (4/L�) ∬ T0(x,y) sin(mpx/L) sin(npy/L) dx dy

Semi-Infinite Solid (Step-Change BC at x=0)

T(x,t) = T_i + (T_s - T_i) � erfc(x / (2v(at))) where erfc = complementary error function = 1 - erf

This is the exact solution for the Phase Change preset's early-time behaviour: the thermal penetration depth d � 2v(at), growing as the square root of time.

Curriculum Connections

TopicQualificationConcepts Covered
Heat conduction and convectionGCSE / A-Level PhysicsFourier's law, thermal conductivity, temperature gradient
Thermal physicsA-Level Physics / IB HLSpecific heat, thermal diffusivity, boundary conditions
PDEs and finite differencesA-Level Further Maths / Uni Maths2-D heat equation, CFL stability, FDTD discretisation
Numerical methodsEngineering & Computing degreesExplicit vs implicit schemes, stability analysis, von Neumann
Materials scienceA-Level / UndergraduateThermal conductivity, diffusivity, thermal shock, phase change
Building physicsArchitecture / EngineeringU-values, thermal bridges, insulation R-values

Related Simulations & Articles