2D Heat Equation Simulator Back
Thermal Analysis · FEM

2D Transient Heat Equation Simulator

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) 1.2e-5
Simulation speed
Boundary Conditions
Initial Condition Presets
Color scale min (°C) 0
Color scale max (°C) 100

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$

CAE Connection: The explicit FDM used here shares the same mathematical basis as Ansys Mechanical Transient Thermal. Applications include PCB cooling, building insulation, weld heat history.
T max (°C)
T min (°C)
T avg (°C)
0.0s
Elapsed time
0°C 100°C

Click / drag on canvas to add heat sources

Explicit Finite Difference Discretization

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).

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$).

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.

Related Engineering Fields

This 2D unsteady heat conduction calculation is an example of the universal physical phenomenon of "diffusion". Many fields are described by equations of the same form (the diffusion equation). For example, mass diffusion. The diffusion of impurities (doping) in semiconductor manufacturing or carburizing treatment on metal surfaces can be simulated with exactly the same equation by replacing temperature T with concentration C.

Also, the fundamentals of groundwater flow analysis are similar. The temporal change in hydraulic head (water pressure) underground is solved using permeability coefficients instead of thermal diffusivity. Furthermore, the option pricing model in financial engineering (the Black-Scholes equation) also takes the same form as the heat conduction equation after a variable transformation. The way heat spreads is mathematically analogous to how risk spreads through asset prices.

For a direct application, battery thermal management (BMS) is crucial. Lithium-ion batteries generate heat, and local overheating can trigger thermal runaway. Predicting the 2D/3D temperature distribution inside a cell is central to the safety design of EVs. The operation of placing multiple heat sources in this simulator can be considered a foundational experience for simulating the arrangement of multiple cells within a battery pack.

For Further Learning

The first next step is to delve deeper into "types of boundary conditions and their physical meanings". In addition to the Dirichlet (fixed temperature) and Neumann (specified heat flux) conditions available in this tool, the "convective boundary condition (third-kind boundary condition)" is the most commonly used in practice. This condition represents heat exchange between a solid surface and a fluid (air or water) using a heat transfer coefficient h and fluid temperature T_f, expressed by the equation $\lambda \frac{\partial T}{\partial n} = h (T_f - T)$. The design of heat sink fins cannot be discussed without this condition.

Regarding the mathematical background, a systematic understanding of numerical methods for partial differential equations is helpful. The "explicit method" used by this tool is easy to understand but has significant constraints. Learning about the "implicit method" or the "Crank-Nicolson method" as a next step will help you understand why they are stable and efficient. Keywords are "systems of linear equations" and "matrix solvers".

For practical learning, try designing virtual experiments with this tool. For example, quantitatively investigate questions like: "How much does the time to reach a uniform temperature differ when the heat source is placed in a corner versus the center?" or "How does the internal equilibrium temperature rise as more adiabatic boundaries are added?" Then, summarize the results in a simple graph. The most important aspects of CAE are the physical interpretation of simulation results and how to translate them into design decisions. This tool is an ideal place to take that first step.