Page 190 - Numerical methods for chemical engineering
P. 190

176     4 Initial value problems



                   Overview of ODE-IVP solvers in MATLAB

                   We next provide an overview of ODE-IVP solvers. The contents of this section provide a
                   sufficient background to solve problems of the form

                                           ˙ x = f (x; Θ)  x(t 0 ) = x [0]           (4.113)
                   First, we describe the basic time-marching approach of ODE-IVP solvers and contrast
                   explicit and implicit, single-step and multistep solvers. Then, we demonstrate the use of the
                   explicit single-step solver ode45 and the implicit multistep solver ode15s.


                   Time-marching ODE-IVP solvers

                   ODE solvers update x(t) in discrete time steps of size  t to compute x(t k ) at times t 0 < t 1
                   < t 2 < ··· . For a constant time step, t k = t 0 + k( t); but often  t varies throughout the
                   course of the simulation.  t is smaller for greater accuracy when x(t) changes rapidly and
                   is larger for increased simulation speed when x(t) changes slowly. Over each time step, the
                   exact update of the state vector is
                                            '  t k + t    '  t k + t
                           x(t k +  t) − x(t k ) =  ˙ x(t)dt =  f (x(t); Θ)dt        (4.114)
                                             t k           t k
                   If x [k]  = x(t k ), the new state at t k+1 = t k +  t can be estimated by a rule that approximates
                   (4.114), of the form
                        [k+1]  [k]          [k]  [k+1]          [k+1]
                       x    − x   = ( t)F x , x    , f (x; Θ)  x    ≈ x(t k+1 )      (4.115)
                      [k]
                   F[x , x [k+1] , f (x; Θ)] is a rule involving the old and new states that defines the method.
                   At each step, there is introduced a new local error, proportional to some power of  t, that
                   is the difference between the approximate update (4.115) and the exact update (4.114).
                                                                                 [k]
                     As (4.115) uses information only about the state values at the beginning, x , and end,
                   x [k+1] , of the current time step, it is said to define a single-step integration method.For
                   example, in the Crank–Nicholson method

                                 [k]  [k+1]        1       [k]        [k+1]
                           F CN x , x   , f (x; Θ) ≡  f x ; Θ + f x   ; Θ            (4.116)
                                                   2
                   and in the implicit (backward) Euler method
                                           [k]  [k+1]             [k+1]
                                     F BE x , x   , f (x; Θ) ≡ f x  ; Θ              (4.117)
                   Because f (x; Θ) generally is nonlinear, (4.115) often cannot be rearranged to provide a
                   direct expression for x [k+1] . Then, (4.115) is said to generate an implicit integration method
                   that requires a nonlinear algebraic system to be solved at each time step.

                   Explicit single-step methods

                   By contrast, an explicit single-step integration method
                                                           [k]

                                        x [k+1]  − x [k]  = ( t)F x , f (x; Θ)       (4.118)
   185   186   187   188   189   190   191   192   193   194   195