notes time scales
play

Notes Time scales [work out] Finish up time integration methods - PDF document

Notes Time scales [work out] Finish up time integration methods today For position dependence, characteristic time Assignment 1 is mostly out interval is 1 Later today will make it compile etc. t = O K


  1. Notes Time scales � [work out] � Finish up time integration methods today � For position dependence, characteristic time � Assignment 1 is mostly out interval is � � 1 • Later today will make it compile etc. � t = O � � � K � � For velocity dependence, characteristic time interval is � t = O 1 � � � � � D � � Note: matches symplectic Euler stability limits • If you care about resolving these time scales, there’s not much point in going to implicit methods cs533d-winter-2005 1 cs533d-winter-2005 2 Mixed Implicit/Explicit Newmark Methods � For some problems, that square root can � A general class of methods 2 � t 2 1 � 2 � mean velocity limit much stricter [ ( ) a n + 2 � a n + 1 ] x n + 1 = x n + � tv n + 1 � Or, we know we want to properly resolve [ ] v n + 1 = v n + � t 1 � � ( ) a n + � a n + 1 the position-based oscillations, but don’t � Includes Trapezoidal Rule for example care about damping ( � =1/4, � =1/2) � Go explicit on position, implicit on velocity � The other major member of the family is Central • Cuts the number of equations to solve in half Differencing ( � =0, � =1/2) • This is mixed Implicit/Explicit • Often, a(x,v) is linear in v, though nonlinear in x; this way we avoid Newton iteration cs533d-winter-2005 3 cs533d-winter-2005 4 Central Differencing Central: Performance � Rewrite it with intermediate velocity: � Constant acceleration: great • 2nd order accurate ( ) v n + 12 = v n + 1 2 � ta x n , v n � Position dependence: good x n + 1 = x n + � tv n + 12 • Conditionally stable, no damping v n + 1 = v n + 12 + 1 2 � ta x n + 1 , v n + 1 ( ) � Velocity dependence: good • Stable, but only conditionally monotone � Looks like a hybrid of: � Can we change the Trapezoidal Rule to • Midpoint (for position), and Backward Euler and get unconditional • Trapezoidal Rule (for velocity - split into monotonicity? Forward and Backward Euler half steps) cs533d-winter-2005 5 cs533d-winter-2005 6

  2. Staggered Implicit/Explicit Summary (2nd order) � Like the staggered Symplectic Euler, but use � Depends a lot on the problem B.E. in velocity instead of F.E.: • What’s important: gravity, position, velocity? ( ) � Explicit methods from last class are probably v n + 12 = v n � 12 + 1 2 ( t n + 1 � t n � 1 ) a x n , v n + 12 bad x n + 1 = x n + � tv n + 12 � Symplectic Euler is a great fully explicit method � Constant acceleration: great (particularly with staggering) � Position dependence: good (conditionally stable, • Switch to implicit velocity step for more stability, if no damping) damping time step limit is the bottleneck � Implicit Compromise method � Velocity dependence: great (unconditionally • Fully stable, nice behaviour monotone) cs533d-winter-2005 7 cs533d-winter-2005 8 Example Motions Simple Velocity Fields � Can superimpose (add) to get more complexity � Constants: v(x)=constant � Expansion/contraction: v(x)=k(x-x 0 ) • Maybe make k a function of distance |x-x 0 | v ( x ) = � � x � x 0 ( ) � Rotation: • Maybe scale by a function of distance |x-x 0 | or magnitude ( ) � � x � x 0 cs533d-winter-2005 9 cs533d-winter-2005 10 Noise Example Forces � Common way to perturb fields that are too � Gravity: F gravity =mg (a=g) perfect and clean � If you want to do orbits � Noise (in graphics) = x � x 0 a smooth, non-periodic field with clear length- F gravity = � GmM 0 scale 3 x � x 0 � Read Perlin, “Improving Noise”, SIGGRAPH’02 • Hash grid points into an array of random slopes that � Note x 0 could be a fixed point (e.g. the Sun) or define a cubic Hermite spline another particle � Can also use a Fourier construction • But make sure to add the opposite and equal force to • Band limited signal • Better, more control, but (possibly much) more the other particle if so! expensive • FFT - check out www.fftw.org for one good implementation cs533d-winter-2005 11 cs533d-winter-2005 12

  3. Drag Forces Spring Forces � Air drag: F drag =-Dv � Springs: F spring =-K(x-x 0 ) • If there’s a wind blowing with velocity v w then • x 0 is the attachment point of the spring F drag =-D(v-v w ) • Could be a fixed point in the scene � D should be a function of the cross-section • …or somewhere on a character’s body exposed to wind • …or the mouse cursor • Think paper, leaves, different sized objects, … • …or another particle (but please add equal and oppposite force!) � Depends in a difficult way on shape too • Hack away! cs533d-winter-2005 13 cs533d-winter-2005 14 Nonzero Rest Length Spring Spring Damping � Need to measure the “strain”: � Simple damping: F damp =-D(v-v 0 ) the fraction the spring has stretched from • But this damps rotation too! its rest length L � Better spring damping: F damp =-D(v-v 0 )•u u • Here u is (x-x 0 )/|x-x 0 |, the spring direction � � F spring = � K x � x 0 � x � x 0 � [work out 1d case] � 1 � � Critical damping L x � x 0 � � D = 2 mK cs533d-winter-2005 15 cs533d-winter-2005 16 Collision and Contact Collision and Contact � We can integrate particles forward in time, have some ideas for velocity or force fields � But what do we do when a particle hits an object? � No simple answer, depends on problem as always � General breakdown: • Interference vs. collision detection • What sort of collision response: (in)elastic, friction • Robustness: do we allow particles to actually be inside an object? cs533d-winter-2005 17 cs533d-winter-2005 18

  4. Interference vs. Collision Repulsion Forces � Interference (=penetration) � Simplest idea (conceptually) • Simply detect if particle has ended up inside object, • Add a force repelling particles from objects when they push it out if so get close (or when they penetrate) • Works fine if [w=object width] v � t < 1 2 w • Then just integrate: business as usual • Otherwise could miss interaction, or push dramatically • Related to penalty method: the wrong way instead of directly enforcing constraint (particles stay • The ground, thick objects and slow particles outside of objects), add forces to encourage constraint � Collision � For the ground: • Check if particle trajectory intersects object • Frepulsion=-Ky when y<0 [think about gravity!] • Can be more complicated, especially if object is • …or -K(y-y0)-Dv when y<y0 [still not robust] moving too… • …or K(1/y-1/y0)-Dv when y<y0 � For now, let’s stick with the ground (y=0) cs533d-winter-2005 19 cs533d-winter-2005 20 Repulsion forces Collision and Contact � Difficult to tune: � Collision is when a particle hits an object • Too large extent: visible artifact • Instantaneous change of velocity • Too small extent: particles jump straight through, not (discontinuous) robust (or time step restriction) � Contact is when particle stays on object • Too strong: stiff time step restriction, or have to go surface for positive time with implicit method - but Newton will not converge if we guess past a singular repulsion force • Velocity is continuous • Too weak: won’t stop particles • Force is only discontinuous at start � Rule-of-thumb: don’t use them unless they really are part of physics • Magnetic field, aerodynamic effects, … cs533d-winter-2005 21 cs533d-winter-2005 22 Frictionless Collision Response Contact Friction � At point of contact, find normal n � Some normal force is keeping v N =0 • For ground, n=(0,1,0) � Coulomb’s law (“dry” friction) � Decompose velocity into • If sliding, then kinetic friction: • normal component v N =(v•n)n and v T F friction = � µ k F normal • tangential component v T =v-v N v T after = � � v N before , [ ] � Normal response: v N � � 0,1 • If static (v T =0) then stay static as long as • � =0 is fully inelastic F friction � µ s F normal • � =1 is elastic � “Wet” friction = damping � Tangential response after = v T before • Frictionless: v T F friction = � DF normal v T � Then reassemble velocity v=v N +v T cs533d-winter-2005 23 cs533d-winter-2005 24

Recommend


More recommend