Efficient solution of the n body problem
This presentation is the property of its rightful owner.
Sponsored Links
1 / 41

Efficient solution of the n-body problem PowerPoint PPT Presentation


  • 86 Views
  • Uploaded on
  • Presentation posted in: General

Efficient solution of the n-body problem. Honor Thesis Presentation Mike Bantegui, Hofstra University Advisor: Dr. Xiang Fu, Hofstra University. Outline. The N-Body Problem Computational challenges Results Existing work IGS Framework Extensions. The n-body problem.

Download Presentation

Efficient solution of the n-body problem

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Efficient solution of the n body problem

Efficient solution of the n-body problem

Honor Thesis Presentation

Mike Bantegui, Hofstra University

Advisor: Dr. Xiang Fu, Hofstra University


Outline

Outline

  • The N-Body Problem

  • Computational challenges

  • Results

  • Existing work

  • IGS Framework

  • Extensions


The n body problem

The n-body problem

  • Given mass, position and velocities of N bodies at some time t

  • Know pairwise forces using

  • Determine evolution of the system of bodies

  • Used to study Stellar Dynamics


The n body problem cont

The n-body problem cont.

  • Must integrate 3N coupled nonlinear second order ordinary differential equations

  • Not analytically possible except for N = 2

  • Must resort to numerical methods


Candidate numerical solution

Candidate Numerical solution

  • Set

  • While

  • For each body, evaluate total force

  • Integrate position, velocity of each body over small time

  • Set


Force evaluation step

Force Evaluation step

  • For i = 0 … N – 1

  • For j = I + 1 … N – 1

  • Compute pairwise gravity between body and


Example force evaluation

Example force evaluation


Time complexity

Time Complexity

  • Total steps =

  • Force evaluations =

  • Integration =

  • Overall complexity =


Issues with candidate solution

Issues with candidate solution

  • Very slow due to quadratic behavior of force evaluation

  • Requires evaluations for

  • Constant time steps could miss near-collisions

  • Force evaluation not obviously parallelizable


Geometric trick for parallelization

“Geometric trick” for parallelization


Geometric trick for parallelization1

“Geometric trick” for parallelization


Geometric trick for parallelization2

“Geometric trick” for parallelization


Time complexity of geometric trick

Time complexity of geometric trick

  • (Triangular portion)

  • (Block portion)


Issues with geometric trick

Issues with geometric trick

  • Parallelizes poorly beyond P > 2 using OpenMP

  • Use naïve force evaluation algorithm for P > 2:

  • For i = 0 … N – 1

  • For j = 0 … N – 1

  • if i != j

  • Add Force due to acting on onto

  • Twice as much work, for scalability


Na ve force evaluation speedup

Naïve force evaluation speedup


Handling close encounters

Handling close encounters

  • Keep track of a minimum collision timescale for each body:

  • Use to vary when integrating

  • Number of steps taken is no longer predictable

  • Support higher order PEC-type integrators (Leapfrog, 4th and 6th order Hermite)

  • Allows dramatic increase in step size for similar error


A more efficient way of evaluating force

A more efficient way of evaluating force

  • Treat clustered system as point-like body

  • Force between cluster and a body is given by total mass at center of mass


Example of clustering bodies

Example of clustering bodies


Hierarchical force evaluation

hierarchical force evaluation

  • Apply the clustering principle recursively

  • Consider sub-clusters within a cluster

  • Refine force evaluation via sub-clusters instead of main cluster


Clustering algorithm

Clustering algorithm

  • Node Cluster(bodies, min_bound, max_bound)

  • If bodies.size == 0

  • return null

  • if bodies.size == 1

  • return node containing body

  • Collect bodies into spatial groups

  • For each group

  • Cluster(group.bodies, group.min_bound, group.max_bound)

  • Compute first order multipole expansion, passing up tree

  • return node containing groups


Methods of spatial subdivision

Methods of spatial subdivision

  • Octree Barnes-Hut Algorithm

  • K-D tree Stadel Algorithm

  • Other choices possible

  • Time to build tree is

  • Parallelization opportunity available on recursive calls to Cluster


Force evaluation algorithm

Force evaluation algorithm

  • TreeWalk(body)

  • For each branch in the tree

  • If branch is leaf

  • If branch.body!= body

  • Compute force of branch.body on body

  • Else

  • Compute distance between branch and body

  • If body is well separated from cluster

  • Compute force of branch on body

  • Else

  • branch.TreeWalk(body)


Force evaluation algorithm cont

Force evaluation algorithm, cont

  • Call TreeWalk for each body:

  • For i = 0 .. N – 1

  • TreeWalk()


Separation criteria

Separation criteria

  • Body is well separated when acceptance criteria met:

  • Accept the approximation when clusters compact, body is far away

  • allows tuning for performance vs. accuracy

  • Alternative criteria available


Time complexity of tree walk

Time complexity of tree walk

  • For single body walking a node of size N:

  • For N bodies:


Overview of hierarchical algorithm

Overview of hierarchical algorithm

  • Build tree in steps

  • Walk tree in steps

  • For N = 65536, brute-force pairwise requires evaluations

  • Hierarchical algorithm can do same in evaluations

  • Very easily parallelization


Parallelizing tree methods

Parallelizing tree methods


Scaling to large n octree

Scaling to large n, octree


Scaling to large n kd tree

Scaling to large n, kd-tree


Scaling to large n brute force

Scaling to large n, brute force


Brute force vs tree methods

Brute force vs tree methods


Energy errors

energy errors


Energy errors cont

energy errors cont.


Related work

Related work

  • nbody1 – nbody6, SverreAarseth

  • ACS toolkit, Jun Makino and Piet Hut

  • Grav-Sim, Mark Ridler

  • Gravit, Gerald Kaszuba et al.


The proposed framework

The proposed framework

  • Component based Interactive Gravitational Simulator

  • CoreIGS – Core simulation library

  • CmdIGS – Command line driven interface

  • VisIGS – Interactive visualizer


Software architecture

Software Architecture


Project stats

Project stats

  • Open Source – Available at IGS.codeplex.com

  • 3+ years development

  • 5670 lines of code

  • 65 .cpp, .h files

  • 107 subversion revisions

  • 8 development iterations

  • Many failures before success!


Extensions

Extensions

  • Individual time steps

  • Distributed simulations using MPI

  • Higher order integrators

  • Command interface for the visualizer

  • Other spatial subdividers (Hilbert curves, etc.)

  • Multipole expansion for acceleration and higher derivatives

  • Pairwise interactions between tree nodes ( evaluations!)


Conclusions

Conclusions

  • Tree methods very efficient

  • Performance vs. Accuracy tradeoff possible

  • Extremely parallelizable

  • Accurate, real-time simulations possible on commodity hardware


Acknowledgements

acknowledgements

  • Dr. Xiang Fu for advisement and helpful discussions

  • Dr. GerdaKamberova for helpful comments on the paper

  • Lukasz Bator for many discussions on algorithmic efficiency


Thank you for coming

Thank you for coming!

  • Any questions?


  • Login