Skip to main content

Fast astrophysical N-body simulator

Project description

GravityLab: Astrophysical N-body simulator.

An astrophysical N-body simulator.

Installation

Dependencies

The following are required to run GravityLab:

  • Cython
  • NumPy
  • Matplotlib

Install

To install this code, run the following commands in your terminal:

> git clone https://github.com/Kushaalkumar-pothula/gravitylab.git
> python setup.py build_ext --inplace

Usage

You can run the simulation using the gravitylab.simulate module. This module provides a simple yet powerful class Simulation. A Simulation instance can be instantiated with the following command (Simulation parameters not shown here):

from gravitylab.simulate import Simulation
my_simulation = Simulation()

Add initial conditions to a simulation instance:

my_simulation.initial_conditions()

And then run a simulation using the .run() method:

positions = my_simulation.run()

The positions variable is a N x 3 array of positions which can be plotted.

An example for running GravityLab simulations can be found in gravitylab/example.py:

> python gravitylab/example.py

Author

This code was written by Kushaal Kumar Pothula. I wrote this code during my 10th grade while learning about numerical simulations during the summer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GravityLab-2.1.tar.gz (368.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page