This page is from a project inspired by chapter 1 of "Computational Physics", a book we'll be working out of for the class of the same name in my last year of the Physics BS program.
In it's current state, the interactivity is limited to just modifying a few flight parameters like how long the engines are lit for. But, for the near future, I plan to add:
The code began as a simple 1D example where a rocket takes off and flies purely upward. It consisted of only "for" loops in Python and originally just used equations of motion with known parameters for Starship.
I then increased the complexity of the simulation, adding in elements for aerodynamic drag and moved to 2D. I also added in the stage separation event, and created separate events for the stage 2 initial burn, coast phase, and insertion burn.
The nominal flight path to a particular orbit is currently above my paygrade, so for now the flight path is calculated via the following steps:
This is still very much a work in progress. Currently, the selectable parameters are not particularly illustrative of the complexities of getting the rocket to orbit.
The simulation itself is lacking a meaningful control of pitch direction, as it uses simplistic angle-changes to change direction. That makes it limited to just the one orbital inclination for now. The aerodynamic model is also most likely underestimating the contribution of drag at hypersonic speeds.
Below the simulation, I walk through the steps of putting this code together, and the physical consequences of each input.