 # Problem in Keplerian orbit : meanToHyperbolicEccentric

Using the Keplerian propagator with hyperbolic orbits, I have problems with the meanToHyperbolicEccentric convergence.

In some cases, it fails to converge after 50 iterations.
This happens when the input mean anomaly (M) is “large”. Internally the mean anomaly is increasing with time, without 2*pi modulo. After long propagation, M value is large and creates convergence problems with meanToHyperbolicEccentric method.

For instance, here is the result with to different M values which are the same modulo 2.pi
with e = 3.562633617924315
M = 47.132267384256465 => number of iterations =49 (close to the limit !)
M = -3.1332150731802244 => iter =3

Sometimes, the number of iterations exceeds 50 and an exception is thrown, which is very annoying!

See joined TestKeplerianPropagation.java (3.8 KB) test case

I realize now that in case of hyperbolic motion, the meaning of mean anomaly is not easy to understand. Basically, it is only a mathematical way to get the true anomaly from the time. Unlike elliptic motion, in case of hyperbola, the mean anomaly is not periodic (modulo 2pi). In other words, you get different values of Hyperbolic anomaly H for M and M+2k.pi, when you solve the Kepler equation e.sinH - H = M.
Anyway, the meanToHyperbolicEccentric convergence problem remains. The only workaround I have found is to catch the Exception and to replace the KeplerianPropagator by the equivalent NumericalPropagator with only the central attraction. I’m not very satisfied with that…Would you have a better solution ?

Hi Sebastien,

The problem is a bit difficult to solve. I have two possible solutions but they have both drawbacks.

1. Increase the maximum number of iterations before throwing the exception (i.e. from 50 to 100 for instance). Easy and fast implementation of the fix. Maybe the best solution for your problem but I don’t really like it because it looks like DIY.

2. Add a new signature for the `meanToHyperbolicEccentric` method with two new arguments: `threshold` and `maxIterations`. The current signature could call the new one with default values for these two parameters (i.e. 1.0e-12 and 50 for instance). This solution is very close to what has been already done for the DSST with the mean parameters computation (See issue #596). The main problem of this solution is that it imposes to also add a new constructor for the `KeplerianOrbit` class because the `meanToHyperbolicEccentric` is used to calculate the true anomaly in case of the user used a mean anomaly definition to initialize the object.

I’m curious to know the opinion of other Orekit users and developers. Maybe somebody will have a third solution.

Best regards,
Bryan

Thank you for your answer Bryan
The first solution is easy and can fix my immediate concern, but the problem is simply pushed forward (some cases will also probably fail with 100 iterations)
The second solution may help to tune the convergence threshold and number of iterations, but to my opinion, this kind of low level algorithms should not be handled by the final user.
The best way would be to find a more robust algorithm, I’m not a specialist…