7 PDF
7 PDF
Lecture 12
APPROXIMATION OF FIRST ORDER DERIVATIVES
12.1 INTRODUCTION
Convective term in conservation equations involve first order derivatives. The simplest
possible approach for discretization of these terms would be to use the approximation based
on the basic definition of the derivative. In this lecture, we learn systematic procedures to
obtain FD approximations based on Taylor series expansion and polynomial fitting for a
generic function f(x) of a generic variable x.
f x xi f x xi n f H (12.1)
2 2 n
f x f xi x xi .....
x i 2! x 2 i n ! x n i
In series expansion, symbol H has been used to denote the higher order terms which have not
been indicated explicitly. Thus, function values at grid points xi 1 and xi 1 can be expressed as
f x x f
2 2
f i 1 f xi 1 f xi xi 1 xi i 1 i 2 H (12.2)
x i 2! x i
f x x f
2 2
fi 1 f xi 1 f xi xi 1 xi i 1 i 2 H (12.3)
x i 2! x i
f fi 1 fi xi 1 xi 2 f
2 H (12.4)
x i xi 1 xi 2 x i
f f i 1 f i
O xi (12.5)
x i xi
where xi xi 1 xi . Similarly, Eq. (12.3) yields the backward difference scheme (BDS)
given by
f f i fi 1
O xi 1 (12.6)
x i xi 1
where xi 1 xi xi 1. Subtracting Eq. (12.3) from Eq.(12.2), we obtain the central difference
scheme (CDS) given by the formula
f i 1 fi 1 xi xi 1 xi 1 xi 2 f
2 2
f
2 H (12.7)
x i xi 1 xi 1 2 xi 1 xi 1 x i
f f f
FDS: i 1 i , Truncation Error ~ O x
x i xi 1 xi
f f f
BDS: i i 1 , Truncation Error ~ O x
x i xi xi 1
f f f
CDS: i 1 i 1 , Truncation Error ~ O x on non-uniform mesh
x i xi 1 xi 1
f fi 1 fi 1
, Truncation Error ~ O x 2 on uniform grid
x i 2x
Note that the truncation error of the first order FDS or BDS is given by
x 2 f
(12.8)
2 x2 i
The truncation error of the CDS is given by
x xi 1 2 f xi xi 1 3 f
2 2 3 3
Further, let us substitute the value of second order derivative from Eq. (12.2) into Eq.
(12.4). On rearrangement, we get
which has second order accuracy on any grid (uniform or non-uniform). It reduces to the
simpler form of CDS on uniform grids.
Example 12.1
Derive a three point backward difference formula on uniform grid using general procedure
given by equation (12.11).
Solution
For three point backward difference formula, Eq. (12.11) takes the following form:
f afi bf i 1 cfi 2
(i)
x i x
f 2x f (2x) f
22 3 3
fi 2 f i 2x 2 3 .... (iii)
x i 2 x i 6 x i
Hence,
af i bfi 1 cfi 2 a b c f x 2 f
f i b 2c b 4c 2
x x x i 2 x i
(iv)
x 2 3 f
b 8c 3 ...
6 x i
Equations (i) and (iv) indicate that the following three conditions must be satisfied:
abc 0 (v)
b 2 c 1 (vi)
b 4c 0 (vii)
Solving Eqs. (v)-(vii), we get
a 3 / 2, b 2, c 1/ 2 (viii)
f 3 f i 4 fi 1 f i 2
, TE ~ O x 2 (x)
x i 2x
f 3 f i 4 fi 1 f i 2
, TE ~ O x 2 (x)
x i 2x
f x a0 a1 x a2 x2 .... an xn (12.12)
or
f x a0 a1 x xi x a2 x xi ... an x xi
2 n
(12.13)
Coefficients a0, a1, a2,.., an are determined by fitting the interpolation curve to function values
at appropriate number of points. The second form given by Eq. (12.13) is usually preferred as
it directly provides the expression for derivatives at point xi, i.e.
f 2 f 3 f
a ,
1 2
2 a 2 , 3 6a3 , .... (12.14)
x i x i x i
The order of approximation of the resulting finite difference approximation can obtained
using Taylor series expansion. The following example illustrates the use of polynomial fitting
for derivation of finite difference approximation for the first order derivative.
Example 12.2
Derive a three point central difference formula on non-uniform grid using polynomial fitting
at points xi 1 , xi and xi 1 .
Solution
We can fit the following quadratic curve through three points xi 1 , xi and xi 1 :
f x a0 a1 x xi x a2 x xi2 (i)
The first order derivative at point xi is a1 . To obtain the value of a1 , we fit the interpolation
curve (i) to the function values at points xi 1 , xi and xi 1 , which results in the following set
of linear equations:
f i a0 (ii)
fi 1 fi a1 xi a2 xi
2
(iii)
f i 1 fi a1 xi 1 a2 xi 1
2
(iv)
Multiply Eq. (iv) by xi and subtract it from xi 1 × Eq. (iii) to obtain
2 2
The preceding formula is identical to that given by Eq. (12.10) derived earlier using Taylor
series expansion. Further, on a uniform grid, xi xi 1 x , Eq. (vi) (or Eq. (12.10))
reduces to the standard CDS formula
f f i 1 fi 1
(vii)
x i 2x
as expected.
Let us note that other polynomials, splines or shape functions can be used to
approximate the function, and thereby obtain an approximate formula for the derivative.
Using the procedure outlined above, we can obtain higher order approximations. For
example, by fitting a cubic polynomial to four points, the following third order
approximations can be obtained on a uniform grid (Ferziger and Peric, 2003):
f 2 fi 1 3 fi 6 fi 1 fi 2
O((x)3 ) (12.15)
x i 6x
f fi 2 6 fi 1 3 fi 2 fi 1
O((x)3 ) (12.16)
i
x 6 x
The preceding approximations are third order BDS and third order FDS respectively. These
schemes are very useful in convective transport problem where these are referred as upwind
difference schemes (UDS).
In general, approximation of the first derivative obtained using polynomial fitting has the
truncation error of the same order as the degree of polynomial (Ferziger and Peric, 2003).
REFERENCES
Chung, T. J. (2010). Computational Fluid Dynamics. 2nd Ed., Cambridge University Press,
Cambridge, UK.
Ferziger, J. H. And Perić, M. (2003). Computational Methods for Fluid Dynamics. Springer.