£199.99 £139.99 for one year of Unlimited learning. Offer ends on 14 November 2022 at 23:59 (UTC). T&Cs apply

Find out more
Introducing heat equation
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

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education