Skip to content

An accurate Solar system simulation with cool mathematics and a custom 3D engine

Notifications You must be signed in to change notification settings

daniilgrbic/SolarPy

Repository files navigation

SolarPy: 3D Solar System Simulation

This project is a fairly accurate simulation of the Solar system in 3D. The initial positions are calculated using desired date and orbital elements of planets. Once ready, the simulation proceeds by using the general second order ordinary differential equation system of planetary motion, which we solve numerically using Runge-Kutta method.

Required modules

  • NumPy
  • Pygame

Optional: astroquery & astropy (to use data from JPL Horizons instead of generating out own)

Running the simulation

Simply run main.py to start the simulation with default parameters: the start date will be set to the current date, and the program won't use JPL Horizons Queries to determine initial state.

The program can be run with additional command line arguments:

  • --start=<date> Start simulation from date specified in YYYY-MM-DD format. For example:
    python main.py --start=1500-01-01
    
  • --dt=<delta> Set the dt used in simulation in hours (default is 24h)
    python main.py  --start=2000-01-01 --dt=8
    
  • --horizons Use JPL Horizons Queries to calculate initial state (can be combined with --start).
    python main.py --horizons
    

Controlling the simulation

  • Press SPACE to pause/unpause the simulation
  • Drag the mouse to move the camera, scroll to zoom
  • Scroll while holding the right mouse button to change simulation speed
  • Press p in order to dump current positions and velocities of planets into a file in the output folder

References

About

An accurate Solar system simulation with cool mathematics and a custom 3D engine

Topics

Resources

Stars

Watchers

Forks

Languages