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,