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 with explicit Euler ytrue e t G F Y t for this case instability if t 1 G F Y with implicit Euler t t old Yt new t F Y new t Yt ynew 1 2 ynew 3ynew 1 ynew 1 3 1 1 3 For t 2 e 2 ytrue ynew 1 3 2 ynew x 3ynew 1 3 ynew 1 9 x 1 4 true 2 e 4 ytrue 4 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 9 texplicit 10 1 CO 1 s 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 Y0known Y t 0 guess Y 0 Yi 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 Prof William Green Lecture 14 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 YYYY
View Full Document
Unlocking...