-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem when using non-integer step sizes in runge_kutta_fixed_step_size #209
Comments
Hi Lluc, Thanks for posting, and reminding me of this. But, it should still be addressed in the underlying code. First, to answer your few questions:
Could you share a link to a repo with the code that generates your results? That will be helpful to debugging it, Dominic |
Hi Dominic, Thanks for your reply. If you believe the bug is in my code, please do not spend your time on it. In my view, however, I don't understand how the cause can be anywhere else than in the Tudat implementation of the integrator. Here's what I think: The case I reported last year (assignment 3, not 1 as I mistakenly stated) was based on the comparison of a numerically propagated Keplerian orbit with respect to its corresponding analytical solution. What I came across this time, in contrast, is based on a numerical convergence analysis using perturbed dynamics, in which each error value is obtained from the difference between the trajectory propagated with the corresponding time step and the trajectory propagated with a timestep twice as small. In other words, these are two completely different strategies that suggest that something is going on when the step sizes used have several decimal figures, and the only thing the two strategies have in common is the usage of the runge_kutta_fixed_step_size function. Code for the Ganymede plot: file "integrator_analysis_Q1e" in https://github.com/lrbusquets/NumericalAstro_2023_lrbusquets/tree/main/Assignment3 My first thought was that this could be reasonably explained if there were an inconsistency in the float precision used in the C++ scripts that conduct the integration. For instance, if the evaluation of each state If this were the case, I could imagine that variable step size integrators do not show any misbehaviour because the C++ function that determines the next step size to be used stores it as a float variable in the first place. But I know I should look at the scripts instead of speculating. I might do some more tests to check whether or not this explanation is supported and I will post here in case I find anything new. Of course I might well be absolutely wrong, so don't hesitate to mention any other possible explanation you have or if you want me tro do any test in particular. |
One year ago, working on question 1e of the Numerical Astrodynamics assignment 1, I reported the following issue in the course forum: when I used runge_kutta_fixed_step_size for different step sizes from an np. logspace array, I obtained an error figure that looked like this
whereas when I intriduced an np.round() to my step size array it turned to the expected
Although there seems to be no theoretical reason that prevents a Runge-Kutta integrator to work well with arbitrary step sizes, it looked as if some bug introduced significant extra error if a non-integer step was used. Dominic asked me to open an issue here, but it eventually went out of my mind I never did it.
Now, working on my MSc thesis, I encountered the same issue again. When doing a convergence plot just as we did in our first PnO assignment, I found that in order to fix it from this
to this
I just needed to apply an np.round() to the step size array I was working with. Note the scale of the vertical axis: in the former the errors are increased by a factor of several thousands from the nominal rounding error regime.
I think this might be a relevant issue for several reasons:
The text was updated successfully, but these errors were encountered: