Integration Techniques

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

Lecture on Numerical Analysis Dr.-Ing. Michael Dumbser
Numeric Integration Methods Jim Van Verth Red Storm Entertainment
Bending, Breaking and Squishing Stuff Marq Singer Red Storm Entertainment
Formal Computational Skills
Constrained Dynamics Marq Singer
Chapter 6 Differential Equations
Rigid Body Dynamics Jim Van Verth
Computational Methods in Physics PHYS 3437
Ordinary Differential Equations
Dynamics of Articulated Robots Kris Hauser CS B659: Principles of Intelligent Robot Motion Spring 2013.
1cs542g-term Notes. 2 Solving Nonlinear Systems  Most thoroughly explored in the context of optimization  For systems arising in implicit time.
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
1cs542g-term Notes  Final exam: December 10, 10am-1pm X736 (CS Boardroom)  Another extra class this Friday 1-2pm.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
CSE245: Computer-Aided Circuit Simulation and Verification Lecture Note 5 Numerical Integration Spring 2010 Prof. Chung-Kuan Cheng 1.
MANE 4240 & CIVL 4240 Introduction to Finite Elements Numerical Integration in 1D Prof. Suvranu De.
Initial-Value Problems
Efficient Simulation of Physical System Models Using Inlined Implicit Runge-Kutta Algorithms Vicha Treeaporn Department of Electrical & Computer Engineering.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Molecular Dynamics Classical trajectories and exact solutions
1cs533d-winter-2005 Notes  Assignment 2 instability - don’t worry about it right now  Please read D. Baraff, “Fast contact force computation for nonpenetrating.
Math 3C Euler’s Method Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB.
Ordinary Differential Equations (ODEs)
Dynamics 101 Jim Van Verth Red Storm Entertainment
Numerical Solution of Ordinary Differential Equation
1 Chapter 6 Numerical Methods for Ordinary Differential Equations.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Section 6.1: Euler’s Method. Local Linearity and Differential Equations Slope at (2,0): Tangent line at (2,0): Not a good approximation. Consider smaller.
Physics for Game Developers Jim Van Verth Christer Ericson Squirrel Eiserloh Gino van den Bergen Erin Catto Marq Singer.
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Solving ODE.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Boyce/DiPrima 9th ed, Ch 8.4: Multistep Methods Elementary Differential Equations and Boundary Value Problems, 9th edition, by William E. Boyce and Richard.
Erin Catto Blizzard Entertainment Numerical Integration.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
Simulating Electron Dynamics in 1D
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
Numerical Integration and Rigid Body Dynamics for Potential Field Planners David Johnson.
Computer Animation Algorithms and Techniques
Integration of 3-body encounter. Figure taken from
 d.s. wu 1 Penalty Methods for Contact Resolution interactive contact resolution that usually works pi david s wu.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. ~ Ordinary Differential Equations ~ Stiffness and Multistep.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 261 Stiffness.
Scientific Computing Multi-Step and Predictor-Corrector Methods.
Ordinary Differential Equations (ODEs) 1Michael Sokolov / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Michael Sokolov ETH Zurich, Institut.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 7 - Chapter 25.
5. Integration method for Hamiltonian system. In many of formulas (e.g. the classical RK4), the errors in conserved quantities (energy, angular momentum)
Introduction to the Runge-Kutta algorithm for approximating derivatives PHYS 361 Spring, 2011.
Announcements Read Chapters 11 and 12 (sections 12.1 to 12.3)
Please remember: When you me, do it to Please type “numerical-15” at the beginning of the subject line Do not reply to my gmail,
Particle Systems. Applications Particle systems are broadly defined for: Explosion Cloth Fluid And more… It is integrated into many animation software,
PHY 301: MATH AND NUM TECH Contents Chapter 10: Numerical Techniques I. Integration A.Intro B.Euler  Recall basic  Predictor-Corrector C. Runge-Kutta.
Today’s class Ordinary Differential Equations Runge-Kutta Methods
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Ordinary Differential Equations
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Solving Ordinary Differential Equations
Integrators of higher order
Prepared by Vince Zaccone
ECE 576 – Power System Dynamics and Stability
CSE245: Computer-Aided Circuit Simulation and Verification
Class Notes 19: Numerical Methods (2/2)
Disclaimer The following slides reuse materials from SIGGRAPH 2001 Course Notes on Physically-based Modeling (copyright  2001 by David Baraff at Pixar).
Chapter 26.
Disclaimer The following slides reuse materials from SIGGRAPH 2001 Course Notes on Physically-based Modeling (copyright  2001 by David Baraff at Pixar).
CSE245: Computer-Aided Circuit Simulation and Verification
Presentation transcript:

Integration Techniques Marq Singer (marq@essentialmath.com)

Essential Math for Games Integrators Solve “initial value problem” for ODEs Used Euler’s method in previous talk But not the only way to do it Are other, more stable ways Essential Math for Games

Essential Math for Games The Problem Physical simulation with force dependant on position or velocity Start at x0, v0 Only know: Essential Math for Games

Essential Math for Games The Solution Do an iterative solution Start at some initial value Ideally follow a step-by-step (or stepwise) approximation of the function Essential Math for Games

Euler’s Method (review) Idea: we have the slope (x or v) Follow slope to find next values of x or v Start with x0, v0, time step h Essential Math for Games

Essential Math for Games Euler's Method Step across vector field of functions Not exact, but close x x0 x1 x2 t Essential Math for Games

Euler’s Method (cont’d) Has problems Expects the slope at the current point is a good estimate of the slope on the interval Approximation can drift off the actual function – adds energy to system! Gets worse the farther we get from known initial value Especially bad when time step gets larger Essential Math for Games

Euler’s Method (cont’d) Example of drift x x0 x2 t x1 Essential Math for Games

Essential Math for Games Stiffness Running into classic problem of stiff equations Have terms with rapidly decaying values Larger decay = stiffer equation = need smaller h Often seen in equations with stiff springs (hence the name) Essential Math for Games

Essential Math for Games Midpoint Method Take two approximations Approximate at half the time step Use slope there for final approximation x x0 h x1 h/2 x0.5 t Essential Math for Games

Essential Math for Games Midpoint Method Writing it out: Can still oscillate if h is too large Essential Math for Games

Essential Math for Games Runga-Kutta Use weighted average of slopes across interval How error-resistant indicates order Midpoint method is order two Usually use Runga-Kutta Order Four, or RK4 Essential Math for Games

Essential Math for Games Runga-Kutta (cont’d) Better fit, good for larger time steps Expensive -- requires many evaluations If function is known and fixed (like in physical simulation) can reduce it to one big formula But for large timesteps, still have trouble with stiff equations Essential Math for Games

Essential Math for Games Implicit Methods Explicit Euler methods add energy Implicit Euler removes it Use new velocity, not current E.g. Backwards Euler: Better for stiff equations Essential Math for Games

Essential Math for Games Implicit Methods Result of backwards Euler Solution converges more slowly But it converges! x x0 x1 x2 t Essential Math for Games

Essential Math for Games Implicit Methods How to compute x'i+1 or v'i+1? Derive from formula (most accurate) Compute using explicit method and plug in value (predictor-corrector) Solve using linear system (slowest, most general) Essential Math for Games

Essential Math for Games Implicit Methods Example of predictor-corrector: Essential Math for Games

Essential Math for Games Implicit Methods Solving using linear system: Resulting matrix is sparse, easy to invert Essential Math for Games

Essential Math for Games Verlet Integration Velocity-less scheme From molecular dynamics Uses position from previous time step Stable, but not as accurate Good for particle systems, not rigid body Essential Math for Games

Essential Math for Games Verlet Integration Others: Leapfrog Verlet Velocity Verlet Essential Math for Games

Essential Math for Games Multistep Methods Previous methods used only values from the current time step Idea: approximation drifts more the further we get from initial value Use values from previous time steps to calculate next one Anchors approximation with more accurate data Essential Math for Games

Multistep Methods (cont’d) Two types of multistep methods Explicit method determined only from known values Implicit method formula includes value from next time step Use Runga-Kutta to calculate initial values, predictor-correct for implicit Essential Math for Games

Multistep Methods (Cont’d) Adams-Bashforth 2-Step Method (explicit) Adams-Moulton 2-Step Method (implicit) Essential Math for Games

Essential Math for Games Variable Step Size Idea: use one level of calculation to compute value, one at a higher level to check for error If error high, decrease step size Not really practical because step size can be dependant on frame rate Also expensive, not good for real-time Essential Math for Games

Essential Math for Games Which To Use? In practice, Midpoint or Euler’s method may be enough if time step is small At 60 fps, that’s probably the case Having trouble w/sim exploding? Try implicit Euler or Verlet Essential Math for Games

Essential Math for Games References Burden, Richard L. and J. Douglas Faires, Numerical Analysis, PWS Publishing Company, Boston, MA, 1993. Witken, Andrew, David Baraff, Michael Kass, SIGGRAPH Course Notes, Physically Based Modelling, SIGGRAPH 2002. Eberly, David, Game Physics, Morgan Kaufmann, 2003. Essential Math for Games