Particle dynamics Second-order motion Particle system Forces - - PowerPoint PPT Presentation

particle dynamics
SMART_READER_LITE
LIVE PREVIEW

Particle dynamics Second-order motion Particle system Forces - - PowerPoint PPT Presentation

Particle dynamics Second-order motion Particle system Forces Constraints Second order motion analysis (advanced) Particle system Particles are objects that have mass, position, and velocity, but without spatial extent


slide-1
SLIDE 1

Particle dynamics

slide-2
SLIDE 2
slide-3
SLIDE 3
  • Second-order motion
  • Particle system
  • Forces
  • Constraints
  • Second order motion analysis (advanced)
slide-4
SLIDE 4

Particle system

  • Particles are objects that have mass, position,

and velocity, but without spatial extent

  • Particles are the easiest objects to simulate but

they can be made to exhibit a wide range of

  • bjects
slide-5
SLIDE 5

A Newtonian particle

  • First order motion is sufficient, if
  • a particle state only contains position
  • no inertia
  • particles are extremely light
  • Most likely particles have inertia and are

affected by gravity and other forces

  • This puts us in the realm of second order

motion

slide-6
SLIDE 6

Second-order ODE

f = ma

What is the differential equation that describes the behavior of a mass point? What does f depend on?

¨ x(t) = f(x(t), ˙ x(t)) m

slide-7
SLIDE 7

Second-order ODE

Add a new variable, v(t), to get a pair of coupled first order equations

This is not a first oder ODE because it has second derivatives

{ ˙

x = v ˙ v = f/m

¨ x(t) = f(x(t), ˙ x(t)) m = f(x, ˙ x)

slide-8
SLIDE 8

Phase space

x v

  • =

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ x1 x2 x3 v1 v2 v3 ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

Concatenate position and velocity to form a 6-vector: position in phase space First order differential equation: velocity in the phase space

 ˙ x ˙ v

  • = f(

 x v

  • ) =

 v

f m

slide-9
SLIDE 9

Quiz

A mass point attached to a spring obeys Hooke’s Law: What is the ODE that describes this motion?

f = −K(x − ¯ x)

slide-10
SLIDE 10

Integrate second-order ODE

Express a second-order motion in two first-order ODEs, Integrate both position and velocity via explicit Euler

✓ x1 v1 ◆ = ✓ x0 v0 ◆ + h ✓ ˙ x0 ˙ v0 ◆ ✓ ˙ x ˙ v ◆ = ✓ 1 −K/m ◆ ✓ x v ◆ + ✓ (K/m)¯ x ◆ = ✓ x0 v0 ◆ + h ✓ v0 K/m(¯ x − x0) ◆

slide-11
SLIDE 11

Quiz

  • Integrate the same ODE using midpoint method.

✓ ˙ x ˙ v ◆ = ✓ 1 −K/m ◆ ✓ x v ◆ + ✓ (K/m)¯ x ◆

slide-12
SLIDE 12
  • Second-order motion
  • Particle system
  • Forces
  • Constraints
  • Second order motion analysis (advanced)
slide-13
SLIDE 13

Particle structure

x v f m

Particle

position velocity force accumulator mass

a point in the phase space

slide-14
SLIDE 14

Solver interface

system solver solver interface

x v f m

particle GetDim

6

Get/Set State

x v

Deriv Eval

v

f m

slide-15
SLIDE 15

system

Particle system structure

n time ...

x1 v1 f1 m1 x2 v2 f2 m2 xn vn fn mn

particles

slide-16
SLIDE 16

system

Particle system structure

solver solver interface

GetDim

6n

Get/Set State

x1 v1 x2 v2 xn vn

. . .

Deriv Eval

vn

fn mn

v1

f1 m1

v2

f2 m2

. . .

particles time n

slide-17
SLIDE 17

Deriv Eval

Clear forces: loop over particles, zero force accumulator Calculate forces: sum all forces into accumulator Gather: loop over particles, copy v and f/m into destination array

slide-18
SLIDE 18
  • Second-order motion
  • Particle system
  • Forces
  • Constraints
  • Second order motion analysis (advanced)
slide-19
SLIDE 19

Forces

  • Constant
  • Position dependent
  • Velocity dependent

gravity force fields, springs drag

slide-20
SLIDE 20

system particles n time

Particle systems with forces

...

x1 v1 f1 m1 x2 v2 f2 m2 xn vn fn mn

F1 F2 Fm ... forces

slide-21
SLIDE 21

Force structure

  • Unlike particles, forces are heterogeneous

(type-dependent)

  • Each force object “knows”
  • which particles it influences
  • how much contribution it adds to the force

accumulator

slide-22
SLIDE 22

system particles n time

Particle systems with forces

...

x1 v1 f1 m1 x2 v2 f2 m2 xn vn fn mn

forces F1 F2 Fm ...

slide-23
SLIDE 23

F

Gravity

p sys apply_fun G particle system

. . .

x1 v1 f1 m1 x2 v2 f2 m2

xn vn fn mn

p->f += p->m*F->G

Unary force: f = mG Exerting a constant force on each particle

slide-24
SLIDE 24

F

Viscous drag

k sys particle system p

. . .

x1 v1 f1 m1 x2 v2 f2 m2

xn vn fn mn

apply_fun p->f += p->v*F->k

At very low speeds for small particles, air resistance is approximately:

fdrag = −kdragv

slide-25
SLIDE 25

Attraction

Act on any or all pairs of particles, depending on their positions xp xq l

fq = −fp fp = −k mpmq |l|2 l |l| l = xp − xq

slide-26
SLIDE 26

Attraction

p sys apply_fun k particle system

F

xp vp fp mp xq vq fq mq

fp = −k mpmq |l|2 l |l|

slide-27
SLIDE 27

Damped spring

fp = −

  • ks(|l| − r) + kd

˙ l · l |l|

  • l

|l|

r | l | xp xq

l = xp − xq fq = −fp

slide-28
SLIDE 28

Damped spring

p sys apply_fun ks particle system

F

xp vp fp mp xq vq fq mq

kd r

fp = −

  • ks(|l| − r) + kd

˙ l · l |l|

  • l

|l|

slide-29
SLIDE 29

Quiz

For an ideal spring, what is the force it applies to two particles, p and q, attached to it. Write down the pseudo code for its “apply_fun”.

p sys apply_fun ks particle system

F

r

xp vp fp mp xq vq fq mq

slide-30
SLIDE 30

Deriv Eval

...

x1 v1 f1 m1 x2 v2 f2 m2 xn vn fn mn

  • 1. Clear force accumulators

F1 F2 Fm ...

  • 2. Invoke apply_force

functions

  • 3. Return derivatives to solver

˙ x ˙ v

  • =

v

f m

slide-31
SLIDE 31

ODE solver

Euler’s method:

x(t0 + h) = x(t0) + hf(x, t) xt+1 = xt + h ˙ xt vt+1 = vt + h ˙ vt

slide-32
SLIDE 32

2. 4.

Get/Set State

Euler step

system

GetDim Deriv Eval

solver solver interface

xt+1 = xt + h ˙ xt vt+1 = vt + h ˙ vt

3. time

  • 5. Advance

time Deriv Eval

1.

. . .

vn

fn mn

v1

f1 m1

v2

f2 m2

x1 v1 x2 v2 xn vn

. . .

particles

slide-33
SLIDE 33

Get/Set State

Quiz

system

GetDim Deriv Eval

solver solver interface How to modify the algorithm to use midpoint method?

slide-34
SLIDE 34

Example: freefall motion

  • Solution is
  • v(t) only needs 1st order accuracy, but x(t)

demands 2nd order accuracy

v(t) = v0 + a0t x(t) = x0 + v0t + 1 2a0t2

slide-35
SLIDE 35

Quiz

  • Let particle p start at position x0 with velocity v0,

what is the state of p after two time steps (h) using the midpoint method? Assume that gravity is the

  • nly force present in the scene.
slide-36
SLIDE 36
  • Second-order motion
  • Particle system
  • Forces
  • Constraints
  • Second order motion analysis (advanced)
slide-37
SLIDE 37

Particle Interaction

  • We will revisit collision

when we talk about rigid body simulation

  • For now, just simple

point-plane collisions

slide-38
SLIDE 38

Collision detection

v p x N

Particle is on the legal side if Particle is heading in if

Particle is within of the wall if

  • (x − p) · N ≥ 0

(x − p) · N < v · N < 0

slide-39
SLIDE 39

Collision response

vT vN v x N

Normal and tangential components vN = (N · v)N vT = v − vN

slide-40
SLIDE 40

Collision response

v vT vN

Before collision

v′ vT −krvN

After collision coefficient of restitution:

0 ≤ kr < 1

v′ = vT − krvN

slide-41
SLIDE 41

Contact

p

N

Conditions for resting contact:

f

fN fT

If a particle is pushed into the contact plane a contact force fc is exerted to cancel the normal component of f

x

  • 1. particle is on the collision surface

v

  • 2. zero normal velocity
slide-42
SLIDE 42
  • Second-order motion
  • Particle system
  • Forces
  • Constraints
  • Second order motion analysis (advanced)
slide-43
SLIDE 43

Linear analysis

  • Linearly approximate acceleration
  • Split up analysis into different cases
  • constant acceleration
  • linear acceleration

d dt  x v

  • = f(

 x v

  • , t) = A

 x v

  • + a0

d dt  x v

  • =

 I −K −D  x v

  • + a0
slide-44
SLIDE 44

Constant acceleration

  • Solution is
  • v(t) only needs 1st order accuracy, but x(t)

demands 2nd order accuracy

v(t) = v0 + a0t x(t) = x0 + v0t + 1 2a0t2

slide-45
SLIDE 45

Linear acceleration

  • When K (or D) dominates ODE, what type of

motion does it correspond to?

  • Need to compute the eigenvalues of A

d dt

  • x

v

  • =
  • I

−K −D x v

  • = A
  • x

v

slide-46
SLIDE 46

Linear acceleration

Assume is an eigenvalue of A, is the corresponding eigenvector

α

  • u1

u2

  • I

−K −D u1 u2

  • = α
  • u1

u2

  • The eigenvector of A has the form
  • u

αu

  • Assuming D is linear combination of K and I (Rayleigh

damping) That means K and D have the same eigenvectors

slide-47
SLIDE 47

Linear acceleration

Now assume u is an eigenvector for both K and D For any u, if is an eigenvector of A, the following must be true

  • u

αu

  • I

−K −D u αu

  • = α
  • u

αu

  • −λku − αλdu = α2u

α = −1 2λd ±

  • (1

2λd)2 − λk

slide-48
SLIDE 48

Eigenvalue approximation

  • If D dominates
  • exponential decay
  • If K dominates
  • oscillation

α ≈ −λd, 0 α ≈ ± √ −1

  • λk
slide-49
SLIDE 49

Analysis

  • Constant acceleration (e.g. gravity)
  • demands 2nd order accuracy for position
  • Position dependence (e.g. spring force)
  • demands stability, oscillatory motion
  • looks at imaginary axis
  • Velocity dependence (e.g. damping)
  • demands stability, exponential decay
  • looks at negative real axis
slide-50
SLIDE 50

Explicit methods

  • First-order explicit Euler method
  • constant acceleration:
  • position dependence:
  • velocity dependence:
  • RK3 and RK4
  • constant acceleration:
  • position dependence:
  • velocity dependence:

bad (1st order) very bad (unstable)

  • k (conditionally stable)

great (high order)

  • k (conditionally stable)
  • k (conditionally stable)
slide-51
SLIDE 51

Implicit methods

  • Implicit Euler method
  • constant acceleration:
  • position dependence:
  • velocity dependence:
  • Trapezoidal rule
  • constant acceleration:
  • position dependence:
  • velocity dependence:

bad (1st order)

  • k (stable but damped)

great (monotone) great (2nd order) great (stable and no damp) good (stable, not monotone)