Interactive Educational Modules in
Scientific Computing

Wave Equation

This module illustrates fully discrete finite difference methods for numerically solving the wave equation. The wave equation in one dimension is the partial differential equation utt = c uxx, where the solution u(t, x) is a function of the time variable t and the spatial variable x, and subscripts indicate partial differentiation with respect to the given independent variable. Considering the wave equation as an initial-boundary value problem, the equation is defined for any x in a given interval [a, b] and any nonnegative t. The initial conditions are given by u(0, x) = f(x) and ut(0, x) = g(x) for some specified functions f and g. Boundary conditions are given by u(t, a) = h(t) and u(t, b) = k(t) for functions h and k. For simplicity, here we take c = 1, a = −1, b = 1, and h(t) = k(t) = 0.

The user begins by selecting initial conditions f and g. The initial function f is plotted over the interval [−1, 1]. Next the user chooses a fully discrete finite difference method to apply to the wave equation. The stencil of the method is shown below the list of methods, with the points being computed colored red, the points it depends on colored blue, and the remaining points colored black. Finally, the user specifies the step sizes in space and time for the discrete mesh of points used in the finite difference method. The stability limit shown below gives, for the chosen space step size, the restriction on the size of the time step in order for the numerical method to be stable. A value of infinity indicates unconditional stability. If the chosen time step violates the displayed restriction, the numerical solution may oscillate wildly and bear little resemblance to the true solution.

To view the numerical solution, the user chooses between two-dimensional and three-dimensional display modes and clicks Start. The approximate solution is advanced time step by time step, and the plot of the solution is updated accordingly. In two-dimensional display mode, the solution at the current time is plotted as a curve on the spatial interval [−1, 1], and solution values at each new time step replace those at the previous time step. The approximate solution is shown in green, and the exact solution is shown in red for comparison. In three-dimensional display mode, the approximate solution is plotted as a surface over the space-time plane, and solution values at each new time step are added to the existing graph, extending it forward along the time axis. For both display modes, the solution continues to advance until the time t = 2.5 is reached or the user clicks Stop. When the solution process is stopped before t = 2.5, it can be resumed by again clicking Start. Clicking Reset clears any solution that may be partially calculated and redisplays the initial condition, allowing the user to select different initial conditions, a different solution method, or different step sizes.

Information about the finite difference methods implemented in this module can be found in the references mentioned below. The standard method is discussed in Heath [1], the explicit and implicit 2-4 methods are discussed by Strikwerda [2], and the stable implicit method is discussed by Evans, Blackledge, and Yardley [3].

References:

  1. Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 11.2.2, especially Figure 11.5 and Example 11.3.
  2. John C. Strikwerda, Finite Difference Schemes and Partial Differential Equations, SIAM, Philadelphia, 2004. See Section 8.2.
  3. G. Evans, J. Blackledge, and P. Yardley, Numerical Methods for Partial Differential Equations Springer, New York, 2000. See Section 3.4.

Developers: Evan VanderZee and Michael Heath