Limit initial step size in AdaptativeStepSizeIntegrator?

Dear Hiiparchus developers,

Recently there has been two issues raised by Orekit users that were linked with the automatic initial step size computation in AdaptiveStepsizeIntegrator.initializeStep#246.

These two issues were both raised by the fact that the initial step size h computed was far too great compared to the underlying physical problem:

  1. Orekit issue 628: Here h ~ 16000s (a bit less than 3 orbits), and with da/dt < 0, this lead to an altitude of the orbit below 100km and caused an exception in the drag model;
  2. Orekit forum thread. Here once again h ~ 16000s and with de/dt <0 this lead to a negative eccentricity and caused an exception in the Keplerian orbit model.

In both cases the solution was to use the method setInitialStepSize; but it was not very straight forward for the users since the Orekit error is not explicit.

I don’t know if there is an issue in the computation of h, the equation is quite complex and involves the initial state, its derivatives and the tolerances of the integrator.

However, since there is a “maximum step size” (maxStep) attribute in the AdaptativeStepSizeIntegrator class, I wonder if we could not cap the value of h to maxStep in case the computation somehow goes wrong.

Something really simple like adding, after line 270:

if (h > maxStep) {
   h = maxStep

What do you think? Is there a reason why it should not be done?


+1 for limiting the initial step size to the maximum step size.

+1 Do you want to contribute it @MaximeJ ?