GithubHelp home page GithubHelp logo

n-body's Introduction

n-body

Parallel Barnes-Hut Algorithm

Description

Program for simulating N-body systems. The algorithm is a parallel implemenation of the Barnes-Hut algorithm inspired by Salmon, John K. Parallel hierarchical N-body methods. Diss. California Institute of Technology, 1991. The program can run on 2d process using MPI.

A simulation of two spinning disks and a visualization of the Barnes-Hut tree.

Installation

Install a MPI library such as OpenMPI or MPICH. On Mac OS X this can be done through Homebrew:

$ brew install mpich

Download the git repository and build the program in a some directory, e.g. build

$ git clone https://github.com/pbarkm/n-body.git  
$ cd n-body  
$ mkdir build
$ cd build
$ cmake ..
$ make

To check if the program runs (on 2 processes):

$ mpirun -np 2 ./n_body

The supplied python files for plotting require matplotlib and numpy.

Running

To display the command line options run

$ mpirun -np 1 ./n_body -?

The following command runs a simulation of 1000 bodies for 10000 time steps. The sampled positions of the bodies are stored in positions.txt and the program is run with the verbose flag (-v).

$ mpirun -np 2 ./n_body -N 1000 -s 10000 -v -o positions.txt

A python script is supplied to animate the simulation.

$ python py/plot.py positions.txt

n-body's People

Contributors

linyinfeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.