previous up next SYLLABUS  Previous: 2.2 Explicit 3 levels  Up: 2 FINITE DIFFERENCES  Next: 2.4 Leap-frog, staggered grids

2.3 Lax-Wendroff

Slide : [ Lax-Wendroff Scheme - Code - Run || VIDEO login]

Rather than counting on your intuition for the right combination of terms, is it possible to formulate a systematic recipe for solving an equation in Eulerian coordinates and with any chosen level of accuracy? Yes, using the so-called Lax-Wendroff approach, which can easily be generalized for non-linear and vector equations.

  1. Discretize the function on a regular grid $ f(x) \rightarrow (x_j, f_j)$ , $ j=1,N$ ,
  2. Expand the differential operators in time using a Taylor series

    $\displaystyle f_{x_j}^{t+\Delta t} = f_{x_j}^t +\left.\Delta t\frac{\partial f}...
...2}\frac{\partial^2 f}{\partial t^2}\right\vert _{x_j} + \mathcal{O}(\Delta t^3)$ (2.3.0#eq.6)

  3. Substitute the time derivatives from the master equation; for the case of advection (1.3.1#eq.1), this yields

    $\displaystyle f_{x_j}^{t+\Delta t} = f_{x_j}^t -\left.u\Delta t\frac{\partial f...
...{2}\frac{\partial^2 f}{\partial x^2}\right\vert _{x_j} +\mathcal{O}(\Delta t^3)$ (2.3.0#eq.7)

  4. Use centered differences for spatial operators

    $\displaystyle f_j^{t+\Delta t} = f_j^t -\frac{\beta }{2}\left(f_{j+1}^t-f_{j-1}...
...{2}\left(f_{j+1}^t-2f_{j}^t+f_{j-1}^t\right) +\mathcal{O}(\Delta x^3\Delta t^3)$ (2.3.0#eq.8)

The example here yields a second order Lax-Wendroff scheme for advection that is explicit, centered and stable provided that the CFL number $ \beta=u\Delta t/\Delta x$ remains below unity:
      for (int j=1; j<n; j++) {
        fp[j]=f[j] -0.5*beta *(f[j+1]-f[j-1])
                   +0.5*beta*beta*(f[j+1]-2.*f[j]+f[j-1]); }
      fp[0]=f[0] -0.5*beta *(f[ 1 ]-f[ n ])
                 +0.5*beta*beta*(f[ 1 ]-2.*f[0]+f[ n ]);
      fp[n]=f[n] -0.5*beta *(f[ 0 ]-f[n-1])
                 +0.5*beta*beta*(f[ 0 ]-2.*f[n]+f[n-1]);

JBONE applet:  press Start/Stop to simulate the advection of a box function and to test how the second order explicit Lax-Wendroff scheme affects the dispersion and the damping of short and long wavelengths superposed in a box function.

The JBONE applet below illustrates how the Lax-Wendroff scheme combines the properties of the 2 and 3 levels schemes from the two previous sections.

Numerical experiments: explicit Lax-Wendroff
  1. Examine the propagation and the damping of harmonic functions; try to assess the numerical properties directly from your observations.
  2. Test if this scheme also works for negative velocities.
  3. Explain what happens when choosing the magic time step for which $ \beta=1$ ; why can you not rely on this in an inhomogeneous medium?

SYLLABUS  Previous: 2.2 Explicit 3 levels  Up: 2 FINITE DIFFERENCES  Next: 2.4 Leap-frog, staggered grids

back up next contents bibliography Copyright © Lifelong-learners at 03:10:00, October 21st, 2017