90 likes | 276 Views
Interactions: Collision Model. Supercomputing Challenge Kickoff 2008 Bob Robey and Drew Einhorn. Collision Models. N-body simulations often need collision models. These are short-range forces that occur when two objects touch. Typical attributes Elasticity Fracture Rebound
E N D
Interactions: Collision Model Supercomputing Challenge Kickoff 2008 Bob Robey and Drew Einhorn
Collision Models • N-body simulations often need collision models. • These are short-range forces that occur when two objects touch. • Typical attributes • Elasticity • Fracture • Rebound • Gaming--battles
Simple 1D Collision Model • In this model, the steel ball moves to the right until it impacts the other steel balls
Governing Laws • Momentum conserved • Sum (Mass*Vel) =Constant + sources • Mass conserved • Fracture/Fragmenting/Aggregation • Energy conservation
Matlab Code • Update positions (P) using velocities (V) P(:)=P(:)+delta*V(:); • Contact test if (V(i) > 0 && P(i) > P(i+1)-1.9) • Transfer momentum • (M- mass, c – elasticity) V(i+1)=V(i)*M(i)*c/M(i+1); V(i)=(1.0-c)*V(i); (or V(i) = 0; and heat produced to conserve energy)
Cycle logic • Putting together: P(:)=P(:)+delta*V(:); for i=1:size(P)-1 if (V(i) > 0 && P(i) > P(i+1)-1.9) V(i+1)=V(i)*M(i)*c/M(i+1); V(i)=0; end end update_plot(H,P); • Repeat as necessary in loop
Extensions • Balls with different masses • Different elasticity – steel vs rubber • Two dimensions – pool table
Sample Codes • Matlab code for 1D collision • Brownian Motion -- Matlab • Java code from open source physics for 2D interaction • http://www.compadre.org/OSP/document/ServeFile.cfm?ID=7572&DocID=592 • Python Example