0% found this document useful (0 votes)
8 views31 pages

Week 13

The document discusses the finite difference method for solving parabolic equations, specifically focusing on the heat equation. It outlines the limitations of analytical methods and the advantages of numerical methods, including flexibility and better modeling of complex problems. The document also provides difference formulas and an example of applying these methods to approximate solutions for a specific heat equation scenario.

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)
8 views31 pages

Week 13

The document discusses the finite difference method for solving parabolic equations, specifically focusing on the heat equation. It outlines the limitations of analytical methods and the advantages of numerical methods, including flexibility and better modeling of complex problems. The document also provides difference formulas and an example of applying these methods to approximate solutions for a specific heat equation scenario.

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/ 31

BMCG 1013

DIFFERENTIAL EQUATIONS

FINITE DIFFERENCE METHOD


(PARABOLIC EQUATION)
𝑡𝑡
𝑢𝑢0,2 𝑢𝑢1,2 𝑢𝑢2,2 𝑢𝑢3,2 𝑢𝑢4,2

𝑢𝑢0,1 𝑢𝑢1,1 𝑢𝑢2,1 𝑢𝑢3,1 𝑢𝑢4,1

𝑢𝑢0,0 𝑢𝑢1,0 𝑢𝑢2,0 𝑢𝑢3,0 𝑢𝑢4,0


𝑥𝑥
0
Ser Lee Loh
[email protected]
Lesson Outcomes

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


• apply finite difference method in solving partial differential
equations
• solve parabolic equation using finite difference method

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


5.4 Numerical Methods for PDE (Explicit Finite
Difference Method)

Why numerical methods are needed?


• Limitation of analytical method: Analytical methods are limited to highly
simplified problems in simple geometries with simple thermal conditions.
• A better modeling: There is always a tendency to oversimplify a problem
into a mathematical model to ensure an analytical solution. Hence, a
mathematical model for a numerical solution may represent the actual
problem better.
• Flexibility: Numerical methods suit the needs of engineering problems
that requires extensive parametric studies.
4
5.4.1 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 5
5.4.2 Parabolic Equation – Heat Equation
Consider the Heat Equation:
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= 𝑐𝑐 2 , 0 < 𝑥𝑥 < 𝑎𝑎, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 𝜕𝜕𝑥𝑥

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 𝑎𝑎, 𝑡𝑡 = 0, 𝑡𝑡 > 0
and initial condition
𝑢𝑢 𝑥𝑥, 0 = 𝑓𝑓 𝑥𝑥 , 0 ≤ 𝑥𝑥 ≤ 𝑎𝑎.

By forward-difference and central-difference formulas,


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

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


− 𝑐𝑐 =0
𝑘𝑘 ℎ2
6
where ℎ = ∆𝑥𝑥 and 𝑘𝑘 = ∆𝑡𝑡.
Example 5.17:
Find approximate solution for the following heat equation
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= 0.5 2 , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 0.1
and initial condition
𝜋𝜋𝜋𝜋
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥 cos , 0 ≤ 𝑥𝑥 ≤ 1.
2
by using the forward-difference and central-difference formula. Given
ℎ = 0.25 and 𝑘𝑘 = 0.05.

7
Solution:
Step 1: Sketch the grid points.
Recall:
𝑗𝑗 𝑡𝑡
0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 0.1
ℎ = 0.25 and 𝑘𝑘 = 0.05
2 0.1

1 0.05

0 𝑥𝑥
0 0.25 0.5 0.75 1
0 1 2 3 4 𝑖𝑖
8
Step 2: Compute boundary and initial values.
Recall:
𝝅𝝅𝝅𝝅
𝒖𝒖 𝒙𝒙, 𝟎𝟎 = 𝒙𝒙 𝐜𝐜𝐜𝐜𝐜𝐜 , 𝟎𝟎 ≤ 𝒙𝒙 ≤ 𝟏𝟏 ℎ = 0.25 and 𝑘𝑘 = 0.05
𝟐𝟐
𝑢𝑢 0, 0 = 0
𝑢𝑢 0.25, 0 = 0.2310
𝑢𝑢 0.5, 0 = 0.3536
𝑢𝑢 0.75, 0 = 0.2870
𝑢𝑢 1, 0 = 0

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


𝑢𝑢 0, 0 = 0 𝑢𝑢 1, 0 = 0
𝑢𝑢 0, 0.05 = 0 𝑢𝑢 1, 0.05 = 0
𝑢𝑢 0, 0.1 = 0 𝑢𝑢 1, 0.1 = 0

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

𝑗𝑗 𝑡𝑡

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


2 0.1

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


1 0.05 0

0 0.2310 0.3536 0.2870 0


0 𝑥𝑥
0 0.25 0.5 0.75 1
0 1 2 3 4 𝑖𝑖
10
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from finite-difference formula.
By forward-difference and central-difference formulas,
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕2 𝑢𝑢
= 0.5 2 − 0.5 =0
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥
Choose the required difference formula from the list:

11
By forward-difference and central-difference formulas,
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
− 0.5 =0
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
is approximated to Recall:
ℎ = 0.25 and 𝑘𝑘 = 0.05

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


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

0.5(0.05)
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗
(0.25)2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

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

Let 𝑖𝑖 = 1, 𝑗𝑗 = 0, 𝑢𝑢1,1 = 0.4𝑢𝑢0,0 + 0.2𝑢𝑢1,0 + 0.4𝑢𝑢2,0


𝑢𝑢1,1 = 0.4(0) + 0.2(0.2310) + 0.4(0.3536)
𝑢𝑢1,1 = 0.1876
13
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 2, 𝑗𝑗 = 0, 𝑢𝑢2,1 = 0.4𝑢𝑢1,0 + 0.2𝑢𝑢2,0 + 0.4𝑢𝑢3,0


𝑢𝑢2,1 = 0.4(0.2310) + 0.2(0.3536) + 0.4(0.2870)
𝑢𝑢2,1 = 0.2779

14
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 3, 𝑗𝑗 = 0, 𝑢𝑢3,1 = 0.4𝑢𝑢2,0 + 0.2𝑢𝑢3,0 + 0.4𝑢𝑢4,0


𝑢𝑢3,1 = 0.4(0.3536) + 0.2(0.2870) + 0.4(0)
𝑢𝑢3,1 = 0.1988
15
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 1, 𝑗𝑗 = 1, 𝑢𝑢1,2 = 0.4𝑢𝑢0,1 + 0.2𝑢𝑢1,1 + 0.4𝑢𝑢2,1


𝑢𝑢1,2 = 0.4(0) + 0.2(0.1876) + 0.4(0.2779)
𝑢𝑢1,2 = 0.1489
16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 2, 𝑗𝑗 = 1, 𝑢𝑢2,2 = 0.4𝑢𝑢1,1 + 0.2𝑢𝑢2,1 + 0.4𝑢𝑢3,1


𝑢𝑢2,2 = 0.4(0.1876) + 0.2(0.2779) + 0.4(0.1988)
𝑢𝑢2,2 = 0.2101
17
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.4𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.2𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.4𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 3, 𝑗𝑗 = 1, 𝑢𝑢3,2 = 0.4𝑢𝑢2,1 + 0.2𝑢𝑢3,1 + 0.4𝑢𝑢4,1


𝑢𝑢3,2 = 0.4(0.2779) + 0.2(0.1988) + 0.4(0)
𝑢𝑢3,2 = 0.1509

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

𝑗𝑗 𝑡𝑡

0 0.1489 0.2101 0.1509 0


2 0.1

0 0.1876 0.2779 0.1988


1 0.05 0

0 0.2310 0.3536 0.2870 0


0 𝑥𝑥
0 0.25 0.5 0.75 1
0 1 2 3 4 𝑖𝑖 19
Example 5.18:
Find approximate solution for the following heat equation
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= 0.1 2 , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 0.4
and initial condition
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥 2 1 − 𝑥𝑥 , 0 ≤ 𝑥𝑥 ≤ 1.
by using the forward-difference and central-difference formula. Given
ℎ = 0.5 and 𝑘𝑘 = 0.1.

20
Solution:
Step 1: Sketch the grid points. Recall:
𝑗𝑗 𝑡𝑡 0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 0.4
ℎ = 0.5 and 𝑘𝑘 = 0.1
4 0.4

3 0.3

2 0.2

1 0.1

0 𝑥𝑥
0 0.5 1
21

0 1 2 𝑖𝑖
Step 2: Compute boundary and initial values.
Recall:
𝒖𝒖 𝒙𝒙, 𝟎𝟎 = 𝒙𝒙𝟐𝟐 𝟏𝟏 − 𝒙𝒙 , 𝟎𝟎 ≤ 𝒙𝒙 ≤ 𝟏𝟏
𝑢𝑢 0, 0 = 0 ℎ = 0.5 and 𝑘𝑘 = 0.1
𝑢𝑢 0.5, 0 = 0.125
𝑢𝑢 1, 0 = 0

𝒖𝒖 𝟎𝟎, 𝒕𝒕 = 𝟎𝟎, 𝒖𝒖 𝟏𝟏, 𝒕𝒕 = 𝟎𝟎, 𝟎𝟎 ≤ 𝒕𝒕 ≤ 𝟎𝟎. 𝟒𝟒


𝑢𝑢 0, 0 = 0 𝑢𝑢 1, 0 = 0
𝑢𝑢 0, 0.1 = 0 𝑢𝑢 1, 0.1 = 0
𝑢𝑢 0, 0.2 = 0 𝑢𝑢 1, 0.2 = 0
𝑢𝑢 0, 0.3 = 0 𝑢𝑢 1, 0.3 = 0
𝑢𝑢 0, 0.4 = 0 𝑢𝑢 1, 0.4 = 0

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

𝑗𝑗 𝑡𝑡

0 𝑢𝑢1,4 0
4 0.4

0 𝑢𝑢1,3
3 0.3 0

0 𝑢𝑢1,2
2 0.2 0

0 𝑢𝑢1,1
1 0.1 0

0 0 0.125 0 𝑥𝑥 23
0 0.5 1
0 1 2 𝑖𝑖
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from finite-difference formula.
By forward-difference and central-difference formulas,
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
− 0.1 =0
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
Recall:
is approximated to ℎ = 0.5 and 𝑘𝑘 = 0.1

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


− 0.1 =0
𝑘𝑘 ℎ2
0.1𝑘𝑘
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗 = 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗
ℎ2
0.1(0.1)
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗
(0.5)2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.04 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.04𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.92𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.04𝑢𝑢𝑖𝑖+1,𝑗𝑗
24
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.04𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.92𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.04𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 1, 𝑗𝑗 = 0,
𝑢𝑢1,1 = 0.04𝑢𝑢0,0 + 0.92𝑢𝑢1,0 + 0.04𝑢𝑢2,0
𝑢𝑢1,1 = 0.04(0) + 0.92(0.125) + 0.04(0)
𝑢𝑢1,1 = 0.115

Let 𝑖𝑖 = 1, 𝑗𝑗 = 1,
𝑢𝑢1,2 = 0.04𝑢𝑢0,1 + 0.92𝑢𝑢1,1 + 0.04𝑢𝑢2,1
𝑢𝑢1,2 = 0.04(0) + 0.92(0.115) + 0.04(0)
𝑢𝑢1,2 = 0.1058

25
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 0.04𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 0.92𝑢𝑢𝑖𝑖,𝑗𝑗 + 0.04𝑢𝑢𝑖𝑖+1,𝑗𝑗

Let 𝑖𝑖 = 1, 𝑗𝑗 = 2,
𝑢𝑢1,3 = 0.04𝑢𝑢0,2 + 0.92𝑢𝑢1,2 + 0.04𝑢𝑢2,2
𝑢𝑢1,3 = 0.04(0) + 0.92(0.1058) + 0.04(0)
𝑢𝑢1,3 = 0.0973

Let 𝑖𝑖 = 1, 𝑗𝑗 = 3,
𝑢𝑢1,4 = 0.04𝑢𝑢0,3 + 0.92𝑢𝑢1,3 + 0.04𝑢𝑢2,3
𝑢𝑢1,4 = 0.04(0) + 0.92(0.0973) + 0.04(0)
𝑢𝑢1,4 = 0.0895

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

𝑗𝑗 𝑡𝑡

0 0.0895 0
4 0.4

0 0.0973
3 0.3 0

0 0.1058
2 0.2 0

0.115
1 0.1 0 0

0 0 0.125 0 𝑥𝑥
0 0.5 1 27

0 1 2 𝑖𝑖
Exercise 5.10:
1) Solve the heat equation
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥 2

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 0.02
and initial condition
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥(1 − 𝑥𝑥) 0 ≤ 𝑥𝑥 ≤ 1.
by using the forward-difference and central-difference formula. Given ℎ = 1/5
and 𝑘𝑘 = 1/100.

[Ans: 𝑢𝑢0,0 = 𝑢𝑢0,1 = 𝑢𝑢0,2 = 𝑢𝑢5,0 = 𝑢𝑢5,1 = 𝑢𝑢5,2 = 0; 𝑢𝑢1,0 = 𝑢𝑢4,0 = 0.16; 𝑢𝑢2,0 = 𝑢𝑢3,0 =
0.24; 𝑢𝑢1,1 = 𝑢𝑢4,1 = 0.14; 𝑢𝑢2,1 = 𝑢𝑢3,1 = 0.22; 𝑢𝑢1,2 = 𝑢𝑢4,2 = 0.125; 𝑢𝑢2,2 = 𝑢𝑢3,2 = 0.2]
28
Exercise 5.10:
2) Solve the heat equation
𝜕𝜕𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= 0.03 2 , 0 < 𝑥𝑥 < 2, 𝑡𝑡 > 0
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥

with boundary conditions


𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 2, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 1
and initial condition
𝜋𝜋
𝑢𝑢 𝑥𝑥, 0 = 3 sin 𝑥𝑥 , 0 ≤ 𝑥𝑥 ≤ 2.
2
by using the forward-difference and central-difference formula. Given ℎ = 1/2
and 𝑘𝑘 = 1/2.

[Ans: 𝑢𝑢0,0 = 𝑢𝑢0,1 = 𝑢𝑢0,2 = 𝑢𝑢4,0 = 𝑢𝑢4,1 = 𝑢𝑢4,2 = 0; 𝑢𝑢1,0 = 𝑢𝑢3,0 = 2.1213; 𝑢𝑢2,0 = 3;
𝑢𝑢1,1 = 𝑢𝑢3,1 = 2.0468; 𝑢𝑢2,1 = 2.8946; 𝑢𝑢1,2 = 𝑢𝑢3,2 = 1.9748; 𝑢𝑢2,2 = 2.7928]
29
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.

30
Thank You

Questions & Answer?

31

You might also like