CS05b/CME306 Lecture 4 Time Integration We now consider seeral popular approaches for integrating an ODE Forward Euler Forward Euler eolution takes on the form n+ = n + Because forward Euler is unstable when the system contains pure imaginary eigenalues, it is unstable without damping In particular, a < 0 Forward Euler is stable when λ + < A time step restriction of λ is required As problems get stiffer, ma λ becomes larger, and consequently the time step that can be taken becomes smaller The stability region for forward Euler is shown in Figure a If the system has eigenalues near the imaginary ais, we would be much better off using using a different method such as one of the higher order Runge-Kutta methods Runge-Kutta Methods There are a number of Runge-Kutta methods in common use The Runge-Kutta methods were discussed in more detail in CS05A, so they are only highlighted here The second order Runge- Kutta method is technically linearly unstable without damping since its stability region does not include the imaginary ais Roundoff with a < 0 may be sufficient, and nonlinear effects can sometimes rectify the problem The third order Runge-Kutta method is stable without damping, since its stability region includes part of the imaginary ais It is suitable for system with a = 0 Stability regions for arious Runge-Kutta methods are shown in Figure 3 Backward Euler The need for a time step restriction is true of all eplicit methods By contract, implicit methods often hae a much better time step restriction that makes them more suitable een though they require a linear system sole and are thus much more epensie per step Backward Euler is the simplest of the implicit methods Its stability region Figure a looks ery different from those of the eplicit integrators It takes the form n+ = n + a a n n+
a Forward Euler First Order Runge-Kutta b Second Order Runge-Kutta c Third Order Runge-Kutta d Fourth Order Runge-Kutta Figure : Stability regions for Runge-Kutta The scheme is stable with time step size if λ, a comple number in general, is located within the shaded region of the comple plane Note that the third and fourth order schemes hae stability regions that encompass the imaginary ais, making them stable on undamped problems The first and second order schemes do not hae this property
a Backward Euler b Trapezoid Rule Figure : Stability regions for two implicit time integration schemes The scheme is stable with time step size if λ, a comple number in general, is located within the shaded region of the comple plane Note that the new alues being obtained occur on both sides of the equation, so a sole is typically necessary at each time step Backward Euler has no time step restriction for stability, but large time steps do result in poor accuracy The sole required for backward Euler can be relatiely easy in the case of linear ODEs For eample, if the only force is drag, F = k and a = k/m Then, n+ = n k n+ /m so that n+ = + k/m n and n+ = n + n+ = n + + k/m n are relatiely easily obtained Note that this damps elocity each time step, and it damps more with larger time steps This is in contrast to forward Euler, where n+ = k/m n Damping here occurs if < m/k = ma λ but amplification occurs for larger time steps More generally, backward Euler requires soling a linear system If the ODE is nonlinear, it will typically be more difficult and epensie to sole and requires that the nonlinear system first be linearized 4 Trapezoid Rule Forward Euler eolution takes on the form n+ = n + a n + a n+ Because forward Euler is unstable when the system contains pure imaginary eigenalues, it is unstable without damping In particular, a < 0 Forward Euler is stable when λ + < A time step restriction of λ is required As problems get stiffer, ma λ becomes larger, and consequently the time step that can be taken becomes smaller The stability region for forward 3
= e t = 4 = = = 4 0 0 3 Figure 3: Effects of large time step sizes on numerical simulation of y = y with backward Euler Euler is shown in Figure b If the system has eigenalues near the imaginary ais, we would be much better off using using a different method such as one of the higher order Runge-Kutta methods 5 Newmark Method Newmark methods are the most famous of the multialue methods in computation solids Multialue methods are those that take adantage of the fact that higher order deriaties can be computed at lower accuracy to be more efficient The Newmark method is a two-parameter family of methods: n+ = n + n + βan + βa n+ n+ = n + γa n + γa n+ The specific method depends on the choice of β and γ chosen Constant acceleration equations, β = γ = 0 Implicit acceleration, β = / and γ = n+ = n + n + an n+ = n + a n n+ = n + n + an+ n+ = n + γa n+ The elocity update is the first order backward Euler update The position update can be written as n+ = n + n + n+, which is just the second order accurate trapezoid rule This choice is still only first order accurate oerall There is a theorem that states that second order accuracy is obtained if and only if γ = / The following two methods are second order Newmark methods 4
Trapezoid rule, β = /4 and γ = / n+ = n + n + a n + a n+ n+ = n + an + a n+ This method gets its name since the position equation can also be rewritten as a trapezoid rule update as n+ = n + n + n+ Central differencing, β = 0 and γ = / n+ = n + n + an n+ = n + an + a n+ The name of this method comes from the ability of its updates to be epressed as the central differences n+ n = n n+ n + n = a n These equations can be obtained by n+ + n = n+ n n+ n n+ n n+ n = n+ n + n n+ n + n n+ n + n n+ n + n n + n + an = n + an + n + an + = n + n + an + a n = n n + n + an = n + an n an = n n + an a n = n + an + a n = a n n + n + an n + n + an n + an a n 6 Staggering the Position and Velocity Define elocity halfway between time steps so that the update n+/ = n+ n 5
is second order accurate Note that n is still defined at the normal times We can then define n by aeraging nearby elocities as n = n/ + n+/ = n+ n, which is also central differencing for elocity The update formula for positions is then just Acceleration is also at grid points so the update a n = a n, n = a n+ = n + n+/ n, n/ + n+/ n+/ = n/ + a n is also second order accurate We also hae the second order accurate central difference formula n+ n + n = a n We can combine these formulas to obtain the eplicit formula for a half time step n+/ n = n/ + n+/ n = n+/ a n + n+/ = n + an which is then used to update positions Note that these two steps are equialent to n+ = n + n + an Finally, elocities are updated another half step using the implicit update The oerall elocity update is n+ = n+/ + n+3/ n+ = n+/ + n+/ + a n+ n+ = n+/ + an+ = n+/ + an+, n+ n+ = n+/ + an+, n+ = n + an, n + an+, n+ which is just the trapezoid rule The dependence of acceleration on elocity is often symmetric eg, damping forces, so that a fast soler like preconditioned conjugate gradient can be employed 6