Recently, I've implemented and compared a number of basic integrators for my physics engine. The 3 that gave me the best results are RK4, Symplectic Euler, and Verlet Velocity, but I think I need something a little more advanced. I've done many Google and StackExchange searches but haven't found what I'm looking for.
I'm looking for something that combines the strengths of those integrators without their weaknesses. I'm only concerned about orbital mechanics. Drag and other similar forces will not be put through the integrator because it's not important that I get perfect answers for those other forces, but (near) perfect answers are very important for my orbital mechanics. Computationally expensive algorithms (within reason) are not as much of a concern as accuracy is.
My thoughts and primary concerns are as follows:
- RK4 Pros: Very accurate.
- RK4 Cons: Loses energy over the long term. This sim needs to be able to run for a VERY long time, so experiencing this kind of "orbital decay" is quite undesirable.
- Symplectic Euler and Verlet Velocity Pros: Symplectic/Don't lose energy.
- Symplectic Euler and Verlet Velocity Cons: Much less accurate. Highly eccentric orbits make this apparent very quickly...even with a simple massless-satellite-orbiting-a-massive-object scenario, the satellite's orbit "rotates" around the parent object over longer periods of time. This is extremely undesirable behavior.
For my purposes, I cannot resort to orbits "on rails".
TLDR: I am looking for an algorithm that gives me the accuracy of RK4 without the slow decay. Computational expense is not a major concern.
Thanks in advance for the help!
Update 1: I found a similar question here: https://stackoverflow.com/questions/3680136/help-with-symplectic-integrators
There might be good answers in the accepted answer, but after several hours of study, I have only determined that they are very difficult to understand. I will keep studying the accepted answer's linked paper and source code and post an answer if I get results. However, I suspect that while the algorithm is not much more complicated than RK4, the symbology and style of the linked explanations/source code are making it very difficult for anyone without a heavy math/physics background to understand. Unfortunately, as a comment noted, the OP accepted that answer, but never came back and gave a clearer explanation himself. I'll leave this question open and keep studying myself. Hopefully, together we can come up with a clearer answer for future searchers!