Discrepancies states inside and outside Event Detector

Dear all,

Currently working on an FD application, I need to exit a propagation to conduct a series of manipulation (but without modifying the state) before pursuing with the propagation. In that context, I noticed a strange behavior that lead me to do some testing on event detectors. Propagating with same conditions and same event detector leads to different result after some time if one exits at event detection and loop on propagation or not.

(I know using propagation in a loop instead of using event handlers is not great in terms of numerical accuracy or computational efficiency and that I could possibly find a workaround, I am looking into this. But I would still like to understand the issue I am currently facing.)

In more details, here is what I found out so far, trying the debug my issue:

I propagate forward with a Node Detector. If I print the state once at event detection, it gives me the state at the node, with a z-value very close to zero but negative. If I then stop the propagation and print the state outside of the propagation, I obtain a very similar state but with a very small positive z value. I assume that what is done is a short propagation from right before the node to right after. Or maybe it is simply reaching the step boundary. Or more probably, it is interpolating.

Interesting fact is that if one would set the propagator for a new propagation with the state value that is slightly before the node (with a negative z-value), the propagator would directly stop instead of going to the next node. Therefore, I have the feeling this odd behavior is an intended feature, but I still do not see how I could avoid having errors that build up with time.

I assume that some of the error I see over time could be due to a difference in step value between the handler and the integrator itself or that my problems come from numerical discrepancies as explain in this thread (Orbit propagation - modified initial orbit?).

Nevertheless, the result is that if I exit or not the propagation, it leads to different results and those errors build up with time…

Is the interpolation happening within the step detector inducing some error? Or is it simply the different in steps (influenced by tolerances) which impact my results on the long run?

I hope my explanations are clear and I would appreciate any help in finding out what I am obviously missing,

Thank you,

Mehdi Scoubeau

Hi Mehdi,

There are a couple of different effects. First most states you get from a Propagator are interpolated, including the one it returns at the end of propagation when stopped with an event detector and the state passed to the eventOccurred() method. Restarting from an interpolated state would create an entirely new trajectory that would drift away from the original one over long periods of time. You can avoid unnecessary restarts by using Action.CONTINUE in your event detectors. OrekitStepHandler has methods that let you determine which states are interpolated and which are not.

Also every time the state for a Propagator is reset some transformations may be performed which can introduce a few ulps of error, or more. E.g. converting element sets.

As you noticed events may occur within a given tolerance of the zero. This is exploited to enable your use case where the user stops on an event and then restarts from the returned state expecting to find the next event. So when the event’s action is STOP a little extra effort is made to ensure the returned state is on the far side of the event, but still within the specified tolerance.