I've been building a solar system integrator using C++, OpenGL for graphics, Qt for UI and I would like some info about the choice of integrator. The project is at a pretty advanced stage now and I'm currently adding all moons since graphically it's doing well, I can move about the whole system freely and I've got several integrators available to use mid-simulation (as well as the option to add in bodies during the simulation and control over time steps etc). The purpose of this project is still sort of undecided. I want it to run in real time, have decent graphics, have the ability to move throughout the solar system and be able to add bodies when you like. I'm not trying to get a perfect simulator but would like it be as accurate as possible while maintaining the above conditions (obviously violated by the add body feature but besides that). All of this (except the graphics aren't great yet) is currently done but as I want to ask some questions before I advance things any further.(adsbygoogle = window.adsbygoogle || []).push({});

I am currently using an Adams-Bashforth stage 5 integrator although I can also use stage 3 and 4 Adams (easily extendable to higher orders), Runge-Kutta, Euler integrators and have a decent framework set up so that I can add more pretty easily. This is fine and the results are really good but adding moons makes things slightly more awkward in that step sizes have to decrease a bit for the orbits to be anywhere near accurate for a decent length of time. I use data from the NASA HORIZONS site btw.

So, question time.

I was wondering if there are any integrators (surely must be) that are built for this sort of problem and use keplers laws as a basis and adds perturbations? It would have to deal with the effects of extra planets that I randomly throw in so a pure keplerian integrator wouldn't do it as it wouldn't take into account any other body, just the one it orbits.

The way I currently set the integration up is to calculate gravitational effects using the centre of mass of planet-moon system and only use the effect from individual moons when an object is within the planets hill sphere. Does this seem like a decent idea and will it be accurate enough for short term (<1000 year) simulations? I figure

I currently have scaled units such that 1 unit of time is a day, 1 unit of distance is 1AU and 1 unit of mass is the mass of the earth. Does this seem reasonable or will it become problematic with precision when including smaller moons (since also radius of moons are scaled by 1AU, they can get pretty small). Would perhaps using mercury mass and semi major as base units help this or not? Quite difficult to find a balance between scale when dealing with 100km moons and billion kilometer semi major axis.

Again, I don't exactly have clear defined goals yet. It's sort of an exercise in integration, programming, graphics and that sort of thing. I do have a certain idea I want to implement but that would be after everything else is done... I suppose I would be working towards something like Universe Sandbox (although I can't get it to run on my laptop, I've seen images of it and looks very interesting). I think that uses Euler integration though with tiny time steps and as I'm very much interested in numerical integration I'd prefer to use this as a chance to implement several different ones. I've also got a symplectic Runge Kutta written up somewhere but I imagine it would drop the frame rate too much if used...

Thanks in advance for any info or advice.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Looking for advice on solar system integrator

**Physics Forums | Science Articles, Homework Help, Discussion**