0% found this document useful (0 votes)
45 views5 pages

7 PDF

This document discusses different methods for approximating the first order derivatives in computational fluid dynamics calculations using finite difference methods. It describes: 1) Using Taylor series expansions to derive the forward, backward, and central difference schemes for approximating derivatives, which have truncation errors of O(Δx), O(Δx), and O(Δx) respectively. 2) A general procedure for deriving finite difference approximations on uniform grids involving polynomial fitting. 3) An example showing the derivation of a three-point backward difference formula using this procedure.
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)
45 views5 pages

7 PDF

This document discusses different methods for approximating the first order derivatives in computational fluid dynamics calculations using finite difference methods. It describes: 1) Using Taylor series expansions to derive the forward, backward, and central difference schemes for approximating derivatives, which have truncation errors of O(Δx), O(Δx), and O(Δx) respectively. 2) A general procedure for deriving finite difference approximations on uniform grids involving polynomial fitting. 3) An example showing the derivation of a three-point backward difference formula using this procedure.
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/ 5

COMPUTATIONAL FLUID DYNAMICS: FDM: Approximation of First Order Derivatives

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.

12.2 TAYLOR SERIES EXPANSION


A continuously differentiable function f(x) can be expanded in Taylor series about x  xi as

 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

Rearrangement of Eq. (12.2) yields

 f  fi 1  fi  xi 1  xi    2 f 
     2  H (12.4)
 x i xi 1  xi 2  x i

which gives us forward difference scheme (FDS) formally expressed as

 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

Dr K M Singh, Indian Institute of Technology Roorkee NPTEL 12.1


COMPUTATIONAL FLUID DYNAMICS: FDM: Approximation of First Order Derivatives

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

Thus, finite difference approximations based on Taylor series expansion are:

 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 2x

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

 CDS   i  2     H (12.9)


2  xi  xi 1   x i 6  xi  xi 1   x3 i
Thus, although the truncation error for CDS is formally of the same order as FDS or BDS, the
magnitude of the truncation error for CDS is much smaller than FDS/BDS. In fact, on grid refinement,
the convergence of CDS becomes second order asymptotically (Ferziger and Peric, 2003).

Further, let us substitute the value of second order derivative from Eq. (12.2) into Eq.
(12.4). On rearrangement, we get

 f  f i 1 (xi ) 2  f i 1 (xi 1 ) 2  f i (xi 1 ) 2  (xi ) 2  xi xi 1   3 f 


     3   H (12.10)
 x i xi xi 1  xi  xi 1  6  x i

which has second order accuracy on any grid (uniform or non-uniform). It reduces to the
simpler form of CDS on uniform grids.

A general procedure on uniform grids

Let us define the difference approximation as (Chung, 2010)


 f  af i  bf i 1  cfi 1  dfi  2  efi  2  ...
   (12.11)
 x i x
Coefficients a, b, c, d, e, …. can be determined from Taylor series expansion for the function
values involved at the RHS around point xi. We illustrate its use in the following example.

Dr K M Singh, Indian Institute of Technology Roorkee NPTEL 12.2


COMPUTATIONAL FLUID DYNAMICS: FDM: Approximation of First Order Derivatives

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

Taylor series expansions for fi 1 and f i  2 are


 f  x   f  x   f 
2 2 3 3
fi 1  fi  x     2    3   .... (ii)
 x i 2  x i 6  x i

 f   2x    f  (2x)   f 
22 3 3
fi  2  f i  2x     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:
abc 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)

The truncation error (TE) is given by


x2  3 f  x2  3 f 
   b  8c  3    3  (ix)
6  x i 3  x i

Therefore, the desired three-point backward difference formula is

 f  3 f i  4 fi 1  f i  2
   , TE ~ O  x 2  (x)
 x i 2x

Similarly, we can derive a three-point forward difference formula which is given by

 f  3 f i  4 fi 1  f i  2
   , TE ~ O  x 2  (x)
 x i 2x

Dr K M Singh, Indian Institute of Technology Roorkee NPTEL 12.3


COMPUTATIONAL FLUID DYNAMICS: FDM: Approximation of First Order Derivatives

12.3 POLYNOMIAL FITTING


A generic function f(x) can be approximated by a polynomial as

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

a1xi 1xi  xi  xi 1   xi2 f i 1  xi21 f i 1  f i  xi21  xi  (v)

Rearrangement of the preceding equation gives value of coefficient a1 , and thereby an


approximation for the first order derivative given by

 f  xi2 fi 1  xi21 fi 1  fi  xi21  xi2 


   a  (vi)
xi 1xi  xi  xi 1 
1
 x i

Dr K M Singh, Indian Institute of Technology Roorkee NPTEL 12.4


COMPUTATIONAL FLUID DYNAMICS: FDM: Approximation of First Order Derivatives

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 2x
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 6x

 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.

Dr K M Singh, Indian Institute of Technology Roorkee NPTEL 12.5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy