3 The first time-step

In the Example and Task above we have seen how time-steps can be carried out 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 ) ,

but there remains one issue which, so far, we have neglected. How do we carry out the first time-step?

3.1 Initial conditions

The initial time-step must use information from the two initial conditions

u ( x , 0 ) = f ( x ) u t ( x , 0 ) = g ( x ) 0 x

The first initial condition is easy enough to interpret. It gives u j n in the case where n = 0 . In fact

u j 0 = f j

where f j is simply shorthand for f ( j × δ x ) .

The second initial condition, the one involving g , gives information about u t = u t at t = 0 . We can approximate the t -derivative of u at t = 0 and x = j × δ x by a central difference to write

u j 1 u j 1 2 δ t = g j

in which g j is shorthand for g ( j × δ x ) .

This last expression involves u j 1 which, if it has a meaning at all, refers to u at time t = δ t , that is, before the initial time t = 0 . One way to think of u j 1 is simply as an artificial quantity which proves useful later on. The equation above, rearranged for u j 1 is

u j 1 = u j 1 2 δ t × g j

Key Point 23

A central difference used to approximate the first derivative in the condition defining initial speed gives rise to the following useful equation

u j 1 = u j 1 2 δ t × g j

3.2 The first time-step

To carry out the first time-step we put n = 0 in 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 ,

to give

u j 1 = 2 u j 0 u j 1 + μ 2 u j + 1 0 2 u j 0 + u j 1 0 .

Those terms on the right-hand side with a 0 superscript are known via the function f since we know that u j 0 = f j . Hence

u j 1 = 2 f j u j 1 + μ 2 f j + 1 2 f j + f j 1 .

And the u j 1 term is dealt with using the Key Point above to give

u j 1 = 2 f j u j 1 + 2 δ t × g j + μ 2 f j + 1 2 f j + f j 1 .

and therefore, moving the latest appearance of u j 1 over to the left-hand side and dividing by 2,

u j 1 = f j + δ t × g j + 1 2 μ 2 f j + 1 2 f j + f j 1 = 1 2 μ 2 f j 1 + f j + 1 + ( 1 μ 2 ) f j + δ t × g j
Key Point 24

The first time-step is carried out by using the initial data and can be summarised as

u j 1 = 1 2 μ 2 f j 1 + f j + 1 + ( 1 μ 2 ) f j + δ t × g j

Example 19

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 may be summarised as

f 0 = 0.0000 g 0 = 0.0000 f 1 = 0.6000 g 1 = 0.1000 f 2 = 0.0000 g 2 = 0.2000 f 3 = 0.5000 g 3 = 0.1000 f 4 = 0.0000 g 4 = 0.0000

The application is such that the wave speed c = 1 .

Carry out the first two time-steps of 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 in which δ x = 0.25 and δ t = 0.2 .

Solution

In this case μ = 1 × 0.2 0.25 = 0.8 and the first time-step is carried out as follows (to 4 d.p.):

u 0 1 = 0 from the boundary condition u 1 1 = 1 2 μ 2 ( f 0 + f 2 ) + ( 1 μ 2 ) f 1 + δ t g 1 = 0.2360 u 2 1 = 1 2 μ 2 ( f 1 + f 3 ) + ( 1 μ 2 ) f 2 + δ t g 2 = 0.0720 u 3 1 = 1 2 μ 2 ( f 2 + f 4 ) + ( 1 μ 2 ) f 3 + δ t g 3 = 0.0160 u 4 1 = 0 from the boundary condition

The second time-step is as follows (to 4 d.p.):

u 0 2 = 0 from the boundary condition u 1 2 = 2 u 1 1 u 1 0 + μ 2 ( u 2 1 2 u 1 1 + u 0 1 ) = 0.3840 u 2 2 = 2 u 2 1 u 2 0 + μ 2 ( u 3 1 2 u 2 1 + u 1 1 ) = 0.1005 u 3 2 = 2 u 3 1 u 3 0 + μ 2 ( u 4 1 2 u 3 1 + u 2 1 ) = 0.4309 u 4 2 = 0 from the boundary condition
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 < 0.8 . It is given that u satisfies boundary conditions u ( 0 , t ) = u ( 0.8 , t ) = 0 ( t > 0 ) and initial conditions that may be summarised as

f 0 = 0.0000 g 0 = 0.0000 f 1 = 0.1703 g 1 = 0.4227 f 2 = 0.2364 g 2 = 0.5417 f 3 = 0.1703 g 3 = 0.4227 f 4 = 0.0000 g 4 = 0.0000

The application is such that the wave speed c = 1 .

Carry out the first two time-steps of 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 in which δ x = 0.2 and δ t = 0.11 .

In this case μ = 1 × 0.11 0.2 = 0.55 and the first time-step is carried out as follows:

u 0 1 = 0 from the boundary condition u 1 1 = 1 2 μ 2 ( f 0 + f 2 ) + ( 1 μ 2 ) f 1 + δ t g 1 = 0.2010 u 2 1 = 1 2 μ 2 ( f 1 + f 3 ) + ( 1 μ 2 ) f 2 + δ t g 2 = 0.2760 u 3 1 = 1 2 μ 2 ( f 2 + f 4 ) + ( 1 μ 2 ) f 3 + δ t g 3 = 0.2010 u 4 1 = 0 from the boundary condition

The second time-step is as follows:

u 0 2 = 0 from the boundary condition u 1 2 = 2 u 1 1 u 1 0 + μ 2 ( u 2 1 2 u 1 1 + u 0 1 ) = 0.1936 u 2 2 = 2 u 2 1 u 2 0 + μ 2 ( u 3 1 2 u 2 1 + u 1 1 ) = 0.2702 u 3 2 = 2 u 3 1 u 3 0 + μ 2 ( u 4 1 2 u 3 1 + u 2 1 ) = 0.1936 u 4 2 = 0 from the boundary condition