Numerical Methods for Partial Differetial Equatios CAAM 45 Sprig 005 Lecture 4 -step time-steppig methods: stability, accuracy Ruge-Kutta Methods, Istructor: Tim Warburto
Today Recall AB stability regios ad start up issues Group aalysis of the Leap-Frog scheme Oe-step methods Example Ruge-Kutta methods: Modified Euler Geeral family of d order RK methods Heu s 3 rd Order Method The 4 th Order Ruge-Kutta method Jameso-Schmidt-Turkel Liear Absolute Stability Regios for the d order family RK Global error aalysis for geeral -step methods (stops slightly short of a full covergece aalysis) Warig o usefuless of global error estimate Discussio o AB v. RK Embedded lower order RK schemes useful for a posteriori error estimates. CAAM 45 Sprig 005
Recall: AB v. AB3 v. AB4 These are the margis of absolute stability for the AB methods: Startig with the yellow AB (Euler-Forward) we see that as the order of accuracy goes up the stability regio shriks. i.e. we see that to use the higher order accurate AB scheme we are required to take more time steps. Q) how may more? CAAM 45 Sprig 005
AB: AB: AB3: Recall: Requiremets Startig Requiremets u0 = u( 0) u ( ) + = u + dt f u u = u( dt) u = u( 0) 0 3 u = u + dt f u f u u = u dt + 0 ( 0) u = u dt u = u dt u = u + f f + f ( 3 6 5 ) + solutio level for start solutio levels for start 3 solutio levels for start CAAM 45 Sprig 005
cot So as we take higher order versio of the AB scheme we also eed to provide iitial values at more ad more levels. For a problem where we do ot kow the solutio at more tha the iitial coditio we may have to: Use AB with small dt to get the secod restart level Use AB with small dt to get the third restart level March o usig AB3 started with the three levels achieved above. AB AB AB3 CAAM 45 Sprig 005
Recall: Derivatio of AB Schemes The AB schemes were motivated by cosiderig the exactly time itegrated ODE: Which we approximated by usig a p th order polyomial iterpolatio of the fuctio f + u t u t f u t dt + = + t + p t t t u t u t I f u t dt + + CAAM 45 Sprig 005
Leap Frog Scheme We could also have started the itegral at: t + Ad used the mid poit rule: Which suggests the leap frog scheme: t t + u t u t f u t dt = + + u t u t dtf u t + u u dtf u + = + CAAM 45 Sprig 005
Voluteer Exercise u u dtf u + = + ) accuracy: what is the local trucatio error? ) stability: what is the maifold of absolute liear stability (try aalytically) i the u=dt*mu plae? a) what is the regio of absolute liear-stability? CAAM 45 Sprig 005
cot u u dtf u + = + 3) How may startig values are required? 4) Do we have covergece? 5) What is the global order of accuracy? 6) Whe is this a good method? CAAM 45 Sprig 005
Oe Step Methods Give the difficulties iheret i startig the higher order AB schemes we are ecouraged to look for oe-step methods which oly require to evaluate i.e. u u + u = u + dt Φ + u, t; dt Euler-Forward is a oe-step method: u = u + dtf u Φ + u, t ; dt : = f u We will cosider the oe-step Ruge-Kutta methods. For itroductory details see: A itroductio to umerical aalysis, Suli ad Mayers,. (p37) ad o Trefethe p75- Gustafsso,Kreiss ad Oliger p4- CAAM 45 Sprig 005
Ruge-Kutta Methods The Ruge-Kutta are a family of oe-step methods. They cosist of s stages (i.e. require s evaluatios of f) They will be p th order accurate, for some p. They are self startig!!!. CAAM 45 Sprig 005
Example Ruge-Kutta Method (Modified Euler) a = dtf ( u, t ) Modified Euler: a dt b = dtf u, t + + u+ = u + b Note how we oly eed oe startig value. We ca also reiterpret this through itermediate values: dt uˆ = u + f ( u, t ) u+ = u + dtf ( uˆ, t+ / ) This looks like a half step to approximate the miditerval u ad the a full step. This is a -stage, d order, sigle step method. CAAM 45 Sprig 005
Liear Stability Aalysis As before we assume that f is liear i u ad idepedet of time The scheme becomes (for some give mu): dt uˆ = u + f u t u = u + dtf u t (, ) ( ˆ, ) + + / dt uˆ = u + µ u u = u + dtµ uˆ + Which we simplify (elimiate the uhat variable): dt uˆ = u + µ u ( dt ) u = u + µ dtµ u + + u u = u + dtµ uˆ + CAAM 45 Sprig 005
cot We gather all terms o the right had side: ( dtµ ) u+ = + dtµ + u [ Note: the bracketed term is exactly the first 3 terms of the Taylor series for exp(dt*mu), more o that later ] We also ote for the umerical solutio to be bouded, ad the scheme stable, we require: ( dtµ ) + dtµ + CAAM 45 Sprig 005
cot The stability regio is the set of u=mu*dt i the complex plae such that: ν + ν + The maifold of margial stability ca be foud (as i the liear multistep methods) by fixig the multiplier to be of uit magitude ad lookig for the correspodig values of u which produce this multiplier. i.e. for each theta fid u such that ν + ν + = i e θ CAAM 45 Sprig 005
cot We ca maually fid the roots of this quadratic: ν + ν + = i e θ To obtai a parameterized represetatio of the maifold of margial stability: ( i ) ν = ± e θ CAAM 45 Sprig 005
Plottig Stability Regio for Modified Euler ( i ) ν = ± e θ CAAM 45 Sprig 005
Checkig Modified Euler at the Imagiary Axis As before we wish to check how much of the imagiary axis is icluded iside the regio of absolute stability. Here we plot the real part of the + root CAAM 45 Sprig 005
Is the Imagiary Axis i the Stability Regio? We ca aalytically zoom i by choosig u=i*alpha (i.e. o the imagiary axis). We the check the magitude of the multiplier: 4 ν α α α + ν + = + iα = α + = + 4 So we kow that the oly poit o the imagiary axis with multiplier magitude bouded above by is the origi. Modified Euler is ot suitable for the advectio equatio. CAAM 45 Sprig 005
Geeral stage RK family Cosider the four parameter family of RK schemes of the form: k = (, ) ( β, α ) f u t k = f u + dtk t + dt u = u + dt ak + bk + where we will determie the parameters (a,b,alpha,beta) by cosideratio of accuracy. [ Euler-Forward is i this family with a=,b=0 CAAM 45 Sprig 005
cot The sigle step operator i this case is: k = (, ) ( β, α ) (, ) β f u t k = f u + dtk t + dt u = u + dt ak + bk + u = u + Φ u t + where Φ u, t = af u, t + bf u + dtf u, t, t + αdt CAAM 45 Sprig 005
cot We ow perform a trucatio aalysis, similar to that performed for the liear multistep methods. We will use the followig fact: du dt = (, t) f u t d u d f f du f f (, ) dt dt t u dt t u 3 d u d f f f... 3 dt dt t u = f u t t = + = + f = + = f f f f f f f + + + + + t t u u t u u t u f f f f CAAM 45 Sprig 005
cot (accuracy) We expad Phi i terms of powers of dt usig the bivariate Taylor s expasio ( ) β where: ( α ) Φ u t, t = af u, t + bf u + dtf u, t, t + dt f + f f = af + b αdt + βdtf + + O dt t u ( αdt) f f ( βdtf ) f ( αdt)( βdt) f + +! t t u! u (, ) f = f u t t 3 CAAM 45 Sprig 005
cot We costruct the local trucatio error as: ( ) (, ) T = u t + dt u t dtφ u t t dt dt = dtf + ft + ffu + ftt + ftu f + fuu f + fu ft + fu f 3! ( α dt) ( βdtf ) dtaf + b f + αdtf + βdtff + f + αβdt ff + f + O dt 4 t u tt tu uu Now we choose a,b,alpha,beta to miimize the local trucatio error. Note we use subidexig to represet partial derivatives. CAAM 45 Sprig 005
cot Cosider terms which are the same order i dt i the local trucatio error: dt dt T = dtf + ( ft + ffu ) + ( ftt + ftu f + fuu f + fu ( ft + fu f )) 3! αdt βdtf dtaf + b f + αdtft + βdtffu + ftt + αβdt fftu + fuu + O dt Coditio : a b = 0 4 Coditio : ( ft + ffu ) b( αdtft + βdtffu ) = 0 f bα = bβ = Uder these coditios, the trucatio is order 3 so the method is d order accurate. It is ot possible to further elimiate the dt^3 terms by adjustig the parameters. CAAM 45 Sprig 005
Case: No Explicit t Depedece i f ( u ( t ), t ) bf u βdtf ( u) Φ = + ( βdtf ) f f = bf + βdtf + O dt + u! u 3 du d u f d u f f ( ), 3 = f u t = f = f + f dt dt u dt u u ( ; ) T = u t u t dtφ u t dt + ( dt) ( 3 ) = dt + + ( fuu f + fu f ) dt b + + f + O d 3! dt dt β f ff 4 u f βdtff u uu t b =, β = It is easier to geeralize to higher order RK i this case whe there is o explicit time depedece i f. CAAM 45 Sprig 005
Secod Example Ruge-Kutta: Heu s Third Order Formula Traditioal versio (, ) a = dtf u t a dt b = dtf u, t + + 3 3 b dt c = dtf u +, t + 3 3 u+ = u + ( a + 3c) 4 I terms of itermediate variables: dt uˆ = u + f ( u, t ) 3 dt uˆ = u + f ( uˆ, t+ /3 ) 3 u = u + f u t + f u t 4 ( (, ) 3 ( ˆ, )) + + /3 This is a 3 rd order, 3 stage sigle step explicit Ruge-Kutta method. CAAM 45 Sprig 005
Agai Let s Check the Stability Regio dt uˆ = u + f ( u, t ) 3 dt uˆ = u + f ( uˆ, t+ /3 ) 3 u = u + f u t + f u t 4 ( (, ) 3 ( ˆ, )) + + /3 With f=mu*u reduces to a sigle level recursio with a very familiar multiplier: dt uˆ = u + µ u 3 dt dt uˆ = u + µ u + µ u 3 3 dt dt dt u = u + µ u 3µ u µ u µ u 4 + + + 3 3 + dt dt dt = u + µ 3µ µ µ u 4 + + + 3 3 ( µ dt) ( µ dt) = + µ dt + + 3 3 u CAAM 45 Sprig 005
Stability of Heu s 3 rd Order Method Each margially stable mu*dt is such that the multiplier is of magitude, i.e. 3 ν ν + ν + + = 6 This traces a curve i the u=mu*dt complex plae. Sice we are short o time we ca plot this usig Matlab s roots fuctio i e θ CAAM 45 Sprig 005
Stability Regio for RK (s=p) rk3 rk rk4 CAAM 45 Sprig 005
Heu s Method ad The Imagiary Axis This time we cosider poits o the imagiary axis which are close to the origi: ν = iα 3 α α + iα i 6 3 α α = + α 6 4 6 α α = + 36 rk3 Ad this is bouded above by if α 3.73 CAAM 45 Sprig 005
Observatio o RK liear stability For the s th order, s stage RK we see that the stability regio grows with icreasig s: Cosequetly we ca take a larger time step (dt) as the order of the RK scheme icrease. O the dow side, we require more evaluatios of f CAAM 45 Sprig 005
Popular 4 th Order Ruge-Kutta Formula Four stages: a = dtf u, t b = dtf u + a /, t c = dtf u + b /, t d = dtf u + c, t + + / + / u+ = u + a + b + c + d 6 see: http://web.comlab.ox.ac.uk/oucl/work/ick.trefethe/all.pdf of miimum umber of stages to achieve p th order. p76 for details CAAM 45 Sprig 005
Imagiary Axis (agai) With the obvious multiplier we obtai: ν = iα 3 4 ν ν ν + ν + + + = 6 4 3 4 6 8 α α α α α + iα i + = + 6 4 7 4 For stability we require: α α 7 4 6 8 8 α i.e. α.83 rk4 CAAM 45 Sprig 005
Imagiary Axis Stability Summary.83 for the 4 th Order Ruge-Kutta method.73 for Heu s 3 rd Order Method 0 for modified Euler CAAM 45 Sprig 005
Boudig the Global Error i Terms of the Local Trucatio Error Theorem: Cosider the geeral oe-step method u = u + dt Φ + u, t; dt ad we assume that Phi is Lipschitz cotiuous with respect to the first argumet (with costat L Φ ) i.e. for (, ; ) (, ; ) { } u, t, v, t D = u, t : t t t, u u C we have: Φ u t dt Φ v t dt L u v 0 max 0 The assumig u ( t ) u ( t ) C = N it follows that 0,,.., T u u t e, = 0,,..., N where T = max T ( L Φ( t ) ) t 0 L 0 N Φ Φ CAAM 45 Sprig 005
cot Proof: we use the defiitio of the local trucatio error: T = ( u( t + dt) u( t )) dtφ( u( t ), t ) to costruct the error equatio: we use the Lipschitz cotiuity of Phi: tidyig: ( ) u t + u + = u t u + dt Φ u t, t Φ u, t + T u t u u t u + dtl u t u + T + + Φ u t u dtl u t u T + + + Φ + CAAM 45 Sprig 005
( ) proof cot u t u + dtl u t u + T + + Φ { } ( ) ( ) + dtl + dtl u t u + T + T + ( dtl ) u( t ) u T ( dtl ) m= T + m= 0 m Φ Φ Φ 0 0 m Φ m= 0 ( dtl ) Φ m m= + + + { } m= max ( ) { max } m dtlφ Tm dtlφ Tm + = m m m= 0 Φ T ( + ) T ( + ) dtl + dtlφ e dtl dtl T dtl Φ Φ ( L ) Φ t+ t0 e Φ Φ m + + + dtl CAAM 45 Sprig 005
proof summary We ow have the global error estimate: T u t u e ( L ) Φ t+ t0 + + dtlφ Broadly speakig this implies that if the local trucatio error is h^{p+} the the error at a give time step will scale as O(h^p): p ( + ) + u t u O h Covergece follows uder restrictios o the ODE which guaratee existace of a uique C solutio ad stable choice of dt. CAAM 45 Sprig 005
Warig About Global Error Estimate It should be oted that the error estimate is of almost zero practical use. T u t u e ( L ) Φ t+ t0 + + dtlφ I the full covergece aalysis we pick a fial time t ad we will see that expoetial term agai. Covergece is guarateed but the costat ca be extraordiarily large for fiite time: L Φ ( L ) Φ t t0 e CAAM 45 Sprig 005
A Posteriori Error Estimate There are examples of RK methods which have embedded lower order schemes. i.e. after oe full RK time step, for some versios it is possible to use a secod set of coefficiets to recostruct a lower order approximatio. Thus we ca compute the differece betwee the two differet approximatios to estimate the local trucatio error committed over the time step. google: ruge kutta embedded Numerical recipes i C: http://www.library.corell.edu/r/bookcpdf/c6-.pdf CAAM 45 Sprig 005
My Favorite s Stage Ruge-Kutta Method There is a s stage Ruge-Kutta method of particular simplicity due to Jameso-Schmidt- Turkel, which is of iterest whe there is o explicit time depedece for f u for m=0:s- + u dt u = u + f u s m ed u = = u CAAM 45 Sprig 005
RK v. AB Whe should we use RK ad whe should we use AB? rk3 rk rk4 CAAM 45 Sprig 005
Class Cacelled o 0/7/05 There will be o class o Thursday 0/7/05 The homework due for that class will be due the followig Thursday 0/4/05 CAAM 45 Sprig 005