Professional Documents
Culture Documents
Unit 3
Unit 3
Malabika Adak
Assistant Professor of Department of Applied Mathematics and Humanities,
Yeshwantrao Chavan college of Engineering, Nagpur-441110, India
3.1 Introduction
In physics and mathematics, Heat equation is a special case of diffusion equation, is a typical
parabolic partial differential equation (PDE) and is a time variable problem. PDEs are useful tools
for mathematical modeling. A few problems can be solved analytically where as difficult boundary
value problem can be solved by numerical methods easily. A very popular numerical method
known as finite difference method has been applied expansively for solving heat equations
successfully. In this chapter explicit and implicit finite difference schemes are established for
simple one-dimensional heat equation.
with initial condition 𝑇(𝑥, 0) = 𝑓(𝑥) and Dirichlet’s boundary conditions are
𝑇(0, 𝑡) = 𝑇0, 𝑇(𝐿, 𝑡) = 𝑇𝐿
where 𝑇= temperature (0C), 𝑡 = time (s), 𝑥 = length (m). 𝑇0 = 𝑇L = constant temperature.
𝑘
𝛼 2 = 𝜌𝑐 = thermal diffusivity of material depends on 𝑘 = thermal conductivity(W/m. 0C)
This section represents the formulation of various numerical schemes with two-time level and
three-time level. Finite difference method is obtained an approximation solution for T(x, t) at a
finite set of x and t. Divide the (x, t) plane into smaller rectangular as shown in fig.3.1 by
𝑥 = 𝑖∆𝑥, 𝑖 = 0,1,2 … … . . 𝑡 = 𝑘∆𝑡, 𝑖 = 0,1,2 … … ..
𝜕𝑇 𝑇𝑖𝑛+1 −𝑇𝑖𝑛−1
= + 𝑂(∆𝑡 2 ) (Central difference in time)
𝜕𝑡 2∆𝑡
𝑛
𝜕2𝑇 𝑇𝑖−1 −2𝑇𝑖𝑛 +𝑇𝑖+1
𝑛
= + 𝑂(∆𝑥 2 ) (Central difference in space)
𝜕𝑥 2 (∆𝑥)2
The terms 𝑂(∆𝑡 + ∆𝑥 2 ) and 𝑂(∆𝑡 2 + ∆𝑥 2 ) denote the order of local truncation error and is also
known as the order of method. After neglecting the truncation error and simplifying obtain the
following difference schemes.
𝑇𝑖𝑛+1 −𝑇𝑖𝑛 𝑛
𝑇𝑖−1 −2𝑇𝑖𝑛 +𝑇𝑖+1
𝑛
= 𝛼2
∆𝑡 (∆𝑥)2
𝛼2 Δ𝑡
➢ 𝑇𝑖𝑛+1 − 𝑇𝑖𝑛 = 𝑛
(𝑇𝑖−1 − 2𝑇𝑖𝑛 + 𝑇𝑖+1
𝑛
)
Δ𝑥 2
Using Dirichlet initial and boundary condition in Eq. 3.2, we get system of linear equations for
𝑛 = 0, 1, 2 …. These linear equations are solved to get the solution for new time step.
Error at node (𝑖, 𝑛) is given by
𝐸𝑖𝑛 = 𝑇𝑖𝑛+1 − (1 − 2𝜆)𝑇𝑖𝑛 − 𝜆(𝑇𝑖+1
𝑛 𝑛
+ 𝑇𝑖−1 )
1
If we set 𝜆 = 2 in Eq. 3.2, we obtain the simple formula
1
𝑇𝑖𝑛+1 = 2 (𝑇𝑖+1
𝑛 𝑛
+ 𝑇𝑖−1 ) 3.3
which is called Bender-Schmidt scheme. It is clear that Eqs. 3.2 and 3.3 have limited application
because of the restriction on the values of 𝜆.
Error at node (𝑖, 𝑛) is given by
1
𝐸𝑖𝑛 = 𝑇𝑖𝑛+1 − 2 (𝑇𝑖+1
𝑛 𝑛
+ 𝑇𝑖−1 )
Laasonen Scheme
In Eq. 3.1, 1st order derivative is replaced by backward difference in time as well as 2nd order is
replaced by central difference in space. We get
𝑇𝑖𝑛 −𝑇𝑖𝑛−1 𝑛
𝑇𝑖−1 −2𝑇𝑖𝑛 +𝑇𝑖+1
𝑛
= 𝛼2
∆𝑡 (∆𝑥)2
𝛼2 Δ𝑡
➢ 𝑇𝑖𝑛 − 𝑇𝑖𝑛−1 = 𝑛
(𝑇𝑖−1 − 2𝑇𝑖𝑛 + 𝑇𝑖+1
𝑛
)
Δ𝑥 2
Eq. 3.4 is called Laasonen method, also called two level scheme since nth and (n+1)th levels are
involve in equation. The solution value at any point (𝑖, 𝑛 + 1) on the (𝑛 + 1)𝑡ℎ level is dependent
on the solution values at the neighboring points on the same level and on one point on the 𝑛𝑡ℎ
level. Since the solution values at the (𝑛 + 1)𝑡ℎ level are obtained implicitly, the method is called
an implicit method.
Using boundary and initial conditions in Eq. 3.4, represent a system of linear equations
𝑇11 𝑇10
1 + 2𝜆 −𝜆 0 0 0 0
−𝜆 1 + 2𝜆 −𝜆 0 0 0 𝑇21 𝑇20
−𝜆 1 + 2𝜆 −𝜆 0 𝑇31 𝑇30
−𝜆 =
−𝜆 1 + 2𝜆 0 𝑇41 𝑇40
0 0 0 −𝜆 1 + 2𝜆 −𝜆 𝑇1 𝑇50
[ 0 0 0 0 −𝜆 1 + 2𝜆 ] 51
[𝑇6 ] [𝑇60 ]
which is solved to find the approximate solution. Since it is implicit scheme, it is unconditionally
stable method.
𝛼2 Δ𝑡
➢ 2(𝑇𝑖𝑛+1 − 𝑇𝑖𝑛 ) = 𝑛
(𝑇𝑖−1 − 2𝑇𝑖𝑛 + 𝑇𝑖+1
𝑛 𝑛+1
+ 𝑇𝑖−1 − 2𝑇𝑖𝑛+1 + 𝑇𝑖+1
𝑛+1
)
Δ𝑥 2
It can be written as
𝑛+1
−𝜆𝑇𝑖−1 + (2 + 2𝜆)𝑇𝑖𝑛+1 − 𝜆𝑇𝑖+1
𝑛+1 𝑛
= 𝜆𝑇𝑖−1 + (2 − 2𝜆)𝑇𝑖𝑛 + 𝜆𝑇𝑖+1
𝑛
3.5
This method is also implicit scheme and two level schemes.
The solution of Crank-Nicolson scheme represent the tri-diagonal matrix form as
𝑇11 𝑇10
2 + 2𝜆 −𝜆 0 0 0 0
−𝜆 2 + 2𝜆 −𝜆 0 0 0 𝑇21 𝑇20
0 −𝜆 2 + 2𝜆 −𝜆 0 0 𝑇31 𝑇30
=
0 0 −𝜆 2 + 2𝜆 −𝜆 0 𝑇41 𝑇40
0 00 −𝜆 + 2𝜆
2 −𝜆 𝑇51 𝑇50
[0 00 0 −𝜆 2 + 2𝜆]
[𝑇61 ] [𝑇60 ]
Three Level Difference Scheme
3.3.3 Dufort- Frankel Scheme
In equation 3.1, 1st order derivative is replaced by central difference in time as well as 2nd order is
replaced by central difference in space. We get
𝑇𝑖𝑛+1 −𝑇𝑖𝑛−1 𝑛
𝑇𝑖−1 −2𝑇𝑖𝑛 +𝑇𝑖+1
𝑛
= 𝛼2
2∆𝑡 (∆𝑥)2
Also, replace 𝑇𝑖𝑛 by the mean of the values 𝑇𝑖𝑛+1 and 𝑇𝑖𝑛−1 that means
1
𝑇𝑖𝑛 ≈ 2 (𝑇𝑖𝑛+1 + 𝑇𝑖𝑛−1 ) and the above equation becomes
𝛼2 Δ𝑡
➢ 𝑇𝑖𝑛+1 − 𝑇𝑖𝑛−1 = 2 𝑛
(𝑇𝑖−1 − 2𝑇𝑖𝑛 + 𝑇𝑖+1
𝑛
)
Δ𝑥 2
1−2𝜆 2𝜆
➢ 𝑇𝑖𝑛+1 = 1+2𝜆 𝑇𝑖𝑛−1 + 1+2𝜆 (𝑇𝑖−1
𝑛 𝑛
+ 𝑇𝑖+1 ) 3.6
𝛼2 Δ𝑡
where 𝜆= is called mesh ratio parameter.
Δ𝑥 2
Eq. 3.6 is explicit scheme. In this method, to calculate nth level approximate solution (n-1)th time
level value is used that for calculating first time level (when 𝑛 = 0), (-1)th time level value is
required. It is not possible physically. To overcome the critical situation Explicit scheme is used at
𝑛 = 0, remaining time level approximation is calculated using Dufort-Frankel method.
𝑢(𝑥, 0) = sin 𝜋𝑥, 0 ≤ 𝑥 ≤ 1 , and 𝑢(0, 𝑡) = 𝑢(1, 𝑡) = 0. Use Bender Schmidt’s and Crank-
Nicolson scheme to compute the value of 𝑢(0.6, 0.04) and Compare the exact solution
2
𝑢(𝑥, 𝑡) = 𝑒 −𝜋 𝑡 sin 𝜋𝑥
Solution:
Bender Schmidt’s Scheme
Here 0 ≤ 𝑥 ≤ 1, if ∆𝑥 = 0.2, then 𝑥0 = 0, 𝑥1 = 𝑥0 + ∆𝑥 = 0.2, 𝑥2 = 𝑥1 + ∆𝑥 = 0.4, 𝑥3 = 𝑥2 +
∆𝑥 = 0.6, 𝑥4 = 𝑥3 + ∆𝑥 = 0.8, 𝑥5 = 𝑥4 + ∆𝑥 = 1.
𝑦0 , 𝑦𝑛 are known, but we have to calculate unknown values 𝑦1 , 𝑦2 , 𝑦3 , 𝑦4 .
1 𝜆(Δ𝑥)2
Since 𝜆 = 2 for Bender Schmidt’s scheme, so Δ𝑡 = = 0.02.
𝛼2
Δ𝑡 = 0.04
1 1
For 𝑛 = 1, 𝑖 = 1, 𝑢12 = 2 (0 + 𝑢21 ) = 2 (0 + 0.7694) = 0.3847
1 1
𝑖 = 2, 𝑢22 = 2 (𝑢11 + 𝑢31 ) = 2 (0.475 + 0.7694) = 0.62245
1 1
𝑖 = 3, 𝑢32 = 2 (𝑢21 + 𝑢41 ) = 2 (0.7694 + 0.4755) = 0.62245
1 1
𝑖 = 4, 𝑢42 = 2 (𝑢31 + 0) = 2 (0.7694 + 0) = 0.3847
2
The exact solution 𝑢(𝑥, 𝑡) = 𝑒 −𝜋 𝑡 sin 𝜋𝑥
𝑢(0.6, 0.04) = 𝑢32 = 0.64085
Numerical solution
𝑢(0.6, 0.04) = 𝑢32 = 0.62245
Error = 0.0184
Putting 𝑛 = 0, we have
1 0 0
−𝑢𝑖−1 + 4𝑢𝑖1 − 𝑢𝑖+1
1
= 𝑢𝑖−1 + 𝑢𝑖+1
Putting 𝑖 = 1, 2, 3, 4, we get linear simultaneous equations
4𝑢11 − 𝑢21 = 0.951
−𝑢11 + 4𝑢21 − 𝑢31 = 1.5388
−𝑢21 + 4𝑢31 − 𝑢41 = 1.5388
−𝑢31 + 4𝑢41 = 0.951
𝑢11 0.951
4 −1 0 0 𝑢1
2 1.5388
➢ [ −1 4 −1 0 ] 𝑢31 = 1.5388
0 −1 4 −1
0 0 −1 4 𝑢4
1 0.951
[ ] [ ]
𝑢11 0.951
4 −1 0 0 𝑢21 5.2042
➢ [ 0 15 −5 0 ] 𝑢31 = 1.5388
0 −1 4 −1
0 0 −1 4 𝑢4
1 0.951
[ ] [ ]
𝜕𝑇 𝜕2𝑇
= 𝜕𝑥 2 , with condition T(𝑥, 0) = sin 𝜋𝑥, 0 ≤ 𝑥 ≤ 1 , and T(0, 𝑡) = 𝑇(1, 𝑡) = 0.
𝜕𝑡
𝟏 𝟏
For 𝒉 = 𝟑 , 𝒌 = 𝟑𝟔. Integrate upto two-time level.
Solution:
Here 0 ≤ 𝑥 ≤ 1, if ℎ = 1/3, then 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 1/3,
𝑥2 = 𝑥1 + ℎ = 2/3, 𝑥3 = 𝑥2 + ℎ = 3/3 = 1,
𝑦0 , 𝑦3 are known, but we have to calculate unknown values 𝑦1 , 𝑦2 .
𝟏 𝟏 𝛼2 Δ𝑡 1 1
Here 𝒉 = 𝟑 , 𝒌 = 𝟑𝟔 , So, 𝜆 = = 36 × 9 = 4
Δ𝑥 2
𝟏 𝟏 𝑛 𝑛
= 𝑻𝒏𝒊 + 𝟒 (𝑇𝑖+1 + 𝑇𝑖−1 )
𝟐
𝟏
𝑇𝑖𝑛+1 = 𝟒 [𝑻𝒏𝒊−𝟏 + 𝟐𝑇𝑖𝑛 + 𝑇𝑖+1
𝑛
) 3.7
For 𝑛 = 0, 𝑖 = 1, 2
1 0 1 𝜋 2𝜋
𝑇11 = (𝑇0 + 2𝑇10 + 𝑇20 ) = [2𝑠𝑖𝑛 + 𝑠𝑖𝑛 ] = 0.6495
4 4 3 3
1 0 1 𝜋 2𝜋
𝑇21 = (𝑇1 + 2𝑇20 + 𝑇30 ) = [𝑠𝑖𝑛 + 2 𝑠𝑖𝑛 ] = 0.6495
4 4 3 3
For 𝑛 = 1, 𝑖 = 1, 2
1 1
𝑇12 = (𝑇11 + 2𝑇11 + 𝑇21 ) = [2 × 0.6495 + 0.6495] = 0.4871
4 4
1 1
𝑇22 = (𝑇11 + 2𝑇21 + 𝑇31 ) = [0.6495 + 2 × 0.6495] = 0.4871
4 4
3 1 1 1 𝜋 √3
𝑇1 − 𝑇2 = 𝑇10 = 𝑠𝑖𝑛 = (𝑖 = 1)
2 4 3 2
1 3 2𝜋 √3
− 𝑇11 + 𝑇21 = 𝑇20 = 𝑠𝑖𝑛 = (𝑖 = 2)
4 2 3 2
2√3
𝑇11 = 𝑇21 = = 0.6928
5
For 𝑛 = 1, putting 𝑖 = 1, 2
3 2 1 2
𝑇 − 𝑇 = 𝑇11 = 0.6928 (𝑖 = 1)
2 1 4 2
1 3
− 𝑇11 + 𝑇22 = 𝑇21 = 0.6928 (𝑖 = 2)
4 2
➢ 𝑇12 = 𝑇22 = 0.5542
For 𝑛 = 0, putting 𝑖 = 1, 2
5 1 1 1 3 0 1 0 7
𝑇 − 𝑇 = 𝑇 + 𝑇 = √3
2 1 4 2 2 1 4 2 8
1 5 1 3 7
− 𝑇11 + 𝑇21 = 𝑇10 + 𝑇20 = √3
4 2 4 2 8
5 2 1 2 3 1 1 1
𝑇 − 𝑇 = 𝑇 + 𝑇 = 0.5894
2 1 4 2 2 1 4 2
1 5 1 3
− 𝑇12 + 𝑇22 = 𝑇11 + 𝑇21 = 0.5894
4 2 4 2
➢ 𝑇12 = 𝑇22 =
1 − 2𝜆 𝑛−1 2𝜆
𝑇𝑖𝑛+1 = 𝑇𝑖 + (𝑇 𝑛 + 𝑇𝑖+1
𝑛
)
1 + 2𝜆 1 + 2𝜆 𝑖−1
1 1 1
➢ 𝑇𝑖1 = 2 𝑇𝑖0 + 4 (𝑇𝑖+1
0 0
+ 𝑇𝑖−1 ) (∵ 𝜆 = )
4
1 1
1 − 2. 4 2. 4
0
𝑇12 = 𝑇 + (𝑇 1 + 𝑇21 )
1 1 1 0
1 + 2. 4 1 + 2. 4
1 0 1 1 1 √3 1 5√3
𝑇12 = 𝑇1 + (𝑇0 + 𝑇21 ) = . + (0 + ) = 0.5052
3 3 3 2 3 8
1 0 1 1 1 √3 1 5√3
𝑇22 = 𝑇2 + (𝑇1 + 𝑇31 ) = . + (0 + ) = 0.5052
3 3 3 2 3 8
Example 3
𝜕𝑢 𝜕2𝑢
Use the explicit formula to solve = 𝜕𝑥 2 with condition u(𝑥, 0) = 𝑥 2 (25 − 𝑥 2 ),
𝜕𝑡
Solution:
Ans: 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒
𝒏=𝟎 24 84 144 144
𝒏=𝟏 42 78 78 57
𝒏=𝟐 39 60 67.5 39
Example 4
𝜕𝑢 𝜕2𝑢
Solve the heat equation = 𝜕𝑥 2 with condition u(𝑥, 0) = 0, u(0, 𝑡) = 0, 𝑢(1, 𝑡) = 𝑡
𝜕𝑡
1 1 1 1
with ℎ = 4 , 𝑘 = 16. Compute the value of 𝑢(2 , 8) using Crank Nicolson method.
Example 5
Calculate 𝑢(2, 2)
Solution:
Here 0 ≤ 𝑥 ≤ 4, if ∆𝑥 = 1, then 𝑥0 = 0, 𝑥1 = 𝑥0 + ∆𝑥 = 1, 𝑥2 = 𝑥1 + ∆𝑥 = 2,
𝑥3 = 𝑥2 + ∆𝑥 = 3, 𝑥4 = 𝑥3 + ∆𝑥 = 4,
𝑦0 , 𝑦4 are known, but we have to calculate unknown values 𝑦1 , 𝑦2 , 𝑦3 .
1 𝜆(Δ𝑥)2
Since 𝜆 = 2 for Bender Schmidt’s scheme, so Δ𝑡 = = 1.
𝛼2
Similarly,
Δ𝑡 = 2
1
For 𝑛 = 2, 𝑖 = 1, 𝑢12 = 2 (𝑢01 + 𝑢21 ) = 1.5
1
𝑖 = 2, 𝑢22 = 2 (𝑢11 + 𝑢31 ) = 2
1
𝑖 = 3, 𝑢32 = 2 (𝑢21 + 𝑢41 ) = 1.5
Exercise
𝜕𝑢 𝜕2𝑢
1. Using Bender Schmidt method, find the solution of the parabolic equation = 2 𝜕𝑥 2
𝜕𝑡
𝜕𝑢 1 𝜕2𝑢
2. Using Bender Schmidt method, find the solution of the parabolic equation = 32 𝜕𝑥 2
𝜕𝑡
𝜕𝑢 𝜕2 𝑢
3. Using Crank-Nicolson method solve equation = subject to u(𝑥, 0) = 0,
𝜕𝑡 𝜕𝑥 2
u(0, 𝑡) = 0, 𝑢(1, 𝑡) = 𝑡. Assume ℎ = 1/4, find the values upto two time steps.
𝜕𝑢 𝜕2 𝑢
4. Using Crank-Nicolson method solve equation = 𝜕𝑥 2 subject to u(𝑥, 0) = 0,
𝜕𝑡
u(0, 𝑡) = 0, 𝑢(1, 𝑡) = 𝑡. i) taking ℎ = 1/2 and 𝑘 = 1/8 , ii) ℎ = 1/4 and 𝑘 = 1/8,
and ℎ = 1/4 and 𝑘 = 1/16.
𝜕𝑢 𝜕2 𝑢
5. Using explicit method solve equation = 𝜕𝑥 2 subject to u(𝑥, 0) = 0, u(0, 𝑡) = 0,
𝜕𝑡
𝒏=𝟎 2 3 2
𝒏=𝟐 1 1.5 1
𝒏=𝟎 0 0 0
𝒏=𝟏 0 0 0.5
𝒏=𝟐 0 0.25 1
2. 𝒖𝟏 𝒖𝟐 𝒖𝟑
3. i) 𝑢1 = 0.02083