Skip main navigation

Introducing heat equation

In this article, we introduce the heat equation, which will be
used in various hands-on exercises throughout the course.
© CC-BY-NC-SA 4.0 by CSC - IT Center for Science Ltd.

Heat (or diffusion) equation is a partial differential equation that describes how the temperature varies in space over time.

The numerical solution of the heat equation contains performance aspects that are present also in many other problems and, as such, the heat equation is used as an example in several hands-on exercises throughout the course.

The heat equation can be written as

[frac{partial u}{partial t} = alpha nabla^2 u]

where u(x, y, t) is the temperature field that varies in space and time, and α is the thermal diffusivity constant.

The equation can be solved numerically in two dimensions by discretizing first the Laplacian with finite differences as

[nabla^2 u = frac{u(i-1,j)-2u(i,j)+u(i+1,j)}{(Delta x)^2} + frac{u(i,j-1)-2u(i,j)+u(i,j+1)}{(Delta y)^2}]

Given an initial condition ((u(t=0) = u_0)) one can then follow the time dependence of the temperature field with the explicit time evolution method:

[u_{m+1}(i,j) = u_m(i,j) + Delta t alpha nabla^2 u_m(i,j)]

Note: the algorithm is stable only when

[Delta t < frac{1}{2 alpha} frac{(Delta x Delta y)^2}{(Delta x)^2 + (Delta y)^2}]

The image below shows a result of numerical simulation where the initial state is a cold object in a hot surrounding (for us Finns this would be a soda bottle in a sauna) and we follow the time evolution for few hundres of time steps.

Numerical solution

Are you familiar with any other problems with a similar numerical solution? Please comment!

© CC-BY-NC-SA 4.0 by CSC - IT Center for Science Ltd.
This article is from the free online

Python in High Performance Computing

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now