12 Lec6
12 Lec6
Lecture 1
Hello everyone, so today we will start module 3, finite difference method and in today's
lecture we will learn, finite difference by Taylor Series Expansion. In last lecture, we have
learned the classifications of partial differential equations and you have seen that in heat
transfer and fluid mechanics problems there appears first derivative and second derivative of
dependent variables.
The differential of dependent variables appearing in the partial differential equation must be
expressed as approximate expression, so that a digital computer can be employed to obtain a
solution.
Using Taylor series expansion we can write the first derivative as:
Where, TE is the truncation error (difference between partial derivative and the finite
difference approximation) and is given by:
(∆𝑥)2 𝜕 2 𝑓 (∆𝑥)3 𝜕 3 𝑓
𝑇𝐸 = − − +⋯
2! 𝜕𝑥 2 3! 𝜕𝑥 3
The first term or the leading term in the truncation error will contribute maximum error. So,
that is why, the error of this approximation is termed as the order of accuracy i.e. power of
Δx in the leading term.
𝜕𝑓 𝑓𝑖+1 − 𝑓𝑖
| = + 𝑂(∆𝑥)
𝜕𝑥 𝑖 ∆𝑥
(Refer Slide Time: 11:27)
So, this is also central difference approximation of this second derivative. The order of
accuracy of central differencing is 2.
Alternatively we can find the second derivative using central differencing by taking grid
points i, i+1/2 and i-1/2 :
𝜕 2𝑓 𝜕 𝜕𝑓
= ( )
𝜕𝑥 2 𝜕𝑥 𝜕𝑥
𝜕𝑓 𝜕𝑓
| − |
2
𝜕 𝑓 𝜕𝑥 𝑖+1⁄ 𝜕𝑥 𝑖−1⁄
2 2
= + 𝑂[(∆𝑥)2 ]
𝜕𝑥 2 ∆𝑥
𝑓𝑖+1 − 𝑓𝑖 𝑓𝑖 − 𝑓𝑖−1
𝜕 2𝑓
= ∆𝑥 − ∆𝑥 + 𝑂[(∆𝑥)2 ]
𝜕𝑥 2 ∆𝑥
𝜕 2𝑓 𝑓𝑖+1 − 2𝑓𝑖 + 𝑓𝑖−1
| = + 𝑂[(∆𝑥)2 ]
𝜕𝑥 2 𝑖 2∆𝑥
We saw that the first derivative approximation using forward and backward differencing are
first order accurate while that of the central differencing is second order accurate using two
grid points. If we use 3 grid points 𝑓𝑖+2 , 𝑓𝑖+1 and 𝑓𝑖 then we get:
This is second order accurate forward difference approximation of the first derivative. We
mostly require secondary approximation at the boundaries.
(Refer Slide Time: 34:25)
Similarly if you use 3 backward points 𝑓𝑖−2 , 𝑓𝑖−1 and 𝑓𝑖 we can write:
(2∆𝑥) 𝜕𝑓 (2∆𝑥)2 𝜕 2 𝑓 (2∆𝑥)3 𝜕 3 𝑓 (2∆𝑥)4 𝜕 4 𝑓
𝑓𝑖−2 = 𝑓𝑖 − + − + +⋯
1! 𝜕𝑥 2! 𝜕𝑥 2 3! 𝜕𝑥 3 4! 𝜕𝑥 4
(∆𝑥) 𝜕𝑓 (∆𝑥)2 𝜕 2 𝑓 (∆𝑥)3 𝜕 3 𝑓 (∆𝑥)4 𝜕 4 𝑓
𝑓𝑖−1 = 𝑓𝑖 − + − + +⋯
1! 𝜕𝑥 2! 𝜕𝑥 2 3! 𝜕𝑥 3 4! 𝜕𝑥 4
𝜕𝑓 4(∆𝑥)3 𝜕 3 𝑓
𝑓𝑖−2 −4𝑓𝑖−1 = −3𝑓𝑖 + 2∆𝑥 − +⋯
𝜕𝑥 3! 𝜕𝑥 3
𝜕𝑓 3𝑓𝑖 − 4𝑓𝑖−1 + 𝑓𝑖−2
| = + 𝑂[(∆𝑥)2 ]
𝜕𝑥 𝑖 2∆𝑥
This is second order accurate backward difference approximation of the first derivative
(Refer Slide Time: 39:48)
Till now we have seen only function of a single variable. Now we look into the discritization
of mixed derivatives. Let (i,j) be the current grid point,(i+1,j) is the forward grid point in x
direction,(i-1,j) is the backward grid point in x direction. Similarly,(i,j+1) is the forward grid
point in y direction,(i,j-1) is the backward grid point in y direction. The grid spacing is Δx
and Δy which may or may not be equal.
Alternatively we can come to the same conclusion by writing the mixed derivative as:
𝜕 2𝑓 𝜕 𝜕𝑓
| = ( | )
𝜕𝑥𝜕𝑦 𝑖,𝑗 𝜕𝑥 𝜕𝑦 𝑖,𝑗
and then using central differencing for the first order derivative as:
𝜕 2𝑓 𝜕 𝜕𝑓 𝜕 𝑓𝑖,𝑗+1 + 𝑓𝑖,𝑗−1
| = ( | )= ( ) + 𝑂[(∆𝑦)2 ]
𝜕𝑥𝜕𝑦 𝑖,𝑗 𝜕𝑥 𝜕𝑦 𝑖,𝑗 𝜕𝑥 2∆𝑦
1 𝜕𝑓 𝜕𝑓
= ( | − | ) + 𝑂[(∆𝑦)2 ]
2∆𝑦 𝜕𝑥 𝑖,𝑗+1 𝜕𝑥 𝑖,𝑗−1
𝜕 2𝑓 𝜕 𝜕𝑓 𝜕 𝑓𝑖,𝑗+1 + 𝑓𝑖,𝑗
| = ( | )= ( ) + 𝑂[(∆𝑦)]
𝜕𝑥𝜕𝑦 𝑖,𝑗 𝜕𝑥 𝜕𝑦 𝑖,𝑗 𝜕𝑥 ∆𝑦
1 𝜕𝑓 𝜕𝑓
= ( | − | ) + 𝑂[(∆𝑦)]
∆𝑦 𝜕𝑥 𝑖,𝑗+1 𝜕𝑥 𝑖,𝑗
Thank you