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