2D Heat Equation Simulator Back
Thermal Analysis · FEM

2D Transient Heat Equation Simulator — Time-Evolving Diffusion Visualizer

Real-time finite difference simulation of the 2D transient heat equation. Visualize heat diffusion with false-color animation. Click to add heat sources interactively.

Parameters
Material Preset
Thermal diffusivity α (m²/s)
Simulation speed
x
Boundary Conditions
Initial Condition Presets
Color scale min (°C)
°C
Color scale max (°C)
°C
Results
-
Max T (°C)
-
Min T (°C)
-
Average T (°C)
0.0s
Elapsed time
Heat
0°C 100°C

Click: add heat source (click and drag to paint continuously)

Theory & Key Formulas

Central difference scheme:

$$T_{i,j}^{n+1}= T_{i,j}^n + r\!\left(T_{i+1,j}^n + T_{i-1,j}^n + T_{i,j+1}^n + T_{i,j-1}^n - 4T_{i,j}^n\right)$$

60×60 grid, multiple steps per frame (scaled by simulation speed). Boundary: Dirichlet (fixed T) or Neumann (insulated, ∂T/∂n=0).

Governing Equation

Fourier's heat equation (2D transient):

$$\frac{\partial T}{\partial t}= \alpha\!\left(\frac{\partial^2 T}{\partial x^2}+ \frac{\partial^2 T}{\partial y^2}\right)$$

Stability (Courant number): $r = \alpha\Delta t/\Delta x^2 \leq 0.25$

What is 2D Transient Heat Diffusion?

🙋
What exactly is the "transient" part of this heat equation? Is it just watching a hot spot fade away?
🎓
Basically, "transient" means the temperature is changing over time. It's not just a static picture of heat; it's the movie. For instance, imagine dropping a hot coin onto a cold metal plate. The simulator shows you how that initial hot spot spreads out and fades over seconds or minutes, which is the transient behavior. Try changing the "Simulation speed" slider above to see this evolution faster or slower.
🙋
Wait, really? So the "Thermal Diffusivity" parameter must control how fast that movie plays out. But what does a high value like for aluminum actually mean physically?
🎓
Exactly right. Thermal diffusivity, $\alpha$, is the material's "thermal agility." A high $\alpha$ means heat spreads through it very quickly. In practice, aluminum ($\alpha \approx 8.4 \times 10^{-5}$ m²/s) will smooth out temperature differences much faster than steel ($\alpha \approx 1.2 \times 10^{-5}$ m²/s). In the simulator, switch the "Material Preset" from steel to aluminum and watch how much quicker the colors blend-the heat diffuses almost 7 times faster!
🙋
That makes sense! So the math behind the animation is calculating the next frame based on the current one. How does it do that without getting unstable or blowing up?
🎓
Great question. It uses a method called the Explicit Finite Difference Method (FDM). It takes the temperature at a point, looks at its four neighbors, and calculates the next temperature. The key is a stability condition linked to $\alpha$ and the time step. If the step is too large, the calculation "blows up"-you'd see wild, unrealistic oscillations. The simulator here handles this automatically, but in professional CAE software, choosing a stable time step is a critical part of the setup.

Physical Model & Key Equations

The core physics is described by Fourier's Law of Heat Conduction, leading to the 2D Transient Heat Equation. It states that the rate of temperature change at a point is proportional to how much the temperature curves around that point.

$$\frac{\partial T}{\partial t}= \alpha\!\left(\frac{\partial^2 T}{\partial x^2}+ \frac{\partial^2 T}{\partial y^2}\right)$$

$T(x,y,t)$ is the temperature field (°C). $\alpha$ is the thermal diffusivity (m²/s). The terms $\frac{\partial^2 T}{\partial x^2}$ and $\frac{\partial^2 T}{\partial y^2}$ are the spatial curvatures of temperature, which drive the heat flow.

To solve this on a computer, we discretize it using the Explicit Finite Difference Method (FDM). This equation is what the simulator calculates for every grid point at every time step to create the animation.

$$T_{i,j}^{n+1}= T_{i,j}^n + r\!\left(T_{i+1,j}^n + T_{i-1,j}^n + T_{i,j+1}^n + T_{i,j-1}^n - 4T_{i,j}^n\right)$$

Here, $T_{i,j}^n$ is temperature at grid point (i,j) at time step n . $r = \alpha \Delta t / (\Delta x)^2$ is a dimensionless stability parameter. The term in parentheses sums the temperatures of the four neighboring cells, minus four times the center cell-this is the discrete version of the curvature ($\nabla^2 T$).

Frequently Asked Questions

Click on any position on the simulation screen, and a new heat source will be added at that location. At the moment of clicking, high-temperature heat is applied, and you can observe in animation how it diffuses into the surrounding area over time.
Thermal diffusivity represents how easily heat spreads. Increasing the value makes heat spread faster, while decreasing it slows down the spread. For example, to simulate a material that conducts heat well, such as metal, set a large value; for a material that conducts heat poorly, such as wood, set a small value.
This may be because the time step is too large or the spatial mesh is too coarse. Explicit methods must satisfy stability conditions (CFL conditions). Especially when the thermal diffusivity is large or the mesh is fine, please set a smaller time step.
It is ideal as an educational tool for understanding the qualitative behavior of heat diffusion, but for practical design, please use dedicated CAE software (such as ANSYS or COMSOL). This tool uses a simplified explicit method and does not support complex boundary conditions or detailed material property settings.

Real-World Applications

Electronics Cooling (PCB & Chip Design): Engineers use this exact analysis to prevent overheating. By simulating heat diffusion from hot components like CPUs across a circuit board, they can design optimal heat sink placement and airflow, ensuring reliability. The "add custom heat sources" feature in the simulator mimics placing hot components on a board.

Building Science & Insulation: How does heat leak through a wall or window over a day-night cycle? Transient 2D analysis models the thermal mass and insulation properties of building materials, helping architects design energy-efficient homes that stay warm in winter and cool in summer.

Welding & Metal Processing: The intense heat of a weld creates a complex, moving temperature field in the metal. Simulating this "heat-affected zone" is crucial to predict residual stresses, distortions, and material property changes, ensuring the weld's structural integrity.

Geothermal Systems & Ground-Source Heat Pumps: To design efficient systems, engineers model how heat injected into or extracted from the ground propagates through the soil over months and years. This 2D transient analysis helps size the system and predict long-term performance.

Common Misunderstandings and Points to Note

First, do not confuse "simulation speed" with "the rate of physical time progression". Speeding up the animation with the slider does not change how fast heat actually propagates; it is merely the playback speed for visualization. The progression of physical time is determined by the "time step Δt" and the "number of calculation steps". For example, calculating 1000 steps with Δt=0.1 seconds means you are observing the state after 100 seconds.

Next, "thermal diffusivity α" and "thermal conductivity λ" are different. α represents "how easily heat spreads", while λ represents "how easily heat is transferred". Their relationship is given by $\alpha = \lambda / (\rho c)$, involving density ρ and specific heat c. Insulating materials have a small λ, but they may also have small ρ and c, sometimes resulting in a surprisingly large α. When considering a material's "thermal character", get into the habit of thinking about these three property values (λ, ρ, c) as a set.

Finally, the "divergence" in this tool is not a real explosion. When the Courant number r exceeds 0.25, the calculation breaks down, but this is a limitation of the numerical method (explicit method). In practice, refining the mesh requires an extremely small Δt, leading to enormous computation times. This is precisely why other stable algorithms, such as implicit methods or semi-implicit methods, have been developed.

How to Use

  1. Set thermal diffusivity (alpha) in m²/s using the slider—typical values: copper 1.17e-4, steel 1.2e-5, concrete 1e-6
  2. Adjust animation speed and temperature scale (Tmin to Tmax in °C) to visualize gradients; default range 0–100°C works for most scenarios
  3. Click grid cells to add heat sources, then run simulation to observe transient diffusion; monitor Max/Min/Average T and Elapsed time statistics in real-time

Worked Example

Simulate a steel plate (2D domain, 0.5 m × 0.5 m, alpha=1.2e-5 m²/s) with one corner initialized at 100°C. After 60 seconds elapsed simulation time, the heat front diffuses ~0.04 m radially; center temperature rises to approximately 35°C while edges remain near 20°C. Maximum T=100°C (source), Minimum T=20°C (boundary), Average T=42°C demonstrates the Fourier heat equation solution via explicit finite difference method over 2400 time steps at 0.025 s per step.

Practical Notes