Implicit ODE Solvers Stiff Solvers Shooting Root-finding (Newton, Broyden)10.34, Numerical Methods Applied to Chemical Engineering Professor William H. Green Lecture #14: Implicit Ordinary Differential Equation (ODE) Solvers. Shooting. Implicit ODE Solvers dy/dt = -y y(t=0) = 1 ytrue = e-twith explicit Euler G = F(Y(t)) for this case, instability if Δt > 1 with implicit Euler G = F(Y (t+Δt)) For Δt = 2, )Δnewt*F(YYYoldtnewtt+=Δ+ ynew = 1+2(-ynew) 1 1/31/4x 2 4 xtrue 3ynew = 1 Î ynew = 1/3 e-2=ytrue ynew = 1/3 + 2(-ynew) 3ynew = 1/3 Î ynew = 1/9 e-4=ytrue Figure 1. Comparison of implicit Euler to true value. Accuracy low, but Implicit Euler does not become numerically unstable. Explicit Euler decays too fast. Implicit Euler decays too slow, but it allows one to use larger timesteps. Stiff Solvers Stiff: tf – t0 >> Δtmax because of instability because of accuracy Explicit |λ|maxΔt ≤ 1 for stability Stiff solvers: ode15s Å usually better ode23s Å super stiff Non-stiff ode45 Å explicit method Example: CO + ½O2 Æ CO2 In the presence of H2, H2O OH + CO Æ H + CO2 H + O2 Æ OH + O 1/λOH ~ 10-9 s 1/λCO ~ 1 s Δtexplicit ≤ 10-9 s Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].9 orders of magnitude difference in time scales In diffusion problems λfast/λslow ~ Nmesh2 ~ 1/(Δx)2 so a fine mesh makes the problem very stiff. Shooting Figure 2. |-------------------| x y = height of cannonball Y(t=0)= ⎟⎟⎠⎞⎜⎜⎝⎛guessknownYY00Yi(tf) = Yspecial Y(tf) Å ode15s(…,Yos,…) Root-finding (Newton, Broyden) g(Yguess) = 0 g = Yi(tf) – Yspecial Yi(tf) Å ode15s(…, Yguess,…) Ybestguess = bisect(@g, [Ylowguess,Yhighguess],tol) |g(Ybestguess)|<ftol|Ybestguess – Ytrueguess| < xtol function error = g(Yguess) Y0 = […, Yguess] Yf = ode15s(@F,Yo,tf,tol,options) error = Yf(nspecial) - Yspecial inside ode’s events Î stop integrating when something happens 10.34, Numerical Methods Applied to Chemical Engineering Lecture 14 Prof. William Green Page 2 of 2 Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month
View Full Document