Propagator mean_motion hangs for some r, v vectors around Earth #475
Comments
While trying to answer #494, I discovered that most orbits coming from the Lambert problem in my particular case were difficult to propagate, because they were almost parabolic. Adding a
So there's some sort of discontinuity or instability that should be investigated. Moreover, the Here I'm plotting the difference between Code to generate:
This code is quite slow to run, because the JIT has to be disabled (otherwise the propagator just hangs) and it turns out that catching the exception is slow too. With more time, a plot with better resolution could be generated. Also, it would be interesting to study the influence of `delta`.
import numpy as np
from poliastro.core.angles import M_to_nu as M_to_nu_fast, nu_to_M as nu_to_M_fast
np.seterr(all="raise")
N = 501
eccs = np.linspace(0.985, 1, num=N)
nus = np.linspace(0, 6, num=N)
delta = 1e-2
res = np.zeros((N, N))
for ii, ecc in enumerate(eccs):
for jj, nu in enumerate(nus):
try:
nu_final = M_to_nu_fast(nu_to_M_fast(nu, ecc, delta), ecc, delta)
except FloatingPointError:
nu_final = 20 # This signals that something wrong happened
res[jj, ii] = abs(nu - nu_final)
res[res == 0.0] = np.nan # To have a white pixel in the plot
res[res == 2 * np.pi] = np.nan # To have a white pixel in the plot |
I am going to start working on this. Those extreme cases where numerical methods struggle to obtain the most accurate result are really interesting. Hope #577 be ready for today. |
Some days ago I found in Battin 1999 an algorithm developed by Gauss that is said to work really well for this extreme eccentricity conditions. After found a paper where the algorithm is explained, coefficients are detailed and it even includes some test at the end. I will study more in depth this: https://iopscience.iop.org/article/10.1086/128750/pdf |
After successfully implementing on my local machine Gauss algorithm for near parabolic orbits, problem with extreme eccentricities was solved. Algorithm converged really fast, even for orbits with A test using |
Our hero! 😍 Looking forward to that PR!
…On Sun, 24 Mar 2019, 11:51 Jorge Martinez, ***@***.***> wrote:
After successfully implementing on my local machine Gauss algorithm for
near parabolic orbits, problem with extreme eccentricities was solved.
Algorithm converged really fast, even for orbits with ecc=0.9999 and no
hangout of Jupyter kernel was received.
A test using Battin 1999 example was done in order to check that the
algorithm was working properly. However, when applying it to #474
<#474>, I obtain an error
related with a negative quantity inside an sqrt in the algorithm. Still
working on this... 🚀
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATUZUjVRpgGcGvPrs8jyGFr2h4t3RkBks5vZ1ifgaJpZM4XzZJq>
.
|
Now the question is: what propagator among the new ones introduced in #718 work best for this kind of orbits? |
I think #907 is another case of this. |
The more I think about this, the more I'm convinced that there's some error in our implementation of the near-parabolic solution of (Farnocchia, 2013). I know @jorgepiloto started an effort to add a new propagator at #631 that stalled, but we should really invest some time to understand what's going on here. Unfortunately Mr. Farnocchia did not answer to email when we asked him some questions a couple of years ago, and I doubt there's a chance to get their benchmark data. |
I think I found it: #908 😱 |
Comes from #474, by @TimothySHamilton
The problem can be better seen by disabling Numba JIT, which shows some NumPy floating point warnings, and then turning them into errors:
And then,
mean_motion
fails for true anomalies very close to pi in the near parabolic case:This deserves closer inspection. @nikita-astronaut was the original author that read the corresponding paper, but I don't think he will have the time to answer. Perhaps one solution would be to use the elliptic solution when the true anomaly is close to pi even if the eccentricity is close to one:
poliastro/src/poliastro/core/angles.py
Lines 176 to 186 in 1f12764
We should also find out if we could prevent at least the hangs by compiling some functions with
error_model="python"
, as advised in numba/numba#1256 (comment).The text was updated successfully, but these errors were encountered: