Page 213 - Fundamentals of Ocean Renewable Energy Generating Electricity From The Sea
P. 213

202 Fundamentals of Ocean Renewable Energy


            where the variable u is the temperature. Because u(x) is a continuous function,
            there are an infinite number of points along this rod. However, it is much easier
            if we consider a finite number of discrete points along this rod. In numerical
            notation
                                u(x i ) =?  x = x 1 , x 2 , ... , x N   (8.3)
            If we distribute these discrete points uniformly along the rod, the spacing
            between the grid points will be Δx = L/(N − 1). Consequently,
                       x 1 = 0, x 2 = Δx, x 3 = 2Δx, ... , x N = (N − 1)Δx  (8.4)
               To find the temperature at each point, we need to solve the following
            differential equation
                                              2
                                       ∂u    ∂ u
                                          = k                           (8.5)
                                       ∂t    ∂x 2
            where k is a constant and depends on the material property of the rod.
            8.2 NUMERICAL METHODS

            8.2.1 Finite Difference Method
            To solve a differential equation like Eq. (8.5), we need to evaluate derivatives.
            Recalling from calculus (Chapter 2), the derivative of a function is defined as:
                                du        u(x + Δx) − u(x)
                                   = lim                                (8.6)
                                dx   Δx→0      Δx
               From a geometrical perspective, the derivative at a point equals the slope of
            the tangent line at this point.
               As an approximation, the derivative can be estimated as
                            du   u(x + Δx) − u(x)        L
                                                 Δx =                   (8.7)
                            dx         Δx              N − 1
               It is clear that as the number of grid points (N) increases, Eq. (8.7) leads to
            more accurate values. Referring to the simple rod example, the derivative at a
            general point x i can be approximated as

                        u(x i + Δx) − u(x i )  u(x i+1 ) − u(x i )  u(x i+1 ) − u(x i )
               du
                                        =              =                (8.8)
               dx             Δx               Δx           x i+1 − x i
                  x=x i
            which is called a finite difference. Specifically, a finite difference of the form of
            Eq. (8.8) is called a forward difference.
               Alternatively, if we use function values at grid points x i−1 and x i , we call it
            a backward difference:

                        u(x i ) − u(x i − Δx)  u(x i ) − u(x i−1 )  u(x i ) − u(x i−1 )
               du
                                        =              =                (8.9)
               dx             Δx               Δx           x i − x i−1
                  x=x i
   208   209   210   211   212   213   214   215   216   217   218