18.336 spring 2009 lecture 13 03/19/09 Initial Value Problems (IVP) ⎧ ⎨ ut = Lu u = u0 ⎩ u=g where L ⎫ in Ω×]0, T [ ← PDE ⎬ on Ω × {0} ← initial condition ⎭ on ∂Ω×]0, T [ ← boundary condition differential operator. ⎫ Ex.: • L = �2 ⎪ ⎪ ⎪ ⎪ Poisson equation → heat equation ⎪ ⎪ ⎪ ⎪ •Lu = b · �u ⎪ ⎪ ⎪ ⎪ advection equation ⎬ 2 2 •Lu = −� (� u) not done yet. ⎪ ⎪ biharmonic equation → beam equation � ⎪ ⎪ ⎪ ⎪ •Lu = F |�u| ⎪ nonlinear ⎪ ⎪ ⎪ Eikonal equation → level set equation ⎪ ⎪ ⎭ • etc. � � Stationary solution of IVP: Lu = 0 in Ω (if it exists) u = g on ∂Ω ⎡ ⎤ Later: ⎢ second order problems ⇔ systems ⎥ ⎢ ⎥ � � � � � � ⎥ ⎢ ⎢ ⎥ ∂ ∂ u 0 1 u ⎢ utt = uxx ⎥ = · ⎣ ⎦ 1 0 ∂t v ∂x v (wave equation) Semi-Discretization • In space (method of lines): Approximate u(·, t) by �u(t) Approximate Lu by A · �u (for linear problems) [FD, FE, spectral] d → system of ODE: �u = A · �u dt • In time: Approximate time derivative by step: d u(x, t + Δt) − u(x, t) u(x, t) ≈ [explicit Euler] dt Δt → Stationary problem: unew (x) = u(x) + ΔtLu(x) = (I + ΔtL)u(x) Need to know about ODE solvers. 1 Numerical Methods for ODE � ẏ(t) = f (y(t)) y(0) = ẙ � y(t) ∈ Rd y n ≈ y(t), y n+1 ≈ y(t + Δt) y n+1 − y n Linear approximation: ẏ ≈ Δt Explicit Euler (EE): y n+1 = y n + Δt · f (y n ) Implicit Euler (IE): y n+1 − Δt · f (y n+1 ) = y n nonlinear system ← Newton iteration. Local truncation error (LTE): EE: τ n = y(t + Δt) − (y(t) + Δtf (y(t))) = 12 ÿ(t)Δt2 = O(Δt2 ) IE: τ n = O(Δt2 ) Global truncation error (GTE): T Over N = time steps. Δt E n = y n − y(tn ) E n+1 = E n + Δt(f (y n ) − f (y(tn ))) + τ n =⇒ |E n+1 | ≤ |E n | + ΔtL|E n | + |τ n | T =⇒ |E N | ≤ eLT Δt maxn |τ n | = O(Δt) Time Stepping: GTE = one order less than LTE. Higher Order Time Stepping • Taylor Series Methods: Start with EE, add terms to eliminate leading order error terms. PDE → Lax-Wendroff • Runge-Kutta Methods: Each step = multiple stages � k1 = f (y n + Δt aij kj ) j .. . kr y n+1 � = f (y n + Δt arj kj ) � j = y n + Δt bj kj j Butcher tableau: (cl = � alj ) j 2 c1 .. . cr a11 . . . .. .. . . ar1 . . . b1 . . . a1r .. c A . = bT arr br k1 = f (y n ) n+1 y = y n + Δtk1 0 EE: 1 =y n+1 1 1 1 IE: � �� � k1 = f (y n + Δt · k1 ) y n+1 = y n + Δt · k1 0 Explicit midpoint: 1 2 1 2 0 1 0 1 1 Heun’s: 1 2 1 2 0 1 2 1 2 RK4: 1 2 1 2 1 Implicit trapezoidal: 1 2 1 1 6 1 2 1 3 1 3 1 6 PDE → Crank-Nicolson 1 • Multistep Methods: r r � � n+j αj y = Δt βj f (y n+j ) j=0 j=0 Explicit Adams-Bashforth: = EE y n+1 = y n + Δtf (y n ) 3 1 n+2 n+1 n+1 n y = y + Δt · [ 2 f (y ) − 2 f (y )] .. . Implicit Adams-Moultion: y n+1 = y n + Δt · ( 12 f (y n ) + 12 (y n+1 )) 5 8 y n+2 = y n+1 + Δt · ( 12 f (y n+2 ) + 12 f (y n+1 ) − .. . O(Δt) O(Δt2 ) = trapezoidal 1 f (y n )) 12 BDF (backward differentiation): y n+1 = y n + Δtf (y n+1 ) = IE 3y n+2 − 4y n+1 + y n = 2Δtf (y n+2 ) .. . 3 O(Δt) O(Δt2 ) O(Δt2 ) O(Δt3 ) Linear ODE Systems � ẏ = A · y y(0) = ẙ solution: y(t) = exp(tA) · ẙ solution stable, if Re(λi (A)) < 0 ∀i. =M EE: y n+1 IE: y n+1 � ��EE � = (I + Δt · A) ·y n = (I − Δt · A)−1 · y n � � �� =MIE Iteration y n+1 = M · y n stable, if |λi (M )| < 1 ∀i λi eigenvalue of A ⎧ ⎫ 2 ⎨ 1 + Δt · λi eigenvalue of MEE ⎬ |1 + Δt · λi | < 1 if Δt < � � |λi | ⇒ 1 � � 1 ⎩ � � < 1 always eigenvalue of MIE ⎭ � 1 − Δt · λi � 1 − Δt · λi 2 EE conditionally stable: Δt < ρ(A) IE unconditionally stable Message: One step implicit is more costly than one step explicit. But: If ρ(A) large, then implicit pays! � �� � stiffness Ex.: Different time scales � � � � −50 49 2 A= , ẙ = 49 −50 0 � � � � 1 −1 −t −99t Solution: y(t) = e · +e · 1 1 � �� � � �� � behavior Ex.: restricts Δt for EE −2 1 . . . . ⎢ . . 1 ⎢ 1 A= ·⎢ 2 . .. ... 1 (Δx) ⎣ 1 −2 � �� ⎡ −4<λi <0 ⎤ ⎥ ⎥ ⎥ ⎦ heat equation 4 ⇒ ρ(A) < � (Δx)2 (Δx)2 . 2 OTOH: Crank-Nicolson � � � � Δt Δt n+1 I− A ·y = I+ A · yn 2 2 Unconditionally stable. EE stable if Δt < 4 MIT OpenCourseWare http://ocw.mit.edu 18.336 Numerical Methods for Partial Differential Equations Spring 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.