Skip to article frontmatterSkip to article content

The wave equation

A close cousin of the advection equation is the wave equation.

The wave equation describes the propagation of waves, such as for sound or light. This is our first PDE having a second derivative in time. Consequently, we should expect to have two initial conditions:

u(x,0)=f(x),ut(x,0)=g(x).\begin{split} u(x,0) &= f(x), \\ u_t(x,0) &= g(x). \end{split}

There are also two space derivatives, so if boundaries are present, two boundary conditions are required.

In the absence of boundaries, u(x,t)=ϕ(xct)u(x,t)=\phi(x-ct) is a solution of (12.4.1), just as it is for the advection equation. Now, though, so is u(x,t)=ϕ(x+ct)u(x,t)=\phi(x+c t) for any twice-differentiable ϕ (see Exercise 12.4.2).

12.4.1First-order system

In order to apply semidiscretization with the standard IVP solvers that we have encountered, we must recast (12.4.1) as a first-order system in time. Using our typical methodology, we would define y=uty=u_t and derive

ut=y,yt=c2uxx.\begin{split} u_t &= y, \\ y_t &= c^2 u_{xx}. \end{split}

This is a valid approach. However, the wave equation has another, less obvious option for transforming to a first-order system:

ut=zx,zt=c2ux.\begin{split} u_t &= z_x, \\ z_t &= c^2 u_{x}. \end{split}

This second form is appealing in part because it’s equivalent to Maxwell’s equations for electromagnetism. In this form, we typically replace the velocity initial condition in (12.4.2) with a condition on zz,

u(x,0)=f(x),z(x,0)=g(x).\begin{split} u(x,0) &= f(x), \\ z(x,0) &= g(x). \end{split}

This alternative to (12.4.2) is useful in many electromagnetic applications, where uu and zz represent the electric and magnetic fields, respectively.

12.4.2Semidiscretization

Because waves travel in both directions, there is no preferred upwind direction. This makes a centered finite difference in space appropriate. Before application of the boundary conditions, semidiscretization of (12.4.4) leads to

[u(t)z(t)]=[0Dxc2Dx0][u(t)z(t)]. \begin{bmatrix} \mathbf{u}'(t) \\[2mm] \mathbf{z}'(t) \end{bmatrix} = \begin{bmatrix} \boldsymbol{0} & \mathbf{D}_x \\[2mm] c^2 \mathbf{D}_x & \boldsymbol{0} \end{bmatrix} \begin{bmatrix} \mathbf{u}(t) \\[2mm] \mathbf{z}(t) \end{bmatrix}.

We now suppose that the domain is [0,1][0,1] and impose the Dirichlet conditions

u(0,t)=u(1,t)=0,t0.u(0,t) = u(1,t) = 0, \qquad t \ge 0.

The boundary conditions (12.4.7) suggest that we should remove both of the end values of u\mathbf{u} from the discretization, but retain all the z\mathbf{z} values. We use w(t)\mathbf{w}(t) to denote the vector of all the unknowns in the semidiscretization. If the nodes are numbered x0,,xmx_0,\ldots,x_m, then we have

w(t)=[u1(t)um1(t)z0(t)zm(t)]=[v(t)z(t)]R2m.\mathbf{w}(t) = \begin{bmatrix} u_1(t) \\ \vdots \\ u_{m-1}(t) \\ z_0(t) \\ \vdots \\ z_m(t) \end{bmatrix} = \begin{bmatrix} \mathbf{v}(t) \\[1mm] \mathbf{z}(t) \end{bmatrix} \in \mathbb{R}^{2m}.

When computing w(t)\mathbf{w}'(t), we extract the v\mathbf{v} and z\mathbf{z} components, and we define two helper functions: extend, which pads the v\mathbf{v} component with the zero end values, and chop, which deletes them from u\mathbf{u} to give v\mathbf{v}.

12.4.3Variable speed

An interesting situation is when the wave speed cc in (12.4.1) changes discontinuously, as when light passes from one material into another. For this we must replace the term c2c^2 in (12.4.6) with the matrix diag(c2(x0),,c2(xm))\operatorname{diag}\bigl(c^2(x_0),\ldots,c^2(x_m)\bigr).

12.4.4Exercises