FD1D_ADVECTION_LAX_WENDROFF is a MATLAB program which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax-Wendroff method.
The Lax-Wendroff method is a modification to the Lax method with improved accuracy.
We solve the constant-velocity advection equation in 1D,
du/dt = - c du/dxover the interval:
0.0 <= x <= 1.0with periodic boundary conditions, and with a given initial condition
u(0,x) = (10x-4)^2 (6-10x)^2 for 0.4 <= x <= 0.6 = 0 elsewhere.
For our simple case, the advection velocity is constant in time and space. Therefore, (given our periodic boundary conditions), the solution should simply move smoothly from left to right, returning on the left again. While the Lax method produces an artificial smearing of the solution because of an artificial viscosity effect, this behavior is much reduced for the Lax-Wendroff method.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
FD1D_ADVECTION_LAX_WENDROFF is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
FD1D_ADVECTION_DIFFUSION_STEADY, a MATLAB program which applies the finite difference method to solve the steady advection diffusion equation v*ux-k*uxx=0 in one spatial dimension, with constant velocity v and diffusivity k.
FD1D_ADVECTION_FTCS, a MATLAB program which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the forward time, centered space (FTCS) difference method.
FD1D_ADVECTION_LAX, a MATLAB program which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax method.
fd1d_advection_lax_wendroff, a MATLAB program which applies the finite difference method (FDM) to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax-Wendroff method to treat the time derivative.
fd1d_advection_lax_wendroff_test
FD1D_BURGERS_LAX, a MATLAB program which applies the finite difference method and the Lax-Wendroff method to solve the non-viscous time-dependent Burgers equation in one spatial dimension.
FD1D_BVP, a MATLAB program which applies the finite difference method to a two point boundary value problem in one spatial dimension.
FD1D_HEAT_EXPLICIT, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_IMPLICIT, a MATLAB program which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_STEADY, a MATLAB program which uses the finite difference method to solve the steady (time independent) heat equation in 1D.
FD1D_PREDATOR_PREY, a MATLAB program which implements a finite difference algorithm for predator-prey system with spatial variation in 1D.
FD1D_WAVE, a MATLAB program which applies the finite difference method to solve the time-dependent wave equation utt = c * uxx in one spatial dimension.