MTH3007b Lecture 6

Me, in the lecture

zzzzz…

This session opens the PDE strand of the module. We look at how partial differential equations arise, how to classify them, and how to discretise and solve the 1D diffusion equation numerically using the Forward-Time Centred-Space (FTCS) scheme.

PDEs: Introduction and Classification

A partial differential equation (PDE) involves an unknown function of two or more variables and its partial derivatives. The classic example in this module is the Heat equation (also called the diffusion equation):

where is the diffusion coefficient. This governs, for example, how temperature spreads along a rod over time.

Initial and Boundary Conditions

To have a unique solution, a PDE needs both an initial condition (the state of at across the whole domain) and Boundary conditions at the edges of the spatial domain.

The three standard types of boundary condition are:

  • Dirichlet BC: the value of is fixed at the boundary, e.g. .
  • Neumann BC: the normal derivative is fixed at the boundary.
  • Mixed BC: Dirichlet on part of the boundary and Neumann on the rest.

The Laplace and Poisson Equations

The Laplace equation describes the steady state of the diffusion equation - when :

The Poisson equation generalises this by including a nonzero source term :

In one spatial dimension, the Poisson equation reduces to:

Finite Difference Second Derivative

We discretise the second derivative using the standard centred stencil (see Finite differences):

This follows from combining the forward and backward first-difference approximations.

The FTCS Scheme for 1D Diffusion

FTCS stands for Forward-Time Centred-Space. We use a forward (explicit) difference in time and the centred stencil in space.

Starting from the diffusion equation and applying both discretisations:

Rearranging to get the update rule:

where the stability parameter is defined as:

Here indexes space and indexes time. The new value at each interior point is computed entirely from old (known) values - this is what makes the scheme explicit.

Algorithm

  1. Set up the spatial grid with spacing and time grid with step .
  2. Apply the initial condition to the array .
  3. Apply Dirichlet boundary conditions: fix and at each time step.
  4. For each time step, loop over interior points and apply the FTCS update.
  5. Store or plot as needed.

Python Implementation

Python
Output

The initial condition here is with Dirichlet conditions . Note that u_profile = 1.0 * u_next copies the array by value rather than creating an alias - this is important for correctness.


Pre-Lecture Notes from University Notes

  • PDEs involve partial derivatives in two or more variables; the diffusion equation is the central example.
  • ICs specify at ; BCs specify behaviour at spatial boundaries throughout time.
  • Dirichlet BCs fix ; Neumann BCs fix ; Mixed BCs combine both.
  • Laplace equation: (steady state); Poisson: (with source).
  • 1D Poisson discretises via .
  • FTCS update: with .
  • The scheme is explicit: each new value depends only on known old values.
  • Next session: Monte Carlo integration and an introduction to stochastic processes.