Solving the 1D Advection Equation — Numerical Discretization — Leapfrog Approach

The advection equation is a simple first-order, partial differential equation (PDE) in which the unknown u satisfies:

where t is time, x is space and v is the advection speed.

The advection equation requires an initial condition:

and a boundary condition

In the above equations, (xmin, xmax) is the domain in which the equation should be solved, while (tstart, tend) is the time interval of interest.

From the numerical point of view, the advection equation can be efficiently solved by a leapfrog approach.

Time and space discretizations are introduced as:

where x0=xmin, xN=xmax, t0=tstart, tM=tend.

In this way, we are not searching for the values of u for x and t in continuous domains, but our unknowns become the samples:

Under the above discretization, the initial condition is given by

while the boundary condition is given by

The time and spatial derivatives are approximated by central differences (see Numerical approximation of derivatives) as

which leads to the following leapfrog update rule

where

is the so-called Courant number.

As it can be seen from the update rule, in order to start the iterations, besides the initial condition, we also need

To generate an estimate of the solution at time step #1, we can use the Forward Time Central Space (Numerical approximation of derivatives) scheme

which, for m=0, leads to

Furthermore, from the update rule, the element with index N would require an element with index N+1 which would be outside the solution domain. For this reason, the Mur boundary condition is employed, i.e.:

where

The Courant number must meet the following condition (Courant-Friedrichs-Lewy, or CFL, condition):

to guarantee numerical stability of the algorithm.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vitality Learning

We are teaching, researching and consulting parallel programming on Graphics Processing Units (GPUs) since the delivery of CUDA. We also play Matlab and Python.