430 likes | 569 Views
Large Timestep Issues. Lecture 12 Alessandra Nardi. Thanks to Prof. Sangiovanni, Prof. Newton, Prof. White, Deepak Ramaswamy, Michal Rewienski, and Karen Veroy. Last lecture review. Transient Analysis of dynamical circuits i.e., circuits containing C and/or L Examples
E N D
Large Timestep Issues Lecture 12 Alessandra Nardi Thanks to Prof. Sangiovanni, Prof. Newton, Prof. White, Deepak Ramaswamy, Michal Rewienski, and Karen Veroy
Last lecture review • Transient Analysis of dynamical circuits • i.e., circuits containing C and/or L • Examples • Solution of ODEs (IVP) • Forward Euler (FE), Backward Euler (BE) and Trapezoidal Rule (TR) • Multistep methods • Convergence • Consistency
Outline • Convergence for multistep methods • Stability • Region of Absolute Stability • Dahlquist’s Stability Barriers • Stiff Stability (Large timestep issues) • Examples • Analysis of FE, BE • Gear’s Method • Variable step size • More on Implicit Methods • Solution with NR • Application of multistep to circuit equations
Forward-Euler Approximation: FE Discrete Equation: Multistep Coefficients: BE Discrete Equation: Multistep Coefficients: Trap Discrete Equation: Multistep Coefficients: Multistep Methods – Common AlgorithmsTR, BE, FE are one-step methods Multistep Equation:
Multistep Methods – Convergence AnalysisTwo conditions for Convergence 1) Local Condition: One step errors are small (consistency) Typically verified using Taylor Series 2) Global Condition: The single step errors do not grow too quickly (stability) All one-step methods are stable in this sense.
Multistep Methods – StabilityDifference Equation Why did the “best” 2-step explicit method fail to Converge? Multistep Method Difference Equation LTE Global Error We made the LTE so small, how come the Global error is so large?
An Aside on Solving Difference Equations Consider a general kth order difference equation Three important observations
Multistep Methods – StabilityDifference Equation Multistep Method Difference Equation Definition: A multistep method is stable if and only if Theorem: A multistep method is stable if and only if Less than one in magnitude or equal to one and distinct
Multistep Methods – StabilityStability Theorem Proof Given the Multistep Method Difference Equation are either If the roots of • less than one in magnitude • equal to one in magnitude but distinct Then from the aside on difference equations From which stability easily follows.
Multistep Methods – StabilityStability Theorem Proof Im Re -1 1
Multistep Methods – StabilityA more formal approach • Def: A method is stable if all the solutions of the associated difference equation obtained from (1) setting q=0 remain bounded if l • The region of absolute stability of a method is the set of q such that all the solutions of (1) remain bounded if l • Note that a method is stable if its region of absolute stability contains the origin (q=0)
Im(z) Re(z) -1 1 Multistep Methods – StabilityA more formal approach Def: A method is A-stable if the region of absolute stability contains the entire left hand plane (in the space) Im() Re() -1
Multistep Methods – StabilityA more formal approach • Each method is associated with two polynomials a and b: • a : associated with function past values • b: associated with derivative past values • Stability: roots of a must stay in |z|1 and be simple on |z|=1 • Absolute stability: roots of (a-bq) must stay in |z|1 and be simple on |z|=1 when Re(q)<0.
Multistep Methods – StabilityDahlquist’s Stability Barriers • First:For a stable, explicit k-step multistep method, the maximum number of exactness constraints that can be satisfied is less than or equal to k (note there are 2k coefficients). For implicit methods, the number of constraints that can be satisfied is either k+2 if k is even or k+1 if k is odd. • Second:There are no A-stable methods of convergence order greater than 2, and the trapezoidal rule is the most accurate. TR very popular (SPICE)
Multistep Methods – Convergence AnalysisConditions for convergence – Consistency & Stability 1) Local Condition: One step errors are small (consistency) Exactness Constraints up to p0 (p0 must be > 0) 2) Global Condition: One step errors grow slowly (stability) Convergence Result:
Multistep MethodsFE region of absolute stability Forward Euler ODE stability region Im(z) Difference Eqn Stability region Region of Absolute Stability Re(z) -1 1
Multistep MethodsBE region of absolute stability Backward Euler Im(z) Difference Eqn Stability region Re(z) -1 1 Region of Absolute Stability
Summary • Convergence for one-step methods • Consistency for FE • Stability for FE • Convergence for multistep methods • Consistency (Exactness Constraints) • Selecting coefficients • Stability • Region of Absolute Stability • Dahlquist’s Stability Barriers
Stiff Problems (Large Timestep Issues)Example Interval of interest is [0,5] Uniform step size (for accuracy) Dt 10-6 5x106 steps !!!
Stiff Problems (Large Timestep Issues)Example Strategy (for previous example): Take 5 steps of size 10-6 for accuracy during initial phase and then 5 steps of size 1. Stiff problem: • Natural time constants • Input time constants • Interval of interest If these are widely separated, then the problem is stiff
R2 R1 C1 R3 C2 Eigenvectors Eigenvalues Application ProblemsSignal Transmission in an IC – 2x2 example
Stiff Problems (Large Timestep Issues)FE on two time-constant circuit Forward-Euler Computed Solution The Forward-Euler is accurate for small timesteps, but goes unstable when the timestep is enlarged
Stiff Problems (Large Timestep Issues)BE on two time-constant circuit Circuit Example Backward-Euler Computed Solution With Backward-Euler it is easy to use small timesteps for the fast dynamics and then switch to large timesteps for the slow decay
Multistep Methods (Large Timestep Issues)BE, FE, TR on the scalar ODE problem Scalar ODE: Forward-Euler: Backward-Euler: Trap Rule:
ODE stability region ODE stability region Region of Absolute Stability Region of Absolute Stability Stiff Problems (Large Timestep Issues)FE on two time-constant circuit
Stiff Problems (Large Timestep Issues)BE on two time-constant circuit Region of Absolute Stability Region of Absolute Stability
Stiff Problems • We showed that: • The analysis of stiff circuits requires the use of variable step sizes • Not all the linear multistep methods can be efficiently used to integrate stiff equations • To be able to choose Dt based only on accuracy considerations, the region of absolute stability should allow a large Dt for large time constants, without being constrained by the small time constants • Clearly A-stable methods satisfy this requirement
Backward Differentiation Formula - BDF (Gear Methods) • Note that Gear’s first order method is BE • It can be shown that: • Gear’s methods up to order 6 are stiffly stable and are well-suited for stiff ODEs • Gear’s methods of order higher than 6 are not stiffly stable • Less stringent than A-stable
Gear’s Method region of absolute stability(outside the closed curve) k=1 k=2
Gear’s Method region of absolute stability(outside the closed curve) k=3 k=4
Variable step size • When the step size is changed during the integration, the coefficients of the method need to be recomputed at each iteration • Example: Gear’s method of order 2
More observations • To minimize the computation time needed to integrate differential equations, the Dt must be chosen as large as possible provided that the desired accuracy is achieved • Several approximation are available. SPICE2 uses Divided Differences • At a certain time point, different integration methods would allow different step size • Advantageous to implement a strategy which allows a change of method as well as of Dt
Summary on Stiff Stability • FE: timestep is limited by stability and not by accuracy • BE: A-stable, any timestep could be used • TR: most accurate A-stable multistep method • Gear: stiffly stable method (up to order 6) • The analysis of stiff circuits requires the use of variable timestep
Multistep MethodsMore on Implicit Methods Forward-Euler Backward-Euler Requires just function Evaluations Nonlinear equation solution at each step
Jacobian Multistep Implicit MethodsSolution with Newton Rewrite the multistep Equation Solve with Newton Here j is the Newton iteration index
Converged Solution Polynomial Predictor Multistep Implicit MethodsSolution with Newton Newton Iteration: Solution with Newton is very efficient Easy to generate a good initial guess using polynomial fitting Jacobian become easy to factor for small timesteps
Application of linear multistep methods to circuit equations
Transient Analysis Flow Diagram Predict values of variables at tl Replace C and L with resistive elements via integration formula Replace nonlinear elements with G and indep. sources via NR Assemble linear circuit equations Solve linear circuit equations NO Did NR converge? YES Test solution accuracy Save solution if acceptable Select new Dt and compute new integration formula coeff. NO Done?
Summary • Transient Analysis of dynamical circuits • Solution of ODEs (IVP) • FE, BE and TR • Multistep methods • Convergence • Consistency • Stability • Stiff Stability (Large timestep issues) • Gear’s method • Application of multistep to circuit equations • Did not talk about: • Runge-Kutta • Predictor-Corrector Methods
Summary on circuit simulation • Circuit Equation Formulation • STA, MNA • DC Analysis of Nonlinear Circuits • Solution of Linear Equations (direct and iterative methods) • Solution of Nonlinear Equations (Newton’s method) • Transient Analysis of Nonlinear Circuits • Solution of Ordinary Differential Equations- IVP (multistep methods)
Appendix to circuit simulation Preconditioners • The convergence rate of iterative methods depends on spectral properties of the coefficient matrix. Hence one may attempt to transform the linear system into one that is equivalent, but that has more favorable spectral properties. • A preconditioner is a matrix that effects such a transformation: Mx=b A-1Mx=A-1b • The choice of a preconditioner is largely application specific