This project simulates the motion of the Solar System in 2D using both the Beeman and Euler integration methods.
It models gravitational interactions between the Sun, planets, and a satellite performing a Hohmann transfer from Earth to Mars, and compares:
- Orbital periods vs real values
- Energy conservation for Beeman vs Euler
- Minimum distance between the satellite and Mars
- Time taken for the satellite to reach Mars
The simulation produces an animated plot of the Solar System and writes out energy and orbital period data to text files.
- π Full Solar System model (Sun + 8 planets + satellite)
- π°οΈ Satellite launch using Hohmann transfer parameters from Earth to Mars
- βοΈ Two numerical integrators:
- Beeman method (
Simulate_beeman) - Euler method (
Simulate_Euler)
- Beeman method (
- π Energy analysis:
- Total energy vs time for Beeman and Euler
- Plotted on the same graph for comparison
- π Orbital period analysis:
- Computes average orbital periods from the simulation
- Compares with real orbital periods (in Earth years)
- Outputs a nicely formatted table using
tabulate
- π₯ Matplotlib animation of planetary orbits, including an inset for inner planets
Typical layout of this repository:
project/
βββ main.py # The main simulation script (your current file)
βββ planets.json # Input data: masses, orbital radii, colours, etc.
βββ energy_data_beeman.txt # Output: energy vs time for Beeman (generated)
βββ energy_data_euler.txt # Output: energy vs time for Euler (generated)
βββ orbital_periods.txt # Output: orbital period table (generated)
βββ README.md # Project documentation
βββ requirements.txt # Python dependencies