https://github.com/pwhiddy/nbody-gravity
A small but powerful nbody gravity simulator with a built-in renderer
https://github.com/pwhiddy/nbody-gravity
astronomy barnes-hut cosmology dark-matter gravity nbody physics simulation
Last synced: about 1 month ago
JSON representation
A small but powerful nbody gravity simulator with a built-in renderer
- Host: GitHub
- URL: https://github.com/pwhiddy/nbody-gravity
- Owner: PWhiddy
- License: mit
- Created: 2017-02-13T05:21:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-10T22:02:00.000Z (over 2 years ago)
- Last Synced: 2025-04-13T00:36:35.012Z (about 1 month ago)
- Topics: astronomy, barnes-hut, cosmology, dark-matter, gravity, nbody, physics, simulation
- Language: C++
- Size: 477 KB
- Stars: 85
- Watchers: 8
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nbody Gravity Simulator
Implements the Barnes–Hut algorithim to handle the gravitional interaction of over a million particles in 3D space. Currently set up to generate disks of particles
Includes a renderer that produces high quailty PPM images of the simulation. These can be compiled into animations. [Example](https://drive.google.com/file/d/0B4Kdo1Bslx5PbUFQY3ZPT2NQM2M)# Setup
Use build.bash to create the program. That's it! Executing "run" will immediately start simulating and rendering to the images folder until canceled or frame limit is reached. Note: This may consume significant storage space.Note: Some versions of clang on MacOS do not support openmp. You can build using another compiler or simply by removing the -fopenmp option from build.sh (this will incur a performance decrease of course)
Initial conditions parameters can be modified in the Constants.h file, and are baked into the program so build must be run again after making changes.
If you have ffmpeg you can use createVideo.bash to generate a video from the images.
# Images
Initialized as a uniform disk
Higher disk mass
"Hot" Disk
# Outtakes
Many interesting things happened as I frequenty broke my code



