Dynamics and Time Integration. Computer Graphics CMU /15-662, Fall 2016

Similar documents
Dynamics and Time Integration

Dynamics and Time Integration. Computer Graphics CMU /15-662

Robotics. Dynamics. Marc Toussaint U Stuttgart

Resonance and response

Lecture 19: Calculus of Variations II - Lagrangian

Chaotic motion. Phys 750 Lecture 9

Dan s Morris s Notes on Stable Fluids (Jos Stam, SIGGRAPH 1999)

When you walk around, you are stuck to the ground. You can jump up. You always come back down. Why is this?

Chapter 6 - Ordinary Differential Equations

PHYSICS 107. Lecture 5 Newton s Laws of Motion

Chaotic motion. Phys 420/580 Lecture 10

Physics 100. Today. Finish Chapter 4: Newton s Second Law. Start Chapter 5: Newton s Third Law

Using web-based Java pplane applet to graph solutions of systems of differential equations

MITOCW MITRES18_005S10_DiffEqnsMotion_300k_512kb-mp4

1 Ordinary differential equations

Physics 6010, Fall Relevant Sections in Text: Introduction

Time scales. Notes. Mixed Implicit/Explicit. Newmark Methods [ ] [ ] "!t = O 1 %

Robotics. Dynamics. University of Stuttgart Winter 2018/19

Principles of Computer Game Design and Implementation. Lecture 17

Lecture 6 Force and Motion. Identifying Forces Free-body Diagram Newton s Second Law

Math (P)Review Part II:

LECTURE 26 GRAVITY. Instructor: Kazumi Tolich

Notes on numerical solution of differential equations

MITOCW 18. Quiz Review From Optional Problem Set 8

Announcements - 9 Oct 2014

An Overview of Fluid Animation. Christopher Batty March 11, 2014

Physics 115/242 The leapfrog method and other symplectic algorithms for integrating Newton s laws of motion

Physics 101. Today Chapter 5: Newton s Third Law

Math (P)Review Part I:

Physics Motion Math. (Read objectives on screen.)

Computer Animation. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics. Slides courtesy of Leonard McMillan and Jovan Popovic

Ordinary Differential Equations II

Physics 115/242 The leapfrog method and other symplectic algorithms for integrating Newton s laws of motion

Figure 1: Doing work on a block by pushing it across the floor.

Lecture 8: Differential Equations. Philip Moriarty,

MITOCW R11. Double Pendulum System

TEACHER BACKGROUND INFORMATION FORCE

Introduction to Algebra: The First Week

Physics 141 Energy 1 Page 1. Energy 1

Physics 10. Lecture 3A

Problem 1: Lagrangians and Conserved Quantities. Consider the following action for a particle of mass m moving in one dimension

Fluid Animation. Christopher Batty November 17, 2011

Oscillatory Motion. Simple pendulum: linear Hooke s Law restoring force for small angular deviations. small angle approximation. Oscillatory solution

Modern Physics notes Spring 2005 Paul Fendley Lecture 37

PHYSICS. Chapter 15 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

Physics 106a, Caltech 4 December, Lecture 18: Examples on Rigid Body Dynamics. Rotating rectangle. Heavy symmetric top

Oscillatory Motion. Simple pendulum: linear Hooke s Law restoring force for small angular deviations. Oscillatory solution

Review Chapters 1-9. Did you read the article on helmets before coming to class? A. Yes B. No

Physics 111. = Δ p. F net. p f. p i. = F net. m v i. = v i. v f. = m v i. + m a(δt) m v f. m v f. Δt = Δ p. I F net. = m a = m Δ v

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Motion, Forces, and Energy

Grade 7/8 Math Circles March 8 & Physics

Computer Problems for Methods of Solving Ordinary Differential Equations

Oscillations! (Today: Springs)

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

An Introduction to Physically Based Modeling: An Introduction to Continuum Dynamics for Computer Graphics

Sign of derivative test: when does a function decreases or increases:

Math background. Physics. Simulation. Related phenomena. Frontiers in graphics. Rigid fluids

Modeling, Simulating and Rendering Fluids. Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan

Newton s laws. Chapter 1. Not: Quantum Mechanics / Relativistic Mechanics

High performance computing and numerical modeling

Physics I: Oscillations and Waves Prof. S. Bharadwaj Department of Physics and Meteorology. Indian Institute of Technology, Kharagpur

MITOCW watch?v=pqkyqu11eta

MITOCW R9. Generalized Forces

The Hopf equation. The Hopf equation A toy model of fluid mechanics

SUPERCHARGED SCIENCE. Unit 2: Motion.

Experimenting with Forces

Oscillations. Simple Harmonic Motion (SHM) Position, Velocity, Acceleration SHM Forces SHM Energy Period of oscillation Damping and Resonance

Instructor (Brad Osgood)

Nonlinear Single-Particle Dynamics in High Energy Accelerators

Ordinary Differential Equations

Computer Problems for Taylor Series and Series Convergence

Scientific Computing II

Basic Theory of Dynamical Systems

3rd Grade. Forces and Motion Review. Slide 1 / 106 Slide 2 / 106. Slide 4 / 106. Slide 3 / 106. Slide 5 / 106. Slide 6 / 106. Motion and Stability

Reading and Announcements

Chapter 14 Oscillations

Purpose of the experiment

Mass on a Horizontal Spring

Lecture 1, August 21, 2017

2. What is the force weight of a 45 kg desk? 3. Give a scenario example for each of Newton s Laws.

Modeling and Solving Constraints. Erin Catto Blizzard Entertainment

Daba Meshesha Gusu and O.Chandra Sekhara Reddy 1

Midterm EXAM PHYS 401 (Spring 2012), 03/20/12

CS 542G: The Poisson Problem, Finite Differences

3rd Grade Motion and Stability

II. Universal Gravitation - Newton 4th Law

Numerical Methods for Inverse Kinematics

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi

GALILEAN RELATIVITY. Projectile motion. The Principle of Relativity

Michael Fowler, UVa Physics, 12/1/07. Momentum has Direction

Lecture 6. Angular Momentum and Roataion Invariance of L. x = xcosφ + ysinφ ' y = ycosφ xsinφ for φ << 1, sinφ φ, cosφ 1 x ' x + yφ y ' = y xφ,

Physics Talk NEWTON S SECOND LAW OF MOTION. Evidence for Newton s Second Law of Motion

Lecture - 1 Motivation with Few Examples

The children have already done several experiments with gravity from Functional

How Do Objects Move? Describing Motion. Different Kinds of Motion

Modeling and Experimentation: Compound Pendulum

Activity One Force, Mass, and Acceleration

Ordinary Differential Equations I

Lab 11. Spring-Mass Oscillations

Transcription:

Dynamics and Time Integration Computer Graphics CMU 15-462/15-662, Fall 2016

Last Quiz: IK (and demo)

Last few classes Keyframing and motion capture - Q: what can one NOT do with these techniques?

The Animation Equation We previously saw the rendering equation - Rasterization and path tracing give approximate solutions to the rendering equation What s the animation equation? - Leverage tools from computational physics: dynamical descriptions, numerical integration, etc.

Dynamical Description of Motion A change in motion is proportional to the motive force impressed and takes place along the straight line in which that force is impressed. Sir Isaac Newton, 1687

The Animation Equation mass acceleration force

The Animation Equation Well there is more to be said - Every system has a configuration - It also has a velocity - And some kind of mass - There are probably some forces - And also some constraints Can write Newton s 2nd law as Makes two things clear: - acceleration is 2nd time derivative of configuration - ultimately, we want to solve for the configuration q

Generalized Coordinates Often describing systems with many, many moving pieces E.g., a collection of billiard balls, each with position xi Collect them all into a single vector of generalized coordinates: Can think of q as a single point moving along a trajectory in R n This way of thinking naturally maps to the way we actually solve equations on a computer: all variables are often stacked into a big vector and handed to a solver.

Generalized Velocity Just the time derivative of the generalized coordinates!

Ordinary Differential Equations Many dynamical systems can be described via an ordinary differential equation (ODE) in generalized coordinates: dq change in configuration over time velocity function q dt Example: q rate of growth is proportional to value Solution? Describes exponential decay (a < 1), or exponential growth (a > 1) Ordinary means involves derivatives in time but not space We ll talk about spatial derivatives (PDEs) in another lecture...

Dynamics via ODEs Another key example: Newton s 2nd law! Second order ODE since we take two time derivatives Can also write as a system of two first order ODEs, by introducing new dummy variable for velocity: d q v dt = v F/m Splitting things up this way will make it easy to talk about solving these equations numerically (among other things)

Simple Example: Throwing a Rock Consider a rock* of mass m tossed under force of gravity g Easy to write dynamical equations, since only force is gravity (constant acceleration): F m or Solution: F F (What do we need a computer for?!) *Yes, this rock is spherical and has uniform density. Note: this is an initial value problem!

Simple Example: the two-body problem Let s take a closer look rock F gravity GmM 0 x x 0 x x 0 3

Not-So-Simple Example: n-body Problem Consider the Earth, moon, and sun where do they go? As soon as n 3, no closed form (chaotic solutions) What if we want to simulate entire galaxies? Credit: Governato et al / NASA

Slightly Harder Simple Example: Pendulum Mass on end of a bar, swinging under gravity What are the equations of motion? Same as rock problem, but constrained Could use a force diagram - You probably did this for many hours in high school/college - Let s do something different!

Lagrangian Mechanics Beautifully simple and general recipe: - Write down kinetic energy - Write down potential energy - Write down Lagrangian Joe Lagrange - Dynamics then given by Euler-Lagrange equation becomes (generalized) MASS TIMES ACCELERATION becomes (generalized) FORCE Why is this useful? - often easier to come up with (scalar) energies than forces - very general, works in any kind of generalized coordinates Great reference: Sussman & Wisdom, Structure and Interpretation of Classical Mechanics

Lagrangian Mechanics - Example Generalized coordinates for pendulum? just one coordinate: angle with the vertical direction Kinetic energy (mass m)? Potential energy? Euler-Lagrange equations? (from here, just plug and chug even a computer could do it!)

Solving the Pendulum Great, now we have a nice simple equation for the pendulum: For small angles (e.g., clock pendulum) can approximate as harmonic oscillator In general, there is no closed form solution! Hence, we must use a numerical approximation...and this was one of the simpler systems we can think of!

Not-So-Simple Example: Double Pendulum Blue ball swings from fixed point; green ball swings from blue one Simple system... not-so-simple motion! Chaotic: small changes to input, wild changes to output Must use numerical approximation

For animation, we want to simulate phenomena that are even more complex!

Particle Systems Model complex phenomena as large collection of particles Each particle has a behavior described by (physical or nonphysical) forces Extremely common in graphics/games - easy to understand - simple equation for each particle - easy to scale up/down May need many particles to capture certain phenomena (e.g., fluids) - may require fast hierarchical data structure (kd-tree, BVH,...) - sometimes better to use continuum model!

Example: Flocking

Simulated Flocking as an ODE Each bird is a particle Subject to very simple forces: - attraction to center of neighbors - repulsion from individual neighbors - alignment toward average trajectory of neighbors Solve large system of ODEs (numerically!) Emergent complex behavior (also seen in fish, bees,...) attraction repulsion alignment Credit: Craig Reynolds (see http://www.red3d.com/cwr/boids/)

Example: Crowds Where are the bottlenecks in a building plan?

Example: Granular Materials Bell et al, Particle-Based Simulation of Granular Materials

Example: Particle-Based Fluids Movie Battleship (Fluid: particles or continuum?)

Example: Mass-Spring System Connect particles x1, x2 by a spring of length L0 Spring force is given by Hooke s law: (Ut tensio, sic vis.) current length direction F spring stiffness K x 1 L 0 x 2 1 x x 1 1 x x 2 2 rest length Extremely common in graphics/games - easy to understand - simple force equation - Easy to combine many springs + particles to model complex phenomena!

Example: Mass-Spring System Spatial discretization: sample object with mass points Total mass of object: M Number of mass points: p Mass of each point: m=m/p (uniform distribution) Each point is a particle, just like before. It has Mass Position Velocity Connect particles with springs, evaluate force due to each spring, add gravity, etc and integrate.

Example: Mass Spring System

Example: Mass Spring + Character

Example: Hair

Ok, I m convinced. So how do we solve these things numerically?

Numerical Integration q (t) q(0) Want to obtain function, given and q (t) Replace time-continuous function time q(t) q t with samples in q0 qt

Numerical Integration How do you compute time-discretized samples? - Key idea: replace derivatives with differences new configuration (unknown want to solve for this!) current configuration (known) time step, i.e., interval of time between qk and qk+1 Wait... where do we evaluate the velocity function? At the new or old configuration?

Forward Euler Simplest scheme: evaluate velocity at current configuration New configuration can then be written explicitly in terms of known data: current configuration velocity new configuration at current time Very intuitive: walk a tiny bit in the direction of the velocity Unfortunately, not very stable Consider the following 2D, first order ODE (what does it do?): 0 1 q q 1 0 r0

Forward Euler - Stability Analysis Let s consider behavior of forward Euler for simple linear ODE (e.g. temperature of an object): Importantly: u should decay (exact solution is u(t)=e - at ) Forward Euler approximation is Which means after n steps, we have Decays only if 1-τa < 1, or equivalently, if τ < 2/a In practice: may need very small time steps ( stiff ODE )

Backward Euler Let s try something else: evaluate velocity at next configuration New configuration is then implicit, and we must solve for it: new configuration current configuration velocity at next time Much harder to solve, since in general f can be very nonlinear! 0 1 q q 1 0 r 0

Backward Euler - Stability Analysis Again consider a simple linear ODE: Remember: u should decay (exact solution is u(t)=e - at ) Backward Euler approximation is Which means after n steps, we have Decays if 1+τa > 1, which is always true! Backward Euler is unconditionally stable for linear ODEs

Symplectic Euler Backward Euler was stable, but we also saw (empirically) that it exibits numerical damping (damping not found in original eqn.) Nice alternative is symplectic Euler (for 2 nd order ODEs) - update velocity using current configuration - update configuration using new velocity Easy to implement; used often in practice (or leapfrog, Verlet,...) Energy is conserved almost exactly, forever. Is that desirable? (Proof? The analysis is not so easy...)

Numerical Integrators Barely scratched the surface Many different integrators Why? Because many notions of good : - stability - accuracy - consistency/convergence - conservation, symmetry,... - computational efficiency (!) No one best integrator pick the right tool for the job! Could do (at least) an entire course on time integration... Great book: Hairer, Lubich, Wanner

Let s look at an example