Introduction to Particle Simulations Daniel Playne.

Slides:



Advertisements
Similar presentations
Bouncing Impulse and The conservation of Momentum.
Advertisements

Forces In order to make an object at rest move, you need to apply a push or a pull, otherwise known as a force. A force can make an object:  Speed up.
Physics Exploring Newton’s Laws of Motion. Newton’s First Law of Motion  Inertia  A body in motion tends to stay in motion unless acted upon by an outside.
Chapter 4 Forces in One Dimension
Force Force is a push or pull on an object The object is called the System Force on a system in motion causes change in velocity = acceleration Force is.
PHYS 218 sec Review Chap. 4 Newton’s laws of motion.
1 Motion – Newton’s Laws I’d rather be a hammer than a nail... - Simon and Garfunkel.
Angular Momentum (of a particle) O The angular momentum of a particle, about the reference point O, is defined as the vector product of the position, relative.
Chapter 5 Newton’s Laws of Motion. 5-1 Force and Mass Force: push or pull Force is a vector – it has magnitude and direction.
Newton’s First Law Mathematical Statement of Newton’s 1st Law:
Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces acting on them Conditions when Classical.
Forces and the Laws of Motion Force, Mass, and Acceleration
FORCES AND LAWS OF MOTION. FORCE (push) (pull) Examples of forces: ContactField Pulling the handle of the door Pushing a stroller Hitting a tennis ball.
Newton’s Laws As simple as One, Two, Three!. Inertia Newton’s First Law is often called the Law of Inertia. But what is inertia? Inertia is the natural.
Forces and Newton’s Laws. Forces Forces are ________ (magnitude and direction) Contact forces result from ________ ________ Field forces act ___ __ __________.
Mechanics Motion Equations and Graphs Combining and Resolving Vectors Force and Acceleration Gravity and Free-Body Diagrams Projectile Motion Work and.
Newton’s Second Law (Lab)
FORCES AND LAWS OF MOTION. FORCE EXAMPLES OF FORCES: Close rangeLong Range Pulling the handle of the door Pushing a stroller Hitting a tennis ball with.
Newton’s Third Law of Motion
Forces and the Laws of Motion
Unit 1 B Newton's Laws of Motion. 2 Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces.
Force Newton’s Laws 1 First Law - Inertia Second Law – Force and Acceleration Third Law – Action and Reaction Introduction.
Honors Physics Newton’s First and Third Laws of Motion.
ISAAC NEWTON’S PHYSICS PRINCIPLES. WHAT NEWTON DID When it comes to science, Isaac Newton is most famous for his creation of the THREE LAWS OF MOTION.
Momentum and Its Conservation
Newton’s Laws. Divisions of Physics  2 Divisions of Physics –Classical Mechanics (Newtonian Physics)  Treats energy and matter as separate entities.
Chapter 4 Newton’s Laws of Motion. Newton’s First Law of Motion Every object continues in its state of rest, or of uniform motion in a straight line,
Ch. 3 & 4 Motion & Forces I. Newton’s Laws of Motion “If I have seen far, it is because I have stood on the shoulders of giants.” - Sir Isaac Newton (referring.
Chapter 4 Forces in One Dimension. 4.1 Force and Motion Force – A push or a pull exerted on an object. May cause a change in velocity:  Speed up  Slow.
Physics 111: Mechanics Lecture 4
-Motion is the state in which one object’s distance from another is changing.
Copyright © 2010 Pearson Education, Inc. Lecture Outline Chapter 5 Physics, 4 th Edition James S. Walker.
College and Engineering Physics Newton’s Laws 1 TOC First Law - Inertia Second Law – Force and Acceleration Third Law – Action and Reaction Introduction.
The Laws of Motion. Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces acting on them Describes.
Chapter 4 The Laws of Motion. Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces acting.
Newton’s Laws AP Physics C. Basic Definitions  Inertia  property of matter that resists changes in its motion.  Mass  measurement of inertia  Force.
Newton Newton's Laws of Motion describe the way a body responds to applied forces.
Lecture 7: Forces & The Laws of Motion
Newtonian Mechanics Single Particle, Chapter 2 Classical Mechanics: –The science of bodies at rest or in motion + conditions of rest or motion, when the.
Chapter 4: “Newton’s Laws of Motion” Created by G. Frega.
Newton’s Third Law.
Medical Education Research How to be successful “Lessons From Classical Physics” Jeffrey Turnbull May 2007 Victoria, BC.
Work Readings: Chapter 11.
1 Two of Newton’s Law of Motions 1) In the absence of any forces applied, an object at rest will stay at rest, and a body moving at a constant velocity.
Raymond A. Serway Chris Vuille Chapter Four The Laws of Motion.
Forces and the Laws of Motion Chapter 4. Forces and the Laws of Motion 4.1 Changes in Motion –Forces are pushes or pullss can cause acceleration. are.
Newtons 3 rd law and momentum Newton worked in the 1600s. He talked about momentum before he talked about force but, maybe because momentum is hard.
NEWTON’S THIRD LAW OF MOTION AND MOMENTUM. NEWTON’S THIRD LAW Describes action-reaction pairs When one object exerts a force on a second object, the second.
Chapter 5 Force and Motion  We have seen that part of physics is a study of motion, including acceleration which are changes in velocities.  Physics.
Chapter 5 Gravity and Motion. Essential Question How are forces related to motion.
1 Physics: Chapter 4 Forces & the Laws of Motion Topics:4-1 Changes in Motion 4-2 Newton’s First Law 4-3 Newton’s Second & Third Laws 4-4 Everyday Forces.
Resources Section 1 Laws of Motion Objectives Identify the law that says that objects change their motion only when a net force is applied. Relate the.
Notes – Representing Motion. Laws of Motion Isaac Newton – 1686 – English scientist discovered the three laws of motion Motion – The change in position.
Chapter Four The Laws of Motion.
Newton’s 3rd law.
I. Newton’s Laws of Motion
Isaac Newton ( ) Newton’s Laws of Motion
Newton’s Laws Governing Motion
Same format as first quiz. Total of 50 points
Forces and the Laws of Motion
I. Newton’s Laws of Motion
Chapter 6 – Action and Reaction
Newton’s laws of motion:
The Laws of Motion (not including Atwood)
Force.
I. Newton’s Laws of Motion
I. Newton’s Laws of Motion
Newton’s Laws of Motion
Newton's Laws Of Motion Teneighah Young.
I. Newton’s Laws of Motion
Presentation transcript:

Introduction to Particle Simulations Daniel Playne

Particle Simulations Another major class of simulations are particle or n-body simulations. In these simulations the state of the system is represented by particles.

Particle Simulations Generally each particle is represented by a set of fields. These are often: a position a velocity a mass a radius and possibly: a rotation an angular velocity

Particle Simulations These particles can represent different entities depending on the simulation. This could be: atoms molecules dust particles snooker balls asteroids planets galaxies

Particle Simulations These particles all behave in fundamentally similar ways. This behaviour is based on Newton’s Laws of Motion. These three laws are the basis for classical mechanics.

Particle Simulations First Law: Every object continues in its state of rest, or of uniform motion in a straight line, unless compelled to change that state by external forces acted upon it.

Particle Simulations Second Law: The acceleration a of a body is parallel and directly proportional to the net force F acting on the body, is in the direction of the net force, and is inversely propotional to the mass m of the body. F = ma

Particle Simulations Third Law: When two bodies interact by exerting force on each other, these forces are equal in magnitude, but opposite in direction.

Particle Simulations Simple case – Hockey Pucks Each particle represents a hockey puck sliding around on the ice. This is simple 2D system is relatively easy to simulate.

Particle Simulations First step – Vectors. In this sense a vector is referring to a mathematical or Euclidean vector. These consist of co-ordinates in space. We usually talk in vectors because it makes it easier to define something in 1D, 2D, 3D, 4D...

Particle Simulations For our 2D hockey pucks a vector is as simple as (x,y). We need two vectors for each particle – position and velocity. In this case we are going to assume that every hockey puck has the same mass and the same radius.

Particle Simulations In this case each particle has a position p and a velocity v with mass m=1 and radius r=1. To simulate the particles moving, we must calculate a new position for the particle after some period of time has passed. This is the time-step of the simulation.

Particle Simulations This can be written simply as: p t+h = p t + v t *h This is known as the Euler integration method. Which is suitable for this type of particle simulation.

Particle Simulations Our algorithm to update a particle simulation is as simple as: main loop –for all particles ‘move’ particle repeat

Particle Simulations Our algorithm to update a particle simulation is as simple as: for(int i = 0; i < N; i++) { p[i] = p[i] + v[i] * h; }

Particle Simulations Unfortunately this is a rather boring simulation. Each particle moves in a straight line and will never stop. To make it slightly more interesting we will have to enforce collisions. Collisions occur when a ‘hard’ particle hits into another ‘hard’ object.

Particle Simulations The easiest collisions are particles colliding with immovable objects. In this case our hockey pucks bouncing off the walls of the hockey rink.

Particle Simulations In any collision system there are two parts, the collision detection and the collision response. To check to see if a puck has collided with the sides of the rink, simply check to see if the puck is outside the bounds.

Particle Simulations Once a collision has been detected the system must respond to the collision. For our hockey pucks, simply reverse the velocity in the direction of the collision.

Particle Simulations main loop –for all particles ‘move’ particle if ‘collision’ with boundary –respond to collision repeat

Particle Simulations Our algorithm to update a particle simulation is as simple as: for(int i = 0; i < N; i++) { p[i] = p[i] + v[i] * h; if(p[i].x-r width) { v[i].x = -v[i].x; } if(p[i].y-r height) { v[i].y = -v[i].y; }

Particle Simulations More complex objects will require more complex collision detection and response systems. For example – hockey pucks bouncing off each other.

Particle Simulations This is now significantly more complicated. After each time-step the simulation must compare every pair of particles to see if they have collided by calculating the distance between them and checking to see if that distance is less than the combined radius of the hockey pucks.

Particle Simulations main loop –for all particles ‘move’ particle if ‘collision’ with boundary –respond to collision –for all particles for all other particles –if ‘collision’ between particles »respond to collision repeat

Particle Simulations... for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { if(distance(p[i],p[j]) < r*2) { collision! }

Particle Simulations Responding to a collision between particles is more complicated than an immovable wall. In our example the mass of both particles is the same which makes the collision easier to calculate.

Particle Simulations Calculating a collision in one dimension is simple if the masses are the same: v 1 = u 2 v 2 = u 1 where: u 1 and u 2 are the initial velocities v 1 and v 2 are the final velocities

Particle Simulations In two dimensions this is not as simple. The velocities of the particles must be split into the components that are in the direction of the collision.

Particle Simulations The ‘component’ of the velocity to be used in the collision is found from the dot product of the velocity and the unit vector.

Particle Simulations This component is the part used in the collision: u1  d1 = u1.x*d1.x + u1.y*d1.y d1 d2 u2 u1 d1*(u1  d1) d2*(u2  d2)

Particle Simulations This is how the new value can be calculated. d1*(u1  d1) d2*(u2  d2) u1 v1 d1*(u1  d1) d2*(u2  d2) u2 v2

Particle Simulations d1*(u1  d1) d2*(u2  d2) u1 v1 d1*(u1  d1) d2*(u2  d2) u2 v2

Particle Simulations d1*(u1  d1) d2*(u2  d2) u1 v1 This calculation can be written as: v1 = u1 – d1*(dot(u1,d1)) + d2*(dot(u2,d2)) v2 = u2 – d2*(dot(u2,d2)) + d1*(dot(u1,d1)) d1*(u1  d1) d2*(u2  d2) u2 v2

Particle Simulations... for(int i = 0; i < N; i++) { for(int j = i+1; j < N; j++) { if(distance(p[i],p[j]) < r*2) { v1 = u1 – d1*(dot(u1,d1)) + d2*(dot(u2,d2)) v2 = u2 – d2*(dot(u2,d2)) + d1*(dot(u1,d1)) }

Particle Simulations There is a certain degree of error in this calculation. This is caused by the fact that the particles are allowed to move inside each other before the collision occurs.

Particle Simulations This can be solved by ‘reversing’ time to the point of the collision. Calculating the new velocities and then stepping the simulation back to the present time.

Particle Simulations The calculation for this is: if(distance(p[i],p[j]) < r*2) { t=(r*2-distance(p[i],p[j]))/dot(u1,d1)+dot(u2,d2)) p1 = p1 – u1*t p2 = p2 – u2*y v1 = u1 – d1*(dot(u1,d1)) + d2*(dot(u2,d2)) v2 = u2 – d2*(dot(u2,d2)) + d1*(dot(u1,d1)) p1 = p1 + v1*t p2 = p2 + v2*t }

Particle Simulations This can lead to a new problem, because the particles are moving during the ‘collision’ phase. This movement can cause additional collisions. In order to solve this problem the collisions must be resolved in the order they occur. The algorithm becomes:

Particle Simulations main loop –for all particles ‘move’ particle if ‘collision’ with boundary –respond to collision –detect collisions –while collision has occurred find and resolve first collision detect collisions repeat

Particle Simulations In this way the collisions are always resolved in the order they would have occurred and there is no error introduced by our system.

Particle Simulations Example