N-Body Gravitational Simulations

Slides:



Advertisements
Similar presentations
My First Fluid Project Ryan Schmidt. Outline MAC Method How far did I get? What went wrong? Future Work.
Advertisements

Force and Motion Force Newton’s First Law Newton’s Second Law Newton’s Third Law Gravitational Force Weight Normal Force pps by C Gliniewicz.
Parallel Strategies Partitioning consists of the following steps –Divide the problem into parts –Compute each part separately –Merge the results Divide.
Course Outline Introduction in algorithms and applications Parallel machines and architectures Overview of parallel machines, trends in top-500 Cluster.
Halliday/Resnick/Walker Fundamentals of Physics 8th edition
Module on Computational Astrophysics Professor Jim Stone Department of Astrophysical Sciences and PACM.
Interactive Animation of Structured Deformable Objects Mathieu Desbrun Peter Schroder Alan Barr.
Daniel Blackburn Load Balancing in Distributed N-Body Simulations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
PREPARED BY…….. ANJALI ACHARYA ( ) SHIVANI GAJJAR ( ) MANALI PATEL ( )
Newton’s Law of Gravitation. Newton concluded that gravity was a force that acts through even great distances Newton did calculations on the a r of the.
Newton's law of universal gravitation states that every point mass in the universe attracts every other point mass with a force that is directly proportional.
Course Outline Introduction in algorithms and applications Parallel machines and architectures Overview of parallel machines, trends in top-500, clusters,
Physics 2102 Lecture 04: FRI 23 JAN Electric Charge I Physics 2113 Jonathan Dowling Charles-Augustin de Coulomb (1736–1806) Version: 10/7/2015 Benjamin.
Force A push or pull exerted on an object..
Chapter 3 Parallel Algorithm Design. Outline Task/channel model Task/channel model Algorithm design methodology Algorithm design methodology Case studies.
Scheduling Many-Body Short Range MD Simulations on a Cluster of Workstations and Custom VLSI Hardware Sumanth J.V, David R. Swanson and Hong Jiang University.
Newton’s Third Law of Motion Level 1 Physics. N.T.L Whenever one body exerts a force on a second body, the second body exerts an oppositely directed force.
1.  Legend has it that Sir Isaac Newton was struck on the head by a falling apple while napping under a tree. This prompted Newton to imagine that all.
Engineering Mechanics: Statics
Lecture 4 TTH 03:30AM-04:45PM Dr. Jianjun Hu CSCE569 Parallel Computing University of South Carolina Department of.
Chapter 6 Gravitation and Newton’s Synthesis HW5: Chapt 6: Pb. 11, Pb. 24, Pb. 25 and Chapt. 7: Pb 6, Pb.11, Pb. 16, Pb.19, Pb. 21 –Due Friday, Oct. 9.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Gravity. Unanswered questions Galileo describes falling objects by rolling objects down a ramp. But why does everything accelerate the same rate regardless.
Molecular Modelling - Lecture 2 Techniques for Conformational Sampling Uses CHARMM force field Written in C++
1 The Law of Universal Gravitation. 2 A little background … Legend has it that Sir Isaac Newton was struck on the head by a falling apple while napping.
An Efficient CUDA Implementation of the Tree-Based Barnes Hut n-body Algorithm By Martin Burtscher and Keshav Pingali Jason Wengert.
PHY115 – Sault College – Bazlurslide 1 Gravitational Force.
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.
Rigid Body Dynamics CSE169: Computer Animation
Smoothed Particle Hydrodynamics Matthew Zhu CSCI 5551 — Fall 2015.
Barnes Hut N-body Simulation Martin Burtscher Fall 2009.
High-Performance Computing 12.2: Parallel Algorithms.
Newton’s Law of Universal Gravitation
Barnes Hut N-body Simulation Martin Burtscher Fall 2009.
A satellite orbits the earth with constant speed at height above the surface equal to the earth’s radius. The magnitude of the satellite’s acceleration.
A novel approach to visualizing dark matter simulations
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! 1 ITCS 4/5145 Parallel Computing,
Electric Force & Coulomb’s Law
Physics 2102 Lecture 04: WED 03 SEP
Progressive Clustering of Big Data with GPU Acceleration and Visualization Jun Wang1, Eric Papenhausen1, Bing Wang1, Sungsoo Ha1, Alla Zelenyuk2, and Klaus.
Universal Law of Gravitations, Statics, Coulomb’s Law
Setup distribution of N particles
ChaNGa: Design Issues in High Performance Cosmology
Forces Glossary The centre of gravity of an object is the point at which the weight of the object can be said to act. © Mike Benn, Graham George 2016.
Newton’s Law of Universal Gravitation
Newton’s law of Universal Gravitation
Mass training of trainers General Physics 1
Systems of Particles.
Law of Universal Gravitation
s= mt+constant where m=Ds/Dt i.e., speed
Newton’s Law of Gravity
What is gravity? Galileo and Newton gave the name
Quantum Two.
Systems of Particles.
Performance Evaluation of the Parallel Fast Multipole Algorithm Using the Optimal Effectiveness Metric Ioana Banicescu and Mark Bilderback Department of.
Course Outline Introduction in algorithms and applications
Find the velocity of a particle with the given position function
Law of Universal Gravitation
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
Setup distribution of N particles
Forces.
Universal Gravitation
Pressure in a fluid Pressure in a fluid acts equally in all directions
Mechanics Gravitations MARLON FLORES SACEDON.
Chapter 01: Introduction
Parallel Programming in C with MPI and OpenMP
Topic 6: Fields and Forces
Newton’s Law of Universal Gravitation
Universal Gravitation
Presentation transcript:

N-Body Gravitational Simulations Joshua White Patrick Loftus

Overview Purpose and types of n-body simulations Gravitational simulations Derivation of direct gravitational algorithm HOT n-body simulation algorithm Derivation of tree-reduction algorithm Results Conclusions Questions

Purpose and types of n-body simulations A simulation of a dynamical system of particles Usually under the effects of a physical force (e.g., gravity, Coulomb force, etc.) Used to model interactions between bodies and forces Used over scales from the absolute smallest possible (quantum many-body simulations) to the absolute largest possible (cosmological evolution simulations) Common applications: galaxy formation and evolution, star cluster interactions, subatomic and quantum interactions, thermodynamic fluid simulations We will focus on gravitational simulations, but the principles are generally applicable to all types of n-body simulations

Gravitational simulations 32,768 solar mass bodies 1.8 million solar mass central core 1 billion year simulation time Video source: Wikimedia Commons

Gravitational simulations Newton’s Law of Universal Gravitation The force between two objects is proportional to the product of their masses and inversely proportional to the square of the distance between them Formally: 𝐹 12 =− 𝐹 21 =𝐺 𝑚 1 𝑚 2 𝑟 2 𝑟 Where the Universal Gravitational Constant, G = 6.67384 x 10-11 m3/kg*s2 Image source: Wikimedia Commons

Gravitational simulations For interactions involving multiple bodies, the resultant force acting on a body is equal to the sum of the contributions from all other bodies. 𝐹 𝑟𝑒𝑠 = 𝑚 𝑖 𝑎 𝑖 = 𝑖,𝑗 𝐺 𝑚 𝑖 𝑚 𝑗 𝑟 𝑖𝑗 2 𝑟 𝑖𝑗 The resultant acceleration of the body can be found by canceling its mass contribution, yielding: 𝑎 𝑖 = 𝐺 𝑚 𝑗 𝑟 𝑖𝑗 2 𝑟 𝑖𝑗

Gravitational simulations For direct simulation, the acceleration is evaluated at discrete time steps, then integrated. 𝑥 𝑡 = 𝑡 0 𝑡 𝑎 𝑥 𝑡 ⅆ𝑡 𝑑𝑡 Given velocity vx, initial position x0 and treating all variables except t as constant over a single time step, the above can be directly integrated. 𝑥 𝑡 = 𝑥 0 + 𝑣 𝑥 t+ 1 2 𝑎 𝑥 𝑡 2 The velocity is then updated for the next iteration. 𝑣 𝑥 𝑡 = 𝑣 0 + 𝑎 𝑥 𝑡 Yields time complexity of 𝒪( 𝑛 2 )

Derivation of direct gravitational algorithm The “heart” of algorithm Determine instantaneous acceleration of each body Direct integration to determine position at next time step Write positions to file Selection of OpenMP Necessity to synchronize at each step Excessive message passing between processors/threads Use of OpenMP “parallel for” pragma creates implicit barrier after each iteration Time complexity 𝒪( 𝑛 2 𝑝 )

Derivation of direct gravitational algorithm The “heart” of the algorithm

Derivation of direct gravitational algorithm Updating the acceleration vectors

Derivation of direct gravitational algorithm Updating the position and velocity vectors

HOT n-body simulation algorithm Breaks the universe into octants using a hashed oct-tree Interactions with non-adjacent octants are “smoothed” using system’s center of mass Assumes fixed universe size Tree must be rebuilt for each body Load balancing issues Synchronization issues Time complexity 𝒪(𝑛 log 𝑛 )

HOT n-body simulation algorithm Universe is partitioned into octants (quadrants shown for clarity) Each octant repartitioned until each contains one body Center of mass for partition calculated Image source: Burtscher and Pingali, 2011

HOT n-body simulation algorithm Interaction with non-adjacent regions calculated based on center of mass Interactions with bodies in adjacent regions calculated directly Preserves resolution of short distance interactions Problematic because tree is dependent on fixed universe size Image source: Burtscher and Pingali, 2011

Derivation of tree-reduction algorithm Resultant force points to center of mass Magnitude determined by combined masses of bodies Recall 𝑎 𝑖 = 𝐺 𝑚 𝑗 𝑟 𝑖𝑗 2 𝑟 𝑖𝑗 Center of mass given by 𝑠 𝑐𝑚 = 1 𝑀 𝑡𝑜𝑡 𝑖 𝑠 𝑖 𝑚 𝑖 Thus, large-scale behavior can be approximated using center of mass of the entire cluster

Derivation of tree-reduction algorithm By sacrificing small-scale resolution, the number of trees per iteration can be reduced to one Using a binary reduction, the center of mass of the entire cluster is calculated Each body removes its contribution to mass total and center of mass when calculating force interaction Has the advantage of making no assumptions about overall universe size Not suitable where fine resolution interactions are required, but preserves large-scale behavior of system Time complexity 𝒪(𝑛+ log 𝑛 )

Derivation of tree-reduction algorithm Tree reduction to determine center of mass

Derivation of tree-reduction algorithm Updating acceleration, position, and velocity vectors

Results N-body simulation results Timing results What are our bodies doing and why are they behaving that way? Timing results Was the tree algorithm significantly faster than the direct algorithm? As we added threads, did we see speedup for both algorithms?

N-body simulation results Direct algorithm simulation Tree algorithm simulation

N-body simulation results Direct algorithm

N-body simulation results Tree algorithm

Barnes-hut approximation

White-loftus approximation

Timing results

Timing results: Direct algorithm

Timing results: Tree algorithm

Conclusions Data confirms that tree algorithm is exponentially faster than the direct algorithm Both algorithms showed significant speedup when ported to OpenMP N-body simulations are fun!

2048 bodies!

References An efficient CUDA implementation of the tree-based Barnes Hut n-body algorithm. Martin Burtscher and Keshav Pingali. In GPU Computing Gems Emerald Edition, pages 75-92. Morgan Kaufmann, 2011. 2HOT: an improved parallel hashed oct-tree n-body algorithm for cosmological simulation. Michael S. Warren. In SC '13 Proceedings of the International Conference on High Performance Computing, Networking, Storage and Analysis. Article No. 72. A parallel hashed oct-tree n-body algorithm. Michael S. Warren. In Proceedings of the 1993 ACM/IEEE conference on Supercomputing. Pages 12-21.