You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Flight.potential_energy uses a different gravity model than the simulation #1216
fromrocketpyimportEnvironmentmu=3.986004418e14# hard-coded in Flight.potential_energyenv=Environment()
print(env.gravity(0), mu/env.earth_radius**2) # 9.7803 vs 9.7983 (+0.18%)env=Environment(gravity=9.81)
print(env.gravity(0), mu/env.earth_radius**2) # 9.81 vs 9.7983
Mechanism
Flight.potential_energy uses a fixed mu with an inverse-square law, while the flight is integrated with env.gravity (Somigliana by default, or whatever the user passes). The two gravity models differ, so Flight.total_energy drifts even without drag: about 0.18% of m * g * dz on the default Calisto flight, roughly 700 J over a 398 kJ coast. With a user-defined gravity the potential energy is not tied to the simulated model at all. The code already carries # TODO: this constant should come from Environment.
Hypothesis (not verified): deriving the potential energy from env.gravity would make total_energy consistent with the integrated dynamics.
Activity
BUG: derive Flight.potential_energy from Environment.gravity (RocketP…
MateusStano commentedon Nov 28, 2026
Fixed by #1224, merged into
develop:Flight.potential_energyis now computed fromEnvironment.gravity.