Conduction, or heat transfer between objects, is something we experience everyday. Putting a pan on the stove or sitting on a hot park bench gives us an intuitive sense of conductive heat transfer but here we will formalize the process and build a basic computational framework to simulate it. Conduction is an excellent first simulation problem to tackle because it uses the basic tools found in many computational physics problems.

In this article we will:

Create a mesh grid to represent materials

Learn basic heat transfer equations and their computational equivalents

Update the values in our mesh grid based on the underlying physics

Simulate conductive heat transfer

A mesh grid is a computational tool used to discretize a continuous space. That is, we can’t perform calculations on all time and space in our problem, so we chose a representative subset of points, usually at regular intervals, to look at instead.

In figure 1 below we can see an example of a mesh grid. Here a space is subdivided into evenly spaced cells which is common practice is physics simulation. Instead of running calculations/simulation on the entire surface we can now work with only our grid points which makes our problem more feasible.

The mesh grid above was created using Python’s numpy meshgrid function which can take in a set of 1 dimensional arrays and create a mesh grid for us. For our simulation, we want to model a 2 dimensional surface, so we are going to generate 2 arrays filled with the starting values we want with a length of how many intervals we want to evaluate our simulation on. See the code snippet below where we create a 100×100 mesh grid of zeros as the basis of our simulation.

import numpy as np

#Define how many intervals we want per axis resolution = 100

#Create x and Y arrays of zeros of length 100 x = np.zeros(resolution) y =…