Concretizing the physics formulas we've all seen in class - making them more approachable - by means of interactive visualizations. Simulating orbital mechanics for deep-space navigation and missions.\n 2024 McGill Physics Hackathon Submission
Concretizing the physics formulas we’ve all seen in class - making them more approachable - by means of interactive visualizations. Simulating orbital mechanics for deep-space navigation and missions.
Tian Yi Xia1, Thomas Deleuze-Bisson1, Evan Parasol1
1Dawson College, Montréal
Three Dawson College Students in the Enriched Science Program. As we share common passions such as programming, physics, space and math, we’ve decided to participate in the 2024 Edition of the McGill University Physics Hackathon. Ever since we had figured out that astrophysics was a field that scared most people because of its complexity, we decided to make it our mission to demonstrate it in the simplest way possible and what better way to do so than to make an accessible, interactive and adaptable sandbox in which the powers of gravitational fields, forces and accelerations can be observed - and harnessed.
Taking the wonder of space and the beauty of orbital mechanics, to visualize them to the eyes of anyone by implementing a program that simulates the orbits of celestial bodies around a black hole.
Mass and gravitational pull of the bodies increasing as it collisions happen between the orbiting bodies, to mirror how that happens in reality.
Interactive and engaging for users: a phone website where the user can launch planets with masses and velocities into the system, so as to continually have more interactions between celestial bodies, the black hole, and each other.
force_awakens/
: Root of Python package
__main__.py
: Entrypointapp.py
: Rendering loopgraphics/
draw.py
: Objects and planets drawingrender.py
: OpenGL rendering helper functionsmechanics/
mechanics.py
: Body adding mechanicscolors.py
: Body colorselements_in_space.csv
: Body propertiesweb/
server.py
: Webserver for client connection and interactivityindex.html
: Client side websiteimages/
: Resources and loaded texturesThe requirements for running the code are as follows:
We obtain an accurate representation of what each known star and exoplanet looks like which abled us to draw their visual models. For planets from the Star Wars Universe, we looked trough various fan websites, approximations and even quotes from the movie to get their properties.
Organize planet properties in order to be able to plug them in our actual black hole model.
Simulate body interactions with Newtonian Physics and Euler Integration over timesteps, for each body pair interaction.
We calculate seperatly the gravitational force, and sum the forces exerted by the different planets on the desired planet. We repeat this process for every single planet. In other words, we calculate the the sum of forces for every planets by adding all of the Fg that the other planets exert on it.
We then find their acceleration with Newton’s Second Law. Their velocity using the acceleration and finally, their position using this velocity that gets integrated at 60Hz.
Render simulated planets and stars using OpenGL, with a user interface built in Imgui.
Clone repository locally
git clone https://github.com/ThatAquarel/force_awakens.git
cd force_awakens/
Install Python dependencies with python>=3.11
pip install -r requirements.txt
Install package locally in development mode
pip install -e .
Run program with full features set
python -m force_awakens --web
Here are other more advanced options for specific features
python -m force_awakens # Run simulation without website
python -m force_awakens --web --port 5000 # Specify port
python -m force_awakens --web --token $NGROK_AUTHTOKEN$ # Specify token
python -m force_awakens --web --no-tunnel # Run locally on 127.0.0.1