Thank you to a YouTube commenter on this video ( https://youtu.be/TzX6bg3Kc0E ) for pointing out that SciPy's ODE package has a function solve_ivp that in my opinion is a much better solution for the Spacecraft and Rocket classes. Here are the reasons:
This function outputs the adaptive step size solvers' time steps and states at those steps: The previous implementation with scipy.integrate.ode requested the solution at user given time steps (i.e. every 100 seconds, give me the spacecraft state), which is not representative of how the solver is solving the ODE. With scipy.integrate.solve_ivp, we allow the solver to solve throughout the entirety of the propagation time, and it outputs the simulation times and states that it used. This way, we indirectly control the time steps by setting absolute and relative tolerances to the solution
Stop conditions are integrated as events: solve_ivp accepts events in the form of functions that can allow the propagation to be stopped when a user-defined zero crossing occurs, which works well with the trajectory propagation stop conditions that have been previously implemented.
CONS:
The implementation of this function is much less intuitive: Stop conditions zero-crossings are not trivial for someone in the processing of learning orbital mechanics, and there is a specific nuance to the solve_ivp events that requires defining attributes to the Spacecraft stop_condition methods that is very non-intuitive to a Python beginner. For example:
For these CONS reasons, the Spacecraft class will be updated with this function, but the Fundamentals of Orbital Mechanics series will continue using a constant step-size RK4 solver because it is much more intuitive, and complex ODE solver schemes are outside of the scope of learning the fundamentals of orbital mechanics.
Thank you to a YouTube commenter on this video ( https://youtu.be/TzX6bg3Kc0E ) for pointing out that SciPy's ODE package has a function solve_ivp that in my opinion is a much better solution for the Spacecraft and Rocket classes. Here are the reasons:
CONS: The implementation of this function is much less intuitive: Stop conditions zero-crossings are not trivial for someone in the processing of learning orbital mechanics, and there is a specific nuance to the solve_ivp events that requires defining attributes to the Spacecraft stop_condition methods that is very non-intuitive to a Python beginner. For example:
`
` The reason for func being used can be found in this StackOverflow answer: https://stackoverflow.com/questions/53450624/hasattr-telling-lies-attributeerror-method-object-has-no-attribute-annot
For these CONS reasons, the Spacecraft class will be updated with this function, but the Fundamentals of Orbital Mechanics series will continue using a constant step-size RK4 solver because it is much more intuitive, and complex ODE solver schemes are outside of the scope of learning the fundamentals of orbital mechanics.