Wave equations

Linear wave equation in 1D

The standard, linear wave equation in 1D for a function u(x,t) reads

2ut2=c22ux2+f(x,t),x(0,L), t(0,T],

where c is the constant wave velocity of the physical medium in [0,L]. The equation can also be more compactly written as

utt=c2uxx+f,x(0,L), t(0,T],

Centered, second-order finite differences are a natural choice for discretizing the derivatives, leading to

\begin{align}\begin{aligned}\tag{723} [D_t D_t u = c^2 D_xD_x u + f]^n_i\\    {\thinspace .}\end{aligned}\end{align}

Inserting the exact solution ue(x,t) in (723) makes this function fulfill the equation if we add the term R:

[DtDtue=c2DxDxue+f+R]ni

Our purpose is to calculate the truncation error R. From (670)-(671) we have that

[DtDtue]ni=ue,tt(xi,tn)+112ue,tttt(xi,tn)Δt2+O(Δt4),

when we use a notation taking into account that ue is a function of two variables and that derivatives must be partial derivatives. The notation ue,tt means 2ue/t2.

The same formula may also be applied to the x-derivative term:

[DxDxue]ni=ue,xx(xi,tn)+112ue,xxxx(xi,tn)Δx2+O(Δx4),

Equation (724) now becomes

ue,tt+112ue,tttt(xi,tn)Δt2=c2ue,xx+c2112ue,xxxx(xi,tn)Δx2+f(xi,tn)+O(Δt4,Δx4)+Rni.

Because ue fulfills the partial differential equation (PDE) (722), the first, third, and fifth term cancel out, and we are left with

Rni=112ue,tttt(xi,tn)Δt2c2112ue,xxxx(xi,tn)Δx2+O(Δt4,Δx4),

showing that the scheme (723) is of second order in the time and space mesh spacing.

Finding correction terms

Can we add correction terms to the PDE and increase the order of Rni in (725)? The starting point is

[DtDtue=c2DxDxue+f+C+R]ni

From the previous analysis we simply get (725) again, but now with C:

Rni+Cni=112ue,tttt(xi,tn)Δt2c2112ue,xxxx(xi,tn)Δx2+O(Δt4,Δx4).

The idea is to let Cni cancel the Δt2 and Δx2 terms to make Rni=O(Δt4,Δx4):

Cni=112ue,tttt(xi,tn)Δt2c2112ue,xxxx(xi,tn)Δx2.

Essentially, it means that we add a new term

C=112(uttttΔt2c2uxxxxΔx2),

to the right-hand side of the PDE. We must either discretize these 4th-order derivatives directly or rewrite them in terms of lower-order derivatives with the aid of the PDE. The latter approach is more feasible. From the PDE we have the operator equality

2t2=c22x2,

so

utttt=c2uxxtt,uxxxx=c2uttxx.

Assuming u is smooth enough, so that uxxtt=uttxx, these relations lead to

C=112((c2Δt2Δx2)uxx)tt.

A natural discretization is

Cni=112((c2Δt2Δx2)[DxDxDtDtu]ni.

Writing out [DxDxDtDtu]ni as [DxDx(DtDtu)]ni gives

1Δt2(un+1i+12uni+1+un1i+1Δx22un+1i2uni+un1iΔx2+un+1i12uni1+un1i1Δx2)

Now the unknown values un+1i+1, un+1i, and un+1i1 are coupled, and we must solve a tridiagonal system to find them. This is in principle straightforward, but it results in an implicit finite difference schemes, while we had a convenient explicit scheme without the correction terms.

Extension to variable coefficients

Now we address the variable coefficient version of the linear 1D wave equation,

2ut2=x(λ(x)ux),

or written more compactly as

utt=(λux)x.

The discrete counterpart to this equation, using arithmetic mean for λ and centered differences, reads

[DtDtu=Dx¯λxDxu]ni.

The truncation error is the residual R in the equation

[DtDtue=Dx¯λxDxue+R]ni.

The difficulty with (730) is how to compute the truncation error of the term [Dx¯λxDxue]ni.

We start by writing out the outer operator:

[Dx¯λxDxue]ni=1Δx([¯λxDxue]ni+12[¯λxDxue]ni12).

With the aid of (658)-(659) and (674)-(675) we have

[Dxue]ni+12=ue,x(xi+12,tn)+124ue,xxx(xi+12,tn)Δx2+O(Δx4),[¯λx]i+12=λ(xi+12)+18λ

where we have introduced the short form

G^n_{i+\frac{1}{2}} = (\frac{1}{24}{u_{\small\mbox{e}, xxx}}(x_{i+\frac{1}{2}},t_n)\lambda((x_{i+\frac{1}{2}}) + {u_{\small\mbox{e}, x}}(x_{i+\frac{1}{2}},t_n) \frac{1}{8}\lambda''(x_{i+\frac{1}{2}}))\Delta x^2{\thinspace .}

Similarly, we find that

\lbrack\overline{\lambda}^{x}D_x {u_{\small\mbox{e}}}\rbrack^n_{i-\frac{1}{2}} = [\lambda {u_{\small\mbox{e}, x}}]^n_{i-\frac{1}{2}} + G^n_{i-\frac{1}{2}}\Delta x^2 +{\mathcal{O}(\Delta x^4)}{\thinspace .}

Inserting these expressions in the outer operator (731) results in

\begin{split}\begin{align*} \lbrack D_x \overline{\lambda}^{x}D_x {u_{\small\mbox{e}}} \rbrack^n_i &= \frac{1}{\Delta x}( [\overline{\lambda}^{x}D_x {u_{\small\mbox{e}}}]^n_{i+\frac{1}{2}} - [\overline{\lambda}^{x}D_x {u_{\small\mbox{e}}}]^n_{i-\frac{1}{2}} )\\ &= \frac{1}{\Delta x}( [\lambda {u_{\small\mbox{e}, x}}]^n_{i+\frac{1}{2}} + G^n_{i+\frac{1}{2}}\Delta x^2 - [\lambda {u_{\small\mbox{e}, x}}]^n_{i-\frac{1}{2}} - G^n_{i-\frac{1}{2}}\Delta x^2 + {\mathcal{O}(\Delta x^4)} )\\ &= [D_x \lambda {u_{\small\mbox{e}, x}}]^n_i + [D_x G]^n_i\Delta x^2 + {\mathcal{O}(\Delta x^4)}{\thinspace .} \end{align*}\end{split}

The reason for {\mathcal{O}(\Delta x^4)} in the remainder is that there are coefficients in front of this term, say H\Delta x^4, and the subtraction and division by \Delta x results in [D_x H]^n_i\Delta x^4.

We can now use (658)-(659) to express the D_x operator in [D_x \lambda {u_{\small\mbox{e}, x}}]^n_i as a derivative and a truncation error:

[D_x \lambda {u_{\small\mbox{e}, x}}]^n_i = \frac{\partial}{\partial x}\lambda(x_i){u_{\small\mbox{e}, x}}(x_i,t_n) + \frac{1}{24}(\lambda{u_{\small\mbox{e}, x}})_{xxx}(x_i,t_n)\Delta x^2 + {\mathcal{O}(\Delta x^4)}{\thinspace .}

Expressions like [D_x G]^n_i\Delta x^2 can be treated in an identical way,

[D_x G]^n_i\Delta x^2 = G_x(x_i,t_n)\Delta x^2 + \frac{1}{24}G_{xxx}(x_i,t_n)\Delta x^4 + {\mathcal{O}(\Delta x^4)}{\thinspace .}

There will be a number of terms with the \Delta x^2 factor. We lump these now into {\mathcal{O}(\Delta x^2)}. The result of the truncation error analysis of the spatial derivative is therefore summarized as

[D_x \overline{\lambda}^{x}D_x {u_{\small\mbox{e}}}]^n_i = \frac{\partial}{\partial x} \lambda(x_i){u_{\small\mbox{e}, x}}(x_i,t_n) + {\mathcal{O}(\Delta x^2)}{\thinspace .}

After having treated the [D_tD_t{u_{\small\mbox{e}}}]^n_i term as well, we achieve

R^n_i = {\mathcal{O}(\Delta x^2)} + \frac{1}{12}{u_{\small\mbox{e}, tttt}}(x_i,t_n)\Delta t^2 {\thinspace .}

The main conclusion is that the scheme is of second-order in time and space also in this variable coefficient case. The key ingredients for second order are the centered differences and the arithmetic mean for \lambda: all those building blocks feature second-order accuracy.

1D wave equation on a staggered mesh

Linear wave equation in 2D/3D

The two-dimensional extension of (721) takes the form

\tag{732} \frac{\partial^2 u}{\partial t^2} = c^2\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right) + f(x,y,t),\quad (x,y)\in (0, L)\times (0,H),\ t\in (0,T],

where now c(x,y) is the constant wave velocity of the physical medium [0,L]\times [0,H]. In the compact notation, the PDE (732) can be written

\tag{733} u_{tt} = c^2(u_{xx} + u_{yy}) + f(x,y,t),\quad (x,y)\in (0, L)\times (0,H), \ t\in (0,T],

in 2D, while the 3D version reads

\tag{734} u_{tt} = c^2(u_{xx} + u_{yy} + u_{zz}) + f(x,y,z,t),

for (x,y,z)\in (0, L)\times (0,H)\times (0,B) and t\in (0,T].

Approximating the second-order derivatives by the standard formulas (670)-(671) yields the scheme

\tag{735} [D_t D_t u = c^2(D_xD_x u + D_yD_y u) + f]^n_{i,j,k} {\thinspace .}

The truncation error is found from

\tag{736} [D_t D_t {u_{\small\mbox{e}}} = c^2(D_xD_x {u_{\small\mbox{e}}} + D_yD_y {u_{\small\mbox{e}}}) + f + R]^n {\thinspace .}

The calculations from the 1D case can be repeated to the terms in the y and z directions. Collecting terms that fulfill the PDE, we end up with

\tag{737} R^n_{i,j,k} = [\frac{1}{12}{u_{\small\mbox{e}, tttt}}\Delta t^2 - c^2\frac{1}{12}\left( {u_{\small\mbox{e}, xxxx}}\Delta x^2 + {u_{\small\mbox{e}, yyyy}}\Delta x^2 + {u_{\small\mbox{e}, zzzz}}\Delta z^2\right)]^n_{i,j,k} +
\quad {\mathcal{O}(\Delta t^4,\Delta x^4,\Delta y^4,\Delta z^4)}\nonumber {\thinspace .}