Unit 4
Unit 4
4.1 Introduction
We begin our study of finite difference methods for partial differential equations by considering
the important class of partial differential equations called hyperbolic equations.
In mathematics, a hyperbolic partial differential equation has a well-posed initial value
problem. The wave equation is an important second-order linear partial differential
equation for the description of waves—as they occur in classical physics—such as mechanical
waves (e.g. water waves, sound waves and seismic waves) or light waves. It arises in fields
like acoustics, electromagnetics, and fluid dynamics.
Historically, the problem of a vibrating string such as that of a musical instrument was studied
by Jean le Rond d'Alembert, Leonhard Euler, Daniel Bernoulli, and Joseph-Louis Lagrange. In
1746, d’Alembert discovered the one-dimensional wave equation, and within ten years Euler
discovered the three-dimensional wave equation.
We begin this chapter by considering the simplest hyperbolic equation which is called wave
equation. The wave equation 𝑢𝑡𝑡 = 𝑐 2 𝑢𝑥𝑥 which models the vibrations of a string in one
dimension 𝑢 = 𝑢(𝑥, 𝑡), the vibrations of a thin membrane in two dimensions
𝑢 = 𝑢(𝑥, 𝑦, 𝑡) or the pressure vibrations of an acoustic wave in air 𝑢 = 𝑢(𝑥, 𝑦, 𝑧, 𝑡). The
constant c gives the speed of propagation for the vibrations.
1 𝑛−1 𝑛 𝑛+1 𝑐2 𝑛
(𝑢 − 2𝑢 + 𝑢 ) = (𝑢 − 2𝑢𝑖𝑛 + 𝑢𝑖+1
𝑛
)
𝑘2 𝑖 𝑖 𝑖
ℎ2 𝑖−1
𝑐 2𝑘2
Taking 𝜆2 = ℎ2
Equation (4.1) shows that the function values at the nth and (n-1)th time level are required
to determine those at the (n+1)th time level. Such difference schemes are called three level
difference schemes compared to the two level schemes derived in the parabolic case.
Equation (4.1) is also called the explicit scheme.
Formula (4.1) holds good if 𝜆2 ≤ 1, which is the condition for stability.
Example 1
Solve the equation 𝑢𝑡𝑡 = 𝑢𝑥𝑥 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0, 𝑡 > 0 and
1
𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 𝑠𝑖𝑛3 (𝜋𝑥), 0 ≤ 𝑥 ≤ 1 using Explicit method. Taking ℎ = 4 ,
3
𝑘 = 0.2. This solution has an exact solution given by 𝑢(𝑥, 𝑡) = 𝑠𝑖𝑛 𝜋𝑥 𝑐𝑜𝑠 𝜋𝑡 −
4
1
𝑠𝑖𝑛 3𝜋𝑥 𝑐𝑜𝑠 3𝜋𝑡 . Find the error.
4
Solution:
1 𝑐𝑘 0.2
Let ℎ = 4 , 𝑘 = 0.25 then 𝜆 = = = 0.8, so 𝜆2 = 0.64 < 1 (Stability condition).
ℎ 0.25
3 0 3
3𝜋 1 3
𝑢( , 0) = 𝑢3 = 𝑠𝑖𝑛 ( ) = ( ) = 0.3536
4 4 √2
From the other boundary condition 𝑢𝑡 (𝑥, 0) = 0
𝑢𝑖𝑛+1 −𝑢𝑖𝑛−1
➢ ( ) =0
2𝑘 𝑛=0
➢ 𝑢𝑖−1 = 𝑢𝑖1
0 0
➢ 𝑢𝑖1 = −𝑢𝑖−1 + 0.64(𝑢𝑖−1 + 𝑢𝑖+1 ) + 0.72𝑢𝑖0 (since 𝑢𝑖−1 = 𝑢𝑖1 )
0 0
➢ 𝑢𝑖1 = 0.32(𝑢𝑖−1 + 𝑢𝑖+1 ) + 0.36𝑢𝑖0 4.3
Putting 𝑖 = 1, 2, 3
𝑢11 = 0.32(𝑢00 + 𝑢20 ) + 0.36𝑢10
= 0.32 (0 + 1) + 0.36(0.3536)
= 0.4473
Similarly,
Example 2
Solve the boundary value problem defined by 𝑢𝑡𝑡 = 4 𝑢𝑥𝑥 subject to condition
𝑢(0, 𝑡) = 0, 𝑢(4, 𝑡) = 0, 𝑡 > 0 and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 4𝑥 − 𝑥 2 0 ≤ 𝑥 ≤ 1.
Assume 𝜆2 = 1.
Solution:
𝑐𝑘
Let ℎ = 1, then 𝜆 = = 1, so 𝑘 = 0.25.
ℎ
Here 0 ≤ 𝑥 ≤ 4, if ℎ = 1, then 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 1, 𝑥2 = 𝑥1 + ℎ = 2,
𝑥3 = 𝑥2 + ℎ = 3, 𝑥4 = 𝑥3 + ℎ = 4,
➢ 𝑢𝑖−1 = 𝑢𝑖1
0 0
➢ 𝑢𝑖1 = −𝑢𝑖1 + (𝑢𝑖−1 + 𝑢𝑖+1 ) (since 𝑢𝑖−1 = 𝑢𝑖1 )
0 1 0
➢ 𝑢𝑖1 = (𝑢𝑖−1 + 𝑢𝑖+1 ) 4.3
2
1
𝑢21 = 2 (𝑢10 + 𝑢30 ) = 3
1 𝑛−1 𝑛 𝑛+1 𝑐2 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛
(𝑢 − 2𝑢𝑖,𝑗 + 𝑢𝑖,𝑗 ) = 2 [(𝑢𝑖,𝑗−1 − 2𝑢𝑖,𝑗 + 𝑢𝑖,𝑗+1 ) + (𝑢𝑖,𝑗−1 − 2𝑢𝑖,𝑗 + 𝑢𝑖,𝑗+1 )]
𝑘 2 𝑖,𝑗 ℎ
𝑐 2𝑘2
Taking 𝜆2 = ℎ2
𝑛+1 𝑛−1 𝑛 𝑛 𝑛 𝑛 𝑛
➢ 𝑢𝑖,𝑗 = −𝑢𝑖,𝑗 + 𝜆2 (𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 ) + 2(1 − 2𝜆2 )𝑢𝑖,𝑗 (4.5)
Explicit method.
Solution:
From the boundary condition 𝑢(𝑥, 𝑦, 𝑡) = 0, we have
𝑛 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛
𝑢(0, 0, 𝑡) = 𝑢0,0 = 0, 𝑢1,0 = 𝑢2,0 = 𝑢3,0 = 0, 𝑢0,1 = 𝑢0,2 = 𝑢0,3 = 0,
𝑛 𝑛 𝑛 𝑛 𝑛 𝑛
𝑢3,1 = 𝑢3,2 = 𝑢3,3 = 0, 𝑢0,3 = 𝑢1,3 = 𝑢2,3 =0
0 0
0 U1,2 0
U2,2
0 0
U1,1 U2,1
0 0
1 −1
➢ For 𝑛 = 0, 𝑢𝑖,𝑗 = 𝑢𝑖,𝑗
Using Explicit scheme for two-dimensional wave equation
𝑛+1 𝑛−1 𝑛 𝑛 𝑛 𝑛 𝑛
𝑢𝑖,𝑗 = −𝑢𝑖,𝑗 + 𝜆2 (𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 ) + 2(1 − 2𝜆2 )𝑢𝑖,𝑗
1 −1
1 0 0 0 0 0
𝑢1,1 = −𝑢1,1 + (𝑢0,1 + 𝑢2,1 + 𝑢1,0 + 𝑢1,2 ) + 2(1 − 2𝜆2 )𝑢1,1
9
1 1 7
➢ 2𝑢1,1 = 9 (0 + 0.75 + 0 + 0.75) + 2. 9 (0.75)
1 2
➢ 𝑢1,1 =3
1 2
Similarly, 𝑢2,1 =3
1 𝑛−1 𝑛 𝑛+1 𝑐2
(𝑢 − 2𝑢 + 𝑢 ) = (𝑢𝑛 − 2𝑢𝑖𝑛 + 𝑢𝑖+1
𝑛 𝑛+1
+ 𝑢𝑖−1 − 2𝑢𝑖𝑛+1 + 𝑢𝑖+1
𝑛+1
)
𝑘2 𝑖 𝑖 𝑖
2ℎ2 𝑖−1
𝑛+1
➢ 𝜆2 𝑢𝑖−1 − 2(𝜆2 + 1)𝑢𝑖𝑛+1 + 𝜆2 𝑢𝑖+1
𝑛+1 𝑛
= −𝜆2 𝑢𝑖−1 + 2(𝜆2 − 2)𝑢𝑖𝑛 − 𝜆2 𝑢𝑖+1
𝑛
+ 2𝑢𝑖𝑛−1
𝑐 2𝑘2
where, 𝜆2 = ℎ2
Example 4
Solve the boundary value problem defined by 𝑢𝑡𝑡 = 4 𝑢𝑥𝑥 subject to condition
𝑢(0, 𝑡) = 0, 𝑢(4, 𝑡) = 0, 𝑡 > 0 and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 4𝑥 − 𝑥 2 0 ≤ 𝑥 ≤ 4. Use
implicit scheme. Assume 𝜆2 = 1.
Solution:
𝑐𝑘
Let ℎ = 1, then 𝜆 = = 1, so 𝑘 = 0.25.
ℎ
Here 0 ≤ 𝑥 ≤ 4, if ℎ = 1, then 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 1, 𝑥2 = 𝑥1 + ℎ = 2,
𝑥3 = 𝑥2 + ℎ = 3, 𝑥4 = 𝑥3 + ℎ = 4,
➢ 𝑢𝑖−1 = 𝑢𝑖1
Using Implicit scheme
𝑛+1
𝜆2 𝑢𝑖−1 − 2(𝜆2 + 1)𝑢𝑖𝑛+1 + 𝜆2 𝑢𝑖+1
𝑛+1 𝑛
= −𝜆2 𝑢𝑖−1 + 2(𝜆2 − 2)𝑢𝑖𝑛 − 𝜆2 𝑢𝑖+1
𝑛
+ 2𝑢𝑖𝑛−1
For 𝜆2 = 1,
𝑛+1
𝑢𝑖−1 − 4𝑢𝑖𝑛+1 + 𝑢𝑖+1
𝑛+1 𝑛
= −𝑢𝑖−1 − 2𝑢𝑖𝑛 − 𝑢𝑖+1
𝑛
+ 2𝑢𝑖𝑛−1
Putting 𝑛 = 0,
0
1
𝑢𝑖−1 − 4𝑢𝑖1 + 𝑢𝑖+1
1
= −𝑢𝑖−1 − 2𝑢𝑖0 − 𝑢𝑖+1
0
+ 2𝑢𝑖−1
0
1
➢ 𝑢𝑖−1 − 6𝑢𝑖1 + 𝑢𝑖+1
1
= −𝑢𝑖−1 − 2𝑢𝑖0 − 𝑢𝑖+1
0
(since 𝑢𝑖−1 = 𝑢𝑖1 )
Now putting 𝑖 = 1, we obtain,
putting 𝑖 = 2
𝑢11 − 6𝑢21 + 𝑢31 = −𝑢10 − 2𝑢20 − 𝑢30
Exercise:
1. Solve the equation 𝑢𝑡𝑡 = 𝑢𝑥𝑥 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0, 𝑡 > 0
and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = sin(𝜋𝑥) , 0 ≤ 𝑥 ≤ 1. Taking ℎ = 0.25,
𝑘 = 0.2, Compute 𝑢(0.5, 0.4) in two time steps and compare the result with exact
solution given by 𝑢(𝑥, 𝑡) = 𝑠𝑖𝑛 𝜋𝑥 𝑐𝑜𝑠 𝜋𝑡.
2. Solve the wave equation 𝑢𝑡𝑡 = 16 𝑢𝑥𝑥 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(5, 𝑡) = 0,
𝑡 > 0 and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 𝑥 2 (5 − 𝑥), 0 ≤ 𝑥 ≤ 5. Taking 𝜆1 = 1, integrate
upto two time steps.
3. Solve the wave equation 𝑢𝑡𝑡 = 𝑢𝑥𝑥 for 𝑥 = 0, 0.1, 0.2, 0.3, 0.4, 0.5 and
𝑡 = 0.1, 0.2 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0, 𝑡 > 0 and 𝑢𝑡 (𝑥, 0) =
1
0, 𝑢(𝑥, 0) = 8 sin(𝜋𝑥) , 0 ≤ 𝑥 ≤ 1.
4. Solve the wave equation 𝑢𝑡𝑡 = 16 𝑢𝑥𝑥 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(4, 𝑡) = 0,
𝑡 > 0 and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 100 𝑥 2 (4 − 𝑥), 0 ≤ 𝑥 ≤ 4.
Taking 𝜆1 = 1, integrate upto one-time step. Use Implicit scheme.
5. Solve the wave equation 𝑢𝑡𝑡 = 𝑢𝑥𝑥 subject to condition 𝑢(0, 𝑡) = 0, 𝑢(3, 𝑡) = 0,
1
𝑡 > 0 and 𝑢𝑡 (𝑥, 0) = 0, 𝑢(𝑥, 0) = 3𝑥(𝑥 − 3), 0 ≤ 𝑥 ≤ 3. Taking 𝜆 = 4,
Ans :
1. 𝑢22 = 𝑢(0.5, 0.4) = 0.320469, Exact 𝑢22 = 𝑢(0.5, 0.4) = 0.309017
2. 𝑢11 = 8, 𝑢21 = 10, 𝑢31 = 10, 𝑢41 = 2
𝑢12 = 6, 𝑢22 = 6, 𝑢32 = −6, 𝑢42 = −6
3. 𝑛 = 0, 0.031, 0.059, 0.082, 0.096, 0.101
𝑛 = 1, 0.023, 0.043, 0.059, 0.07, 0.074
4. 𝑢11 = −335.3, 𝑢21 = −611.6, 𝑢31 = −535.3
5. 𝑢11 = −5.811, 𝑢21 = −5.811, 𝑢12 = −5.25, 𝑢22 = −5.25
Bibliography
Balagurusamy, E., Numerical Methods, McGraw Hill, New Delhi, 1999.
Hildebrand, F. B., Introduction of Numerical Analysis, McGraw Hill, New York, 1956.
Jain M. K., Iyengar S. R. and Jain R. K., Numerical Methods for Scientific and Engineering
Computation, Wiley Eastern Limited, New Delhi, 1985.
Levy, H. and Baggott, E. A., Numerical Solution of Differential Equations, Dover, New York,
1950.
Sastry, S. S., Engineering Mathematics, 3rd eds., Vols., 1 and 2, Prentice-Hall of India, New
Delhi, 2004.
Sastry, S. S., Introductory Methods of Numerical Analysis, PHI, Fifth Edition, New Delhi,
2012.
Scheid, Francis, Theory and Problems of Numerical Analysis, Schaum Series, McGraw Hill,
New York, 1968.
G. Haribaskaran, Numerical methods, Laxmi Publications (P) LTD, New Delhi, Boston, USA,
2006.