Allow sustainer tumble before apogee #2457
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the tumble stepper was first added, a stage was only allowed to tumble after apogee was reached (I've got no idea why this limitation was imposed). Later, booster stages were allowed to tumble before apogee but the sustainer was not; if the conditions for tumbling were reached for the sustainer a warning was raised but the sustainer continued to use the RK4 stepper (see #181). At some point (I'm not sure when) the warning was removed. Nowhere do I get a clear picture of why the sustainer is prohibited from tumbling before apogee.
This PR allows the sustainer to tumble under the same conditions as other stages. If the sustainer is still under thrust when it begins to tumble, the simulation stops with a SIM_ABORT event. There are two main reasons to do this:
We get not-infrequent questions asking why a simulation gives an unexpectedly low apogee from users who don't realize their design is unstable and don't understand the meaning of the high Angle of Attack warning. Hopefully an explicit "tumble under thrust" abort may be clearer.
When a rocket tumbles under thrust, we can get a large number of high angle of attack warnings, basically for every angle encountered. While there is probably a way to consolidate them, it seems cleaner to simply stop when we don't have good data to present any more.
Here's a .ork for the Simple Model Rocket example, with its fins removed so it will be unstable:
simple-nofins.zip
Simulating the A8-3 sim with current OR unstable and plotting the flight:

Note that it doesn't report the rocket as tumbling until apogee, even though the fact that it's actually tumbling under thrust is causing the low apogee.
The warnings from that sim (they actually continued past the bottom of my screen):

Now same rocket, same sim, this PR:
