ME451 Kinematics and Dynamics of Machine Systems Dynamics of Planar Systems December 9, 2010 Solving Index 3 DAEs using Newmark Method © Dan Negrut, 2010 ME451, UW-Madison Before we get started… Last Time: Started discussion on the numerical solution of DAEs of Multibody Dynamics using Newmark’s method Today Finish the discussion started last time Marks the end of the Dynamics Analysis of Mechanical Systems chapter Discuss the final exam Class evaluation forms need to be filled out Finish a bit early today, have to introduce Hammad in the graduate student seminar at 12 noon. Next time: last class Equilibrium Analysis and Inverse Dynamics 2 Solution Strategy: Important Slide This slide explains the strategy through which the numerical solution; i.e., an approximation of the actual solution of the dynamics problem, is produced Step 1: two integration formulas (Newmark in our case) are used to express the positions and velocities as functions of accelerations These are also called “discretization formulas” Step 2: everywhere in the constrained equations of motion, the positions and velocities are replaced using the discretization formulas and expressed in terms of the acceleration This is the most important step, since through this “discretization” the differential problem is transformed into an algebraic problem The algebraic problem, which effectively amounts to solving a nonlinear system, is approached using Newton’s method (so again, we need to produce a Jacobian) Step 3: solve a nonlinear system to find the acceleration and the Lagrange multipliers 3 Stage 3: The Discretization of the Constrained Equations of Motion The Discretized Equations Solved at each Time-Step tn+1: 8 Än + 1 + © Tq (q n + 1 )¸ n + 1 ¡ Q A (t n + 1 ; q n + 1 ; q_n + 1 ) = 0 < Mq : 4 1 ¯h2 © (q n + 1 ; t n + 1 ) = 0 Above you see and functions of the accelerations: , but remember that they are Again, these are Newmark’s formulas that express the generalized position and velocity as functions of generalized accelerations Solving the Nonlinear System =0 ~ Newton Method ~ 5 Based on Newmark Integration formulas, the Jacobian is calculated as: Corrections Computed as : Note: subscripts “n+1” dropped to keep presentation simple Simple Pendulum Example: Looking at Stage 3 6 First. At each time step (solving for the state of the system at tn+1…) Increment tn+1 = tn + h Define initial guess for accelerations q_dotdot and lambdas (take values from previous time step tn) Find initial conditions for general coordinate positions and velocities that satisfy position and velocity constraint equations Iterate to solve nonlinear system obtained after Newmark discretization of DAEs. Use Newton’s equations of motion along with the acceleration constraint equations to find general coordinate accelerations and lambdas at time = 0. Update tn+1 position and velocity using Newmark’s formulas and the most recent values for acceleration and lambdas. 8 > < 2 > : q _n+ 1 h q n + h q_n + h2 ( 1 ¡ 2¯) Ä q n + 2¯Ä q n+ 1 h i q_n + h ( 1 ¡ ° ) Ä qn + ° Ä q n+ 1 q n+ 1 = = i Get Jacobian of discretized equation. Use most recent q, q_dot, q_dotdot, and lambda at n+1 Use most recent values at n+1 to compute what each equation equals. Each equation will probably not equal zero. These values are called the residuals. Yes. Refine guess. 2 Compute the correction vector. " # 6 6 ±Ä q = 66 ±¸ 4 à M + ¯h 2 Correct the most recent acceleration and lambda to get better approximations for accelerations and lambdas. 8 > > < > > : MÄ q + © Tq ( q ) ¸ ¡ Q A ( q_; q ; t ) = 0 1 © q; t = ( ) ¯h 2 @( © T QA q¸ ) ¡ @@ @q q 0 3¡ 1 ! A Q ¡ ° h @@ q_ © Tq 77 7 7 5 ©q " q Ä ¸ #( new) 0 " = q Ä ¸ #( old) " ¡ ±q Ä ±¸ # Compute the largest value present in the correction factor matrix and compare to a specified limit. This is the convergence check (largest correction is easily computed as infinity norm in MATLAB) Is value greater than limit? No. 7 ¢ª ( Ä q ( ol d) ; ¸ ol d) Store acceleration and lambda for time tn+1. Use this accelerations to compute the position and velocity at tn+1 and store these quantities as well. residual Newton-Type Methods: [Geometric Interpretation] 8 Solving the Dynamics Problem using Quasi-Newton Method Än + 1 and ¸ n + 1 = 0 t he following nonlinear syst em: ² What are we aft er? We want t o solve for q 2 Än + 1 ; ¸ n + 1 ) ´ 4 ª (q Än + 1 + © Tq (q n + 1 )¸ n + 1 ¡ Q A (t n + 1 ; q n + 1 ; q_n + 1 ) Mq 1 ¯h2 3 5= 0 © (q n + 1 ; t n + 1 ) ² Expression of J, t he Jacobian of t he discret izat ion nonlinear syst em: 2 µ ¶ @( © Tq ¸ ) @Q A QA 2 M + ¯h ¡ @q ¡ ° h @@_ h i @q q 6 @ª @ª 6 J´ = @q Ä @¸ 4 ©q 3 ©Tq 7 7 5 0 ² Here's what you are missing in simEngine2D: { Sensit ivity of t he react ion forces wit h respect t o t he generalized posit ions q: @(©Tq ¸ ) @q { Sensit ivity of t he generalized applied forces wit h respect t o t he generalized posit ions q: @Q A @q _ { Sensit ivity of t he generalized applied forces wit h respect t o t he generalized velocit ies q: @Q A @q_ Solving the Dynamics Problem using Quasi-Newton Method Än + 1 ; ¸ n + 1 ) = 0, ² Conclusion from previous slide: when solving t he discret izat ion nonlinear syst em ª ( q ~ we are not going t o work wit h t he exact Jacobian J, but wit h an approximat ion of it called J. ² We will t hus rely on a Quasi-Newt on met hod since we dont have all t he sensit ivit ies available in simEngine2D ² Expression of J, t he act ual Jacobian: 2 µ @( © Tq ¸ ) 2 ¡ h i @q 6 M + ¯h @ª @ª 6 J´ = 4 @q Ä @¸ ¶ A @Q @q ©q ~ t he subst it ut e Jacobian: ² Expression of J, 2 M J~ ´ 4 ©q ©Tq 0 3 5 3 A Q ¡ ° h @@_ q ©Tq 7 7 5 0 Solving the Dynamics Problem using Quasi-Newton Method ² Quant it ies dropped from t he expression of t he act ual Jacobian: @(©Tq ¸ ) ¯h @q 2 ¯h Q 2@ A @q @Q A °h @q_ ² Import ant quest ion: When can we get away wit h neglect ing t hese t erms? { T his should be ok if t he st ep-size h is very small: h ¼ 0:001. Not e: t his is a rule of t humb, not always small enough... ² All quant it ies t hat we decided t o neglect are fairly st raight forward t o comput e, but we are not going t o pursue t hem in ME451 ² All t hese quant it ies are evaluat ed fully in ADAMS, which works wit h an [approximat ely] accurat e Jacobian First. At each time step (solving for the state of the system at tn+1…) Increment tn+1 = tn + h Define initial guess for accelerations q_dotdot and lambdas (take values from previous time step tn) Find initial conditions for general coordinate positions and velocities that satisfy position and velocity constraint equations Iterate to solve nonlinear system obtained after Newmark discretization of DAEs. Use Newton’s equations of motion along with the acceleration constraint equations to find general coordinate accelerations and lambdas at time = 0. Update tn+1 position and velocity using Newmark’s formulas and the most recent values for acceleration and lambdas. 8 > < 2 > : q _n+ 1 h q n + h q_n + h2 ( 1 ¡ 2¯) Ä q n + 2¯Ä q n+ 1 h i q_n + h ( 1 ¡ ° ) Ä qn + ° Ä q n+ 1 q n+ 1 = = Get Jacobian of discretized equation. Use most recent q, q_dot, q_dotdot, and lambda at n+1 Use most recent values at n+1 to compute what each equation equals. Each equation will probably not equal zero. These values are called the residuals. Yes. Refine guess. 8 > > < > > : MÄ q + © Tq ( q ) ¸ ¡ Q A ( q_; q ; t ) = 0 1 © q; t = ( ) ¯h 2 0 Compute the correction vector. Correct the most recent acceleration and lambda to get better approximations for accelerations and lambdas. " q Ä ¸ #( new) " = q Ä ¸ #( old) " ¡ ±q Ä ±¸ # Compute the largest value present in the correction factor matrix and compare to a specified limit. This is the convergence check (largest correction is easily computed as infinity norm in MATLAB) Is value greater than limit? No. 12 Store acceleration and lambda for time tn+1. Use this accelerations to compute the position and velocity at tn+1 and store these quantities as well. residual i Final Exam Info Tuesday, December 21, 5:05 PM. Room: ME1245 For simEngine2D, please make sure you support all the modeling elements that you were assigned to handle in the MATLAB assignment 3: http://sbel.wisc.edu/Courses/ME451/2010/Documents/MATLAB/matlabAssignment03.pdf In terms of forces/torques, please make sure you support the ones you were assigned to handle in the MATLAB assignment 5: http://sbel.wisc.edu/Courses/ME451/2010/Documents/MATLAB/matlabAssignment05.pdf 13 Note: only the last 15 points (out of 100) of the final exam are tied to simEngine2D. In other words, if you don’t even have a simEngine2D and answer all the other questions right you’ll end up with a score of 85. Final Exam, Rules of Engagement ² De¯ne an acf and adm pair of ¯les associat ed wit h t he type of analysis t hat you are supposed t o carry out and t he model t hat you were given. ² Run simulat ions (K inemat ics, Dynamics, and Equilibrium) using t he simulat ion engine. ² Generat e a set of plot s t hat show t he t ime evolut ion of an at t ribut e of t he model (t he mot ion of a point , t he value of a react ion force as a funct ion of t ime, et c.) ² Answer quest ions t hat are more t heoret ical in nat ure. For inst ance, \ How has been t he Lagrange Mult iplier T heorem used in deriving t he equat ions of mot ion?" , \ Why are init ial condit ions import ant in t he cont ext of Dynamics analysis?" , et c. ² Email t he TA and class inst ruct or a zipped direct ory t hat cont ains your code, adm/ acf ¯les, png plot s of your result s, and t he answer t o t he t heoret ical quest ions. T he naming convent ion for t his direct ory should be \ Last NameME451.zip" . For inst ance, \ Negrut ME451.zip" . T he answers t o t he t heoret ical quest ions should be typed in MS-Word in a ¯le called FinalExam.doc[x]. Final Exam, Comments ² If your simEngine2D does not use MAT LAB, it will be your responsibility t o have t he compiler support allowing you t o run t he software during t he Final Exam. ² Running your simEngine2D code should also report t he amount of t ime it t ook for complet ing a simulat ion. T his informat ion should also be included in t he email t o t he TA & inst ruct or. ² I will not insist on having simEngine2D t hat you use during t he exam be implement ed exclusively by you. However, in good fait h, you will have t o indicat e in t he email t hat you will be sending t o t he TA & t he inst ruct or t he percent age of your cont ribut ion t o t he simEngine2D code t hat you are using for t he exam. I will t hen underst and t hat t he remaining percent came from code writ t en by ot her ME451 colleague[s]. T his is ¯ne, but should be acknowledged. ² If you cont ribut ed more t han 66% t o your simEngine2D, you qualify for ent ering t he race for t he fast est solver. Winning t hat race t ranslat es int o an aut omat ic A-grade in t he course. ² One ot her aut omat ic A grade might be assigned for t he most general, ° exible, and neat ly organized simEngine2D code. Course Evaluation Please provide comments on the back of the form 16 Your feedback is important If there were things that you didn’t like please mention them If there were things that you like please mention them too What worked / What didn’t work