FDM for The Heat Equation Contd..
Rajen Kumar Sinha
Department of Mathematics
IIT Guwahati
Rajen Kumar Sinha MA573
Weighted Average Approximation: A more general finite-difference
approximation to the heat equation Ut = Uxx is given by
ui,j+1 − ui,j 1
= θ(ui−1,j+1 − 2ui,j+1 + ui+1,j+1 )
k h2
+(1 − θ)(ui−1,j − 2ui,j + ui+1,j ) , (1)
where 0 ≤ θ ≤ 1. Observe that
θ=0 =⇒ the explicit scheme (Schmidt’s scheme)
θ=1 =⇒ the Euler’s implicit scheme
1
θ= =⇒ the Crank-Nicolson scheme
2
FACT:
• The scheme (1) is unconditionally stable for 21 ≤ θ ≤ 1.
• The scheme (1) is conditionally stable for 0 ≤ θ < 12 . The condition
for stability is
k 1
r= 2 ≤ .
h 2(1 − 2θ)
Rajen Kumar Sinha MA573
Define the central difference operators δx and δt as:
δx φi,j = φi+ 12 , j − φi− 12 , j
δt φi,j = φi, j+ 21 − φi, j− 12
Using this, the explicit scheme can be written as
1 1
δt ui,j+ 12 = 2 δx2 ui,j , where
k h
δt ui,j+ 12 = ui,j+1 − ui,j
δx2 ui,j = δx (δx ui,j ) = δx (ui+ 12 , j − ui− 12 , j )
= ui+1,j − 2ui,j + ui−1,j
The Euler’s implicit scheme:
1 1
δt ui,j− 12 = 2 δx2 ui,j .
k h
The Crank-Nicolson scheme:
1 1
δt ui,j+ 12 = 2 δx2 ui,j+1 + δx2 ui,j
k 2h
Rajen Kumar Sinha MA573
The weighted average scheme:
1 1 2 2
δt ui,j+ 2 = 2 θ δx ui,j+1 + (1 − θ) δx ui,j
1
k h
Derivative Boundary Conditions:
∂U
= C (U − V ) at x = 0, t > 0
∂x
∂U
= −C (U − V ) at x = 1, t > 0
∂x
V − the temperature of the
surrounding and it is assumed to
be constant.
Rajen Kumar Sinha MA573
Using forward difference approximation, we have at x = 0
u1,j − u0,j
= C (u0,j − V )
h
=⇒ u1,j = u0,j + Ch(u0,j − V )
=⇒ u1,j = (1 + Ch)u0,j − ChV
The truncation error (T.E.)=O(h), which leads to a loss of accuracy in h.
To obtain a better approximation ( of O(h2 )), use central difference
scheme to have
u1,j − u−1,j
= C (u0,j − V )
2h
=⇒ u−1,j = u1,j − 2hC (u0,j − V ). (2)
Recall the explicit scheme
ui,j+1 = rui−1,j + (1 − 2r )ui,j + rui+1,j . (3)
For i = 0,
u0,j+1 = ru−1,j + (1 − 2r )u0,j + ru1,j , j = 0, 1, 2, . . . . (4)
Rajen Kumar Sinha MA573
Now, substituting the value of u−1,j from (2) in (4), it follows that
u0,j+1 = r {u1,j − 2hC (u0,j − V )} + (1 − 2r )u0,j + ru1,j
= 2ru1,j + {(1 − 2r ) − 2rhC }u0,j + 2rhCV
= {1 − 2r (1 + hC )}u0,j + 2ru1,j + 2rhCV , j = 0, 1, 2, . . .
At the other end x = 1, That is, with i = N, we have
∂U
= C (V − U)N,j
∂x N,J
Use central difference approximation to obtain
uN+1,j − uN−1,j
= C (V − uN,j )
2h
=⇒ uN+1,j = uN−1,j + 2hC (V − uN,j )
Rajen Kumar Sinha MA573
From the explicit scheme (3), we have for i = N,
uN,j+1 = ruN+1,j + (1 − 2r )uN,j + ruN−1,j
= r {uN−1,j + 2hC (V − uN,j )} + (1 − 2r )uN,j + ruN−1,j
= 2ruN−1,j + {(1 − 2r ) − 2rhC }uN,j + 2rhCV
= 2ruN−1,j + {1 − 2r (1 + hc)}uN,j + 2rhCV , j = 0, 1, 2, . . .
For i = 1, . . . N − 1,
ui,j+1 = rui−1,j + (1 − 2r )ui,j + rui+1,j , j = 0, 1, . . . .
*** Ends ***
Rajen Kumar Sinha MA573