2 Numerical solutions

The approach we will adopt is similar to that seen in Section 32.4 where we looked at parabolic equations. We use the notation

u j n

to denote an approximation to u evaluated at x = j × δ x , t = n × δ t . Approximating the derivatives in the PDE

u t t = c 2 u x

by central differences we obtain the numerical difference equation

u j n + 1 2 u j n + u j n 1 ( δ t ) 2 = c 2 u j + 1 n 2 u j n + u j 1 n ( δ x ) 2 .

Multiplying through by ( δ t ) 2 this can be rearranged to give

u j n + 1 = 2 u j n u j n 1 + μ 2 ( u j + 1 n 2 u j n + u j 1 n )

in which μ = c δ t δ x is called the Courant number.

The equation above gives u j n + 1 in terms of u -approximations at earlier time-steps (that is, all the appearances of u on the right-hand side have a superscript smaller than n + 1 ).

Figure 9

A grid diagram illustrating a stencil operation with arrows pointing from adjacent points to a central point.

Long description

Thinking of the numerical stencil graphically we have the situation shown above. We may think of the values on the right-hand side of the equation “pointing to" a new value on the left-hand side.

Key Point 22

Timesteps (other than the first one) are carried out by using the numerical stencil

u j n + 1 = 2 u j n u j n 1 + μ 2 ( u j + 1 n 2 u j n + u j 1 n ) “new" approximation “old" approximations at at  ( n + 1 ) th   time-step earlier time-steps

(We will deal with how to carry out the first time-step shortly.)

The time-stepping process has much in common with the corresponding procedure for parabolic problems. The following Example will help establish the general idea.

Example 18

Given that u = u ( x , t ) satisfies the wave equation u t t = c 2 u x x in t > 0 and 0 < x < 1 with boundary conditions u ( 0 , t ) = u ( 1 , t ) = 0 ( t > 0 ) with wave speed c = 1.2 .

The numerical method    u j n + 1 = 2 u j n u j n 1 + μ 2 ( u j + 1 n 2 u j n + u j 1 n )   where μ = c δ t δ x , is implemented using δ x = 0.25 and δ t = 0.1 .

Suppose that, after 5 time-steps, the following data forms part of the numerical solution:

u 0 4 = 0.0000 u 0 5 = 0.0000 u 1 4 = 0.9242 u 1 5 = 0.7110 u 2 4 = 0.0020 u 2 5 = 0.0059 u 3 4 = 0.9624 u 3 5 = 0.7409 u 4 4 = 0.0000 u 4 5 = 0.0000

Carry out the next time-step so as to find an approximation to u at t = 6 δ t .

Solution

In this case μ = 1.2 × 0.1 0.25 = 0.48 and the required time-step is carried out as follows:

u 0 6 = 0 from the boundary condition u 1 6 = 2 u 1 5 u 1 4 + μ 2 ( u 2 5 2 u 1 5 + u 0 5 ) = 0.1689 u 2 6 = 2 u 2 5 u 2 4 + μ 2 ( u 3 5 2 u 2 5 + u 1 5 ) = 0.0140 u 3 6 = 2 u 3 5 u 3 4 + μ 2 ( u 4 5 2 u 3 5 + u 2 5 ) = 0.1794 u 4 6 = 0 from the boundary condition

to 4 decimal places and these are the approximations to u ( 0 , 6 δ t ) , u ( 0.25 , 6 δ t ) , u ( 0.5 , 6 δ t ) , u ( 0.75 , 6 δ t ) and u ( 1 , 6 δ t ) , respectively.

The diagram below shows the numerical results that appeared in the example above. It can be seen that the example was a (rather coarse) model of a standing wave with two antinodes.

Figure 10

A line graph illustrating the behavior of a function, denoted by \(u\), as a function of \(x\) for different values of \(n\) (specifically \(n=4, 5, \text{ and } 6\)).

Long description
Task!

Suppose that u = u ( x , t ) satisfies the wave equation u t t = c 2 u x x in t > 0 and 0 < x < 1 . It is given that u satisfies boundary conditions u ( 0 , t ) = u ( 1 , t ) = 0 ( t > 0 ) and initial conditions that need not be stated for the purposes of this question. The application is such that the wave speed c = 1.2 .

The numerical method u j n + 1 = 2 u j n u j n 1 + μ 2 ( u j + 1 n 2 u j n + u j 1 n )   where μ = c δ t δ x , is implemented using δ x = 0.25 and δ t = 0.2 .

Suppose that, after 8 time-steps, the following data forms part of the numerical solution:

u 0 7 = 0.0000 u 0 8 = 0.0000 u 1 7 = 0.6423 u 1 8 = 0.4640 u 2 7 = 0.8976 u 2 8 = 0.6792 u 3 7 = 0.6789 u 3 8 = 0.4668 u 4 7 = 0.0000 u 4 8 = 0.0000

Carry out the next time-step so as to find an approximation to u at t = 9 δ t .

In this case μ = 1.2 × 0.2 0.25 = 0.96 and the required time-step is carried out as follows:

u 0 9 = 0 from the boundary condition u 1 9 = 2 u 1 8 u 1 7 + μ 2 ( u 2 8 2 u 1 8 + u 0 8 ) = 0.0564 u 2 9 = 2 u 2 8 u 2 7 + μ 2 ( u 3 8 2 u 2 8 + u 1 8 ) = 0.0667 u 3 9 = 2 u 3 8 u 3 7 + μ 2 ( u 4 8 2 u 3 8 + u 2 8 ) = 0.0202 u 4 9 = 0 from the boundary condition

to 4 decimal places and these are the approximations to u ( 0 , 9 δ t ) , u ( 0.25 , 9 δ t ) , u ( 0.5 , 9 δ t ) , u ( 0.75 , 9 δ t ) and u ( 1 , 9 δ t ) , respectively.

The above Task concerns a stretched string oscillating in such a way that at the 9 th time-step the string is approximately flat. The motion continues with u taking negative values. Figure 11 below uses data calculated above, and also data for the next two time-steps so as to show subsequent progress of the solution.

Figure 11

A line graph illustrating multiple curves, labeled with different values of 'n', showing how a function u changes with x from 0 to 1.

Long description