0% found this document useful (0 votes)
13 views30 pages

Week 14

The document outlines the finite difference method for solving hyperbolic equations, specifically the wave equation. It includes definitions of forward, backward, and central difference formulas, as well as an example problem demonstrating the application of these methods with given boundary and initial conditions. The lesson aims to equip students with the skills to solve hyperbolic equations using numerical methods.

Uploaded by

nathannkole500
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views30 pages

Week 14

The document outlines the finite difference method for solving hyperbolic equations, specifically the wave equation. It includes definitions of forward, backward, and central difference formulas, as well as an example problem demonstrating the application of these methods with given boundary and initial conditions. The lesson aims to equip students with the skills to solve hyperbolic equations using numerical methods.

Uploaded by

nathannkole500
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

BMCG 1013

DIFFERENTIAL EQUATIONS

FINITE DIFFERENCE METHOD


(HYPERBOLIC EQUATION)

Ser Lee Loh


slloh@utem.edu.my
Lesson Outcomes

Upon completion of this lesson, students should be able to:


• solve hyperbolic equation using finite difference method
• apply finite difference method in wave equation

2
Second Order Linear Partial Differential Equation

Analytical Methods Numerical Methods: Finite Differences

- Separation of
variables
- Integral Parabolic Hyperbolic Elliptic
transform eqn. eqn. eqn.
- Characteristic
etc.

Exact solution Approximated solution


3
Recall: Difference Formulas
Forward-Difference Formula:
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗 𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗
= =
𝜕𝜕𝑡𝑡 𝑖𝑖,𝑗𝑗 𝑘𝑘 𝜕𝜕𝑥𝑥 𝑖𝑖,𝑗𝑗

Backward-Difference Formula:
𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖−1,𝑗𝑗
= =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 𝑘𝑘 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗

Central-Difference Formula:
𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖−1,𝑗𝑗
= =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 2𝑘𝑘 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2ℎ

𝜕𝜕 2 𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝜕𝜕 2 𝑢𝑢 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗


= =
𝜕𝜕𝑡𝑡 2 𝑖𝑖,𝑗𝑗
𝑘𝑘 2 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
ℎ2 4
5.4.3 Hyperbolic Equation – Wave Equation
Consider the Wave Equation:
𝜕𝜕 2 𝑢𝑢 2
𝜕𝜕 2
𝑢𝑢
= 𝑐𝑐 , 0 < 𝑥𝑥 < 𝑎𝑎, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 2
with boundary conditions
𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 𝑎𝑎, 𝑡𝑡 = 0, 𝑡𝑡 > 0
and initial conditions
𝑢𝑢 𝑥𝑥, 0 = 𝑓𝑓 𝑥𝑥 , 0 ≤ 𝑥𝑥 ≤ 𝑎𝑎
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 𝑔𝑔 𝑥𝑥 , 0 ≤ 𝑥𝑥 ≤ 𝑎𝑎
𝜕𝜕𝜕𝜕
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢

2 − 𝑐𝑐 2 =0
𝜕𝜕𝑡𝑡 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
is approximated to

𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝑢𝑢


2 𝑖𝑖+1,𝑗𝑗
− 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗
− 𝑐𝑐 =0
𝑘𝑘 2 ℎ2
5

where ℎ = ∆𝑥𝑥 and 𝑘𝑘 = ∆𝑡𝑡.


Example 5.19:
Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
=4 2, 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 1
and initial conditions
𝑢𝑢 𝑥𝑥, 0 = sin 2𝜋𝜋𝜋𝜋 , 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 4, 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝜕𝜕
1
by using the central-difference formula. Given ℎ = 0.5 and 𝑘𝑘 = .
3

6
Step 1: Sketch the grid points.
Recall:
𝑗𝑗 𝑡𝑡
0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 1
3 1 ℎ = 0.5 and 𝑘𝑘 = 1/3

2 2/3

1 1/3

0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 7
Step 2: Compute boundary and initial values.

𝒖𝒖 𝒙𝒙, 𝟎𝟎 = 𝐬𝐬𝐬𝐬𝐬𝐬 𝟐𝟐𝝅𝝅𝝅𝝅 , 𝟎𝟎 ≤ 𝒙𝒙 ≤ 𝟏𝟏 Recall:


𝑢𝑢 0, 0 = 0 ℎ = 0.5 and 𝑘𝑘 = 1/3
𝑢𝑢 0.5, 0 = 0
𝑢𝑢 1, 0 = 0

𝒖𝒖 𝟎𝟎, 𝒕𝒕 = 𝟎𝟎, 𝒖𝒖 𝟏𝟏, 𝒕𝒕 = 𝟎𝟎, 𝟎𝟎 ≤ 𝒕𝒕 ≤ 𝟏𝟏


𝑢𝑢 0, 0 = 0 𝑢𝑢 1, 0 = 0
𝑢𝑢 0, 0.3333 = 0 𝑢𝑢 1, 0.3333 = 0
𝑢𝑢 0, 0.6667 = 0 𝑢𝑢 1, 0.6667 = 0
𝑢𝑢 0, 1 = 0 𝑢𝑢 1, 1 = 0

8
Step 3: Fill in the values into the grid.

𝑦𝑦
𝑗𝑗
0 𝑢𝑢1,3 0
3 1

0 𝑢𝑢1,2
2 2/3 0

0 𝑢𝑢1,1
1 1/3 0

0 0 0
0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 9
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
=4 2 2 −4 2 =0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 𝜕𝜕𝑡𝑡 𝑖𝑖,𝑗𝑗
𝜕𝜕𝑥𝑥 𝑖𝑖,𝑗𝑗

Choose the required difference formula from the list:

10
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.

By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 Recall:
−4 =0
𝜕𝜕𝑡𝑡 2 𝑖𝑖,𝑗𝑗
𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗 ℎ = 0.5 and 𝑘𝑘 = 1/3
is approximated to

𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗


−4 =0
𝑘𝑘 2 ℎ2
4𝑘𝑘 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 = 2 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗

4 1/3 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 2𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
0.5 2
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9
11
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
Recall:
From the initial velocity, ℎ = 0.5 and 𝑘𝑘 = 1/3
𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 4 discretized 𝑥𝑥𝑖𝑖 , 0 = =4
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0

By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘

Choose the required difference formula from the list:

12
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula. Recall:
ℎ = 0.5 and 𝑘𝑘 = 1/3
From the initial velocity,
𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢
𝜕𝜕𝜕𝜕
𝑥𝑥, 0 = 4 discretized 𝜕𝜕𝜕𝜕
𝑥𝑥𝑖𝑖 , 0 =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0
=4

By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘
Hence,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,1 −𝑢𝑢𝑖𝑖,−1
= =4
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0 2(1/3)
is approximated to
𝑢𝑢𝑖𝑖,1 − 𝑢𝑢𝑖𝑖,−1 = 8/3
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 8/3

13
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 8/3

Let 𝑖𝑖 = 1, 𝑗𝑗 = 0,
16 14 16
𝑢𝑢1,1 = 𝑢𝑢0,0 − 𝑢𝑢1,0 + 𝑢𝑢2,0 − 𝑢𝑢1,−1
9 9 9
16 14 16 8
𝑢𝑢1,1 = (0) − (0) + (0) − (𝑢𝑢1,1 − )
9 9 9 3
2𝑢𝑢1,1 = 2.6667
𝑢𝑢1,1 = 1.3333

14
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9

Let 𝑖𝑖 = 1, 𝑗𝑗 = 1,
16 14 16
𝑢𝑢1,2 = 𝑢𝑢0,1 − 𝑢𝑢1,1 + 𝑢𝑢2,1 − 𝑢𝑢1,0
9 9 9
16 14 16
𝑢𝑢1,2 = (0) − (1.3333) + (0) − 0
9 9 9
𝑢𝑢1,2 = −2.0740

15
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9

Let 𝑖𝑖 = 1, 𝑗𝑗 = 2,
16 14 16
𝑢𝑢1,3 = 𝑢𝑢0,2 − 𝑢𝑢1,2 + 𝑢𝑢2,2 − 𝑢𝑢1,1
9 9 9
16 14 16
𝑢𝑢1,3 = (0) − (−2.0740) + (0) − 1.3333
9 9 9
𝑢𝑢1,3 = 1.8929

16
Step 6: Fill in the values into the grid.

𝑗𝑗 𝑦𝑦
0 1.8929 0
3 1

0 −2.0740
2 2/3 0

0 1.3333
1 1/3 0

0 0 0
0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 17
Example 5.20:
Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 2

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 1
and initial conditions
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥 𝑥𝑥 − 1 , 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 1, 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝜕𝜕
1
by using the central-difference formula. Given ℎ = and 𝑘𝑘 = 0.5.
3

18
Solution:
Step 1: Sketch the grid points.
Recall:
𝑗𝑗 𝑡𝑡
0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 1
ℎ = 1/3 and 𝑘𝑘 = 0.5
2 1

1 0.5

0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖 19
Step 2: Compute boundary and initial values.
Recall:
𝒖𝒖 𝒙𝒙, 𝟎𝟎 = 𝒙𝒙(𝒙𝒙 − 𝟏𝟏), 𝟎𝟎 ≤ 𝒙𝒙 ≤ 𝟏𝟏
ℎ = 1/3 and 𝑘𝑘 = 0.5
𝑢𝑢 0, 0 = 0
𝑢𝑢 0.3333, 0 = −0.2222
𝑢𝑢 0.6667, 0 = −0.2222
𝑢𝑢 1, 0 = 0

𝒖𝒖 𝟎𝟎, 𝒕𝒕 = 𝟎𝟎, 𝒖𝒖 𝟏𝟏, 𝒕𝒕 = 𝟎𝟎, 𝟎𝟎 ≤ 𝒕𝒕 ≤ 𝟏𝟏


𝑢𝑢 0, 0 = 0 𝑢𝑢 1, 0 = 0
𝑢𝑢 0, 0.5 = 0 𝑢𝑢 1, 0.5 = 0
𝑢𝑢 0, 1 = 0 𝑢𝑢 1, 1 = 0

20
Step 3: Fill in the values into the grid.
Boundary and initial conditions are
𝑗𝑗 𝑦𝑦 symmetrical about the line 𝑥𝑥 = 0.5.
Hence, 𝑢𝑢1,1 = 𝑢𝑢2,1 and 𝑢𝑢1,2 = 𝑢𝑢2,2

0 𝑢𝑢1,2 𝑢𝑢2,2
2 1 0

0 𝑢𝑢1,1 𝑢𝑢2,1
1 0.5 0

0 −0.2222 −0.2222 0
0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖
21
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 Recall:
− =0 ℎ = 1/3 and 𝑘𝑘 = 0.5
𝜕𝜕𝑡𝑡 2 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
is approximated to
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗
− =0
𝑘𝑘 2 ℎ2
𝑘𝑘 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 = 2 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗

0.5 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 2𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
1/3 2 𝑖𝑖+1,𝑗𝑗
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 2.25𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 2.5𝑢𝑢𝑖𝑖,𝑗𝑗 + 2.25𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1

22
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+ from difference formula.
Recall:
ℎ = 1/3 and 𝑘𝑘 = 0.5
From the initial velocity,
𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 1 discretized 𝑥𝑥𝑖𝑖 , 0 = =1
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0

By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘
Hence,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,1 −𝑢𝑢𝑖𝑖,−1
= =1
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0 2(0.5)
is approximated to
𝑢𝑢𝑖𝑖,1 − 𝑢𝑢𝑖𝑖,−1 = 1
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 1
23
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 2.25𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 2.5𝑢𝑢𝑖𝑖,𝑗𝑗 + 2.25𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 1

Boundary and initial


conditions are
symmetrical about
the line 𝑥𝑥 = 0.5.

Hence,
𝑢𝑢1,1 = 𝑢𝑢2,1 and
𝑢𝑢1,2 = 𝑢𝑢2,2

Let 𝑖𝑖 = 1, 𝑗𝑗 = 0,
𝑢𝑢1,1 = 2.25𝑢𝑢0,0 − 2.5𝑢𝑢1,0 + 2.25𝑢𝑢2,0 − 𝑢𝑢1,−1
𝑢𝑢1,1 = 2.25(0) − 2.5(−0.2222) + 2.25(−0.2222) − (𝑢𝑢1,1 − 1)
2𝑢𝑢1,1 = 1.0556 24

𝑢𝑢1,1 = 0.5278 ∴ 𝑢𝑢2,1 = 0.5278 due to symmetrical condition


Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 2.25𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 2.5𝑢𝑢𝑖𝑖,𝑗𝑗 + 2.25𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 1

Boundary and initial


conditions are
symmetrical about
the line 𝑥𝑥 = 0.5.

Hence,
𝑢𝑢1,1 = 𝑢𝑢2,1 and
𝑢𝑢1,2 = 𝑢𝑢2,2

Let 𝑖𝑖 = 1, 𝑗𝑗 = 1,
𝑢𝑢1,2 = 2.25𝑢𝑢0,1 − 2.5𝑢𝑢1,1 + 2.25𝑢𝑢2,1 − 𝑢𝑢1,0
𝑢𝑢1,2 = 2.25(0) − 2.5(0.5278) + 2.25(0.5278) − (−0.2222)
25
𝑢𝑢1,2 = 0.0903 ∴ 𝑢𝑢2,2 = 0.0903 due to symmetrical condition
Step 6: Fill in the values into the grid. Boundary and initial
conditions are symmetrical
about the line 𝑥𝑥 = 0.5.
𝑗𝑗 𝑦𝑦
Hence, all grid points are
symmetrical about the line
0 0.0903 0.0903 𝑥𝑥 = 0.5
2 1 0

0 0.5278 0.5278
1 0.5 0

0 −0.2222 −0.2222 0
0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖 26
Exercise 5.11:
1) Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 2
with boundary conditions
𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 0.1
and initial conditions
𝑢𝑢 𝑥𝑥, 0 = sin 𝜋𝜋𝜋𝜋 , 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 0, 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝜕𝜕
by using the central-difference formula. Given ℎ = 0.25 and 𝑘𝑘 = 0.05.

[Ans: 𝑢𝑢0,0 = 𝑢𝑢0,1 = 𝑢𝑢0,2 = 𝑢𝑢4,0 = 𝑢𝑢4,1 = 𝑢𝑢4,2 = 0; 𝑢𝑢1,0 = 𝑢𝑢3,0 = 0.7071; 𝑢𝑢2,0 =
1; 𝑢𝑢1,1 = 𝑢𝑢3,1 = 0.6988; 𝑢𝑢2,1 = 0.9883; 𝑢𝑢1,2 = 𝑢𝑢3,2 = 0.6741; 𝑢𝑢2,2 = 0.9534]
27
Exercise 5.11:
2) Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
=9 2, 0 < 𝑥𝑥 < 𝜋𝜋, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥
with boundary conditions
𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 𝜋𝜋, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 1
and initial conditions
𝑥𝑥
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥 cos , 0 ≤ 𝑥𝑥 ≤ 𝜋𝜋
2
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 2, 0 ≤ 𝑥𝑥 ≤ 𝜋𝜋
𝜕𝜕𝜕𝜕
𝜋𝜋
by using the central-difference formula. Given ℎ = 4 and 𝑘𝑘 = 0.5.

[Ans: 𝑢𝑢0,0 = 𝑢𝑢0,1 = 𝑢𝑢0,2 = 𝑢𝑢4,0 = 𝑢𝑢4,1 = 𝑢𝑢4,2 = 0; 𝑢𝑢1,0 = 0.7256;


𝑢𝑢2,0 = 1.1107; 𝑢𝑢3,0 = 0.9017; 𝑢𝑢1,1 = 1.1046; 𝑢𝑢2,1 = 1.0272; 𝑢𝑢3,1 = 0.6384;
𝑢𝑢1,2 = −2.8279; 𝑢𝑢2,2 = −0.1922; 𝑢𝑢3,2 = −0.5353] 28
References

1. S.C. Chapra and R.P. Canale. (2015). Numerical Methods for


Engineers, 7th Edition. McGraw-Hill Education.

2. R.L. Burden, D.J. Faires and A.M. Burden. (2016). Numerical


Analysis, 10th Edition. Cengage Learning.

29
Thank You

Questions & Answer?

30

You might also like