Finite differencing: Introduction 2

From Interactive System for Ice sheet Simulation
Jump to: navigation, search

A simple example

We'll begin by considering a very simple example - something we can solve with only a few lines of code. The code samples for this can be found in the simple_FD directory.

The equation we're going to solve is the one-dimensional diffusion equation:

\frac{\partial \phi}{\partial t} = D\frac{\partial^2 \phi}{\partial x^2}

In this case, we have a constant diffusivity D. Later, we'll treat a spatially-varying value.