Page 273 - Numerical Methods for Chemical Engineering
P. 273

262     6 Boundary value problems



                   be satisfied locally:
                                          2          2
                                         ∂ ϕ        ∂ ϕ
                                       −          −         = f (x i , y j )          (6.17)
                                         ∂x 2   (x i ,y j )  ∂y  2   (x i ,y j )
                   The key idea of finite differences is to approximate these local derivatives by algebraic
                   differences of the field values at neighboring grid points.


                   Finite difference approximations

                   In the finite difference method, we approximate the value of the derivative of f (x)at x 0
                   using a truncated Taylor series approximation for small  x,


                                                           df            2
                                   f (x 0 +  x) = f (x 0 ) + ( x)     + O[( x) ]      (6.18)
                                                           dx
                                                              x 0
                   to yield

                                              f (x 0 +  x) − f (x 0 )
                                      df
                                            =                  + O[ x]                (6.19)
                                      dx              x
                                          x 0
                   Similarly, from the expansion in the opposite direction,

                                                            df           2
                                   f (x 0 −  x) = f (x 0 ) + (− x)     + O[( x) ]     (6.20)
                                                            dx
                                                               x 0
                   we obtain
                                              f (x 0 ) − f (x 0 −  x)

                                      df
                                            =                  + O[ x]                (6.21)
                                      dx              x
                                          x 0
                   Both of these one-sided difference approximations have errors proportional to  x, the
                   spacing between successive grid points. Subtracting the two,
                                                                            (
                                                           2  2

                                               df      ( x) d f            3
                        f (x 0 +  x) = f (x 0 ) + ( x)     +       + O[( x) ]
                                               dx        2  dx  2
                                                   x 0           x 0
                                                                               (
                                                              2  2

                                                   df     ( x) d f            3
                       − f (x 0 −  x) = f (x 0 ) − ( x)     +         + O[( x) ]      (6.22)
                                                   dx       2   dx  2
                                                      x 0           x 0
                   the zeroth-and second-order terms cancel out, and the resulting central difference approxi-
                   mation is second-order accurate,

                                           f (x 0 +  x) − f (x 0 −  x)
                                   df                                    2
                                        =                        + O[( x) ]           (6.23)
                                   dx              2( x)
                                      x 0
                   The error of (6.23) is proportional to the square of the grid point spacing, thus it decays
                   to zero as  x → 0 more rapidly than the errors of one-sided formulas. Equation (6.23) is
                   more accurate than (6.19) or (6.21).
   268   269   270   271   272   273   274   275   276   277   278