# Numerical Solution of the Advection Partial Differential Equation: Finite Differences, Fixed Step Methods

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration shows some numerical methods for the solution of partial differential equations: in particular we solve the advection equation. We use finite differences with fixed-step discretization in space and time and show the relevance of the Courant–Friedrichs–Lewy stability criterion for some of these discretizations.

Contributed by: Alejandro Luque Estepa (March 2011)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

It is hard to find reliable numerical methods for the solution of partial differential equations (PDEs). Often they turn out to be either unstable or strongly diffusive, giving inaccurate solutions even to simple equations.

Our case study is one of the simplest PDEs, the advection equation

that describes the propagation of an unchanging shape at constant speed *.* Trivially, this equation is solved by any function .

To solve it numerically we approximate to a discrete solution defined in a rectangular grid, . For the spatial derivative we use a first-order, centered approximation

.

We can think now of many discrete approximations for the time derivative. The simplest one is the explicit Euler discretization:

∼.

Then we arrive at the method usually abbreviated FTCS (forward in time, centered in space). Unfortunately, this discretization turns out to be numerically unstable for any value of and .

A first improvement to the FTCS scheme would be to replace the term in the time discretization by an average . This approach, often called the Lax method, is equivalent to adding an artificial diffusion term to the advection equation. The resulting scheme is now stable if it satisfies the Courant–Friedrichs–Lewy* *condition:

,

where is called the Courant number. However, since we are adding an artificial diffusive term, the scheme becomes too diffusive and therefore inaccurate when . The Lax method gives optimal results for .

Fortunately, the differential equation solver of *Mathematica,* NDSolve, comes with many numerical schemes that avoid the shortcomings of the FTCS and Lax methods. In this Demonstration you can choose some of these methods with a fixed-step time discretization.

Bibliography:

R. Courant, K. Friedrichs, and H. Lewy, *On the Partial Difference Equations of Mathematical Physics*, IBM J. Res. Develop., 11, 1967 pp. 215–234.

W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, *Numerical Recipes: The Art of Scientific Computing*, 3rd ed., Cambridge, UK: Cambridge University Press, 2007.

## Permanent Citation