Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Determining the dominant body in a basic planetary system simulation

  1. Nov 4, 2011 #1

    I have a question/doubt/general-lack-of-understanding here:

    I have a simulated solar system here, with simplified orbital mechanics. The main simplification is that at any one time, only one celestial body exerts gravitational forces on the spaceship.

    So, my problem is: What would be the most correct way to determine when to switch dominant bodies?

    Currently, what I'm doing is running through all of them, and calculating the gravity acceleration vector for each body, based on the inverse-square relation of G force magnitude and distance.
    Then, I apply the greatest force I've found, and set the body from which it came as the dominant one.

    I thought this would be a good approximation, but it seems this method doesn't quite match the calculations of the body's own sphere of influence, or it's hill sphere, or any obvious multiple or fraction of those radii...

    So I decided it's about time I asked for help on this. ;)

    The way I see it, I either need to figure out a better rule for determining the dominant body, or find a way to correctly calculate the point of the switchover.

    Also, I have in this same simulation an osculating orbit solver, that is used to predict (and also propagate) the orbits of all objects in the system. Now that I started thinking about this, I've seen closed orbits that lead to outside the sphere of influence of the central body... Is that correct? Shouldn't any orbit that has a higher Apoapsis than the sphere of influence be hyperbolic or parabolic? Or are those concepts unrelated?

    So, any help at this point will be greatly appreciated.

    As always, thanks in advance!

  2. jcsd
  3. Nov 4, 2011 #2

    Filip Larsen

    User Avatar
    Gold Member

    If you are simulating motion by direct numerical integration of the equations of motion then you should sum up gravitational force from all the bodies and not just use the greatest one. Using spheres of influence is mostly common if you are doing patched conics, that is if you use Kepler's equations (i.e. conical sections) to model the motion about the celestial body that contains the spaceship in its sphere of influence and then "patch" it into a different orbit around another primary when the sphere of influence change.
  4. Nov 4, 2011 #3
    I'm not using direct numerical integration here... well, not all the time.

    On high time-compression rates, I disable the numerical integration, and put everything into a propagated orbit. That keeps things stable and predictable, which is more important than accuracy here.

    That's why I need to restrict the integrated part of the simulation to the same rules as the 2-body orbital propagation. It's preferable to have them approximated but with matching rules, than to use a full integration that won't match the on-rails orbits.

    So, I take it I should use the sphere of influence as the threshold for dominant body selection then?

  5. Nov 4, 2011 #4

    Filip Larsen

    User Avatar
    Gold Member

    In short, yes. You may want to search your references for the "method of patched conics" if you are not already familiar with that concept. It seems there are at least two textbooks on Scribd that makes a decent explanation of the method.
  6. Nov 5, 2011 #5
    Hi again.

    Just wanted to follow up. I changed the dominant body detection method to a recursive sphere of influence detection scheme here, and it works ok.

    However, the problems I was having with reference frame oscillation (the ship would go in and out of a moon's orbit, for instance, and sometimes would get stuck at the threshold), still persisted.

    After checking and re-checking the entire code, I couldn't find anything that seemed wrong with it, so I decided to add a 5-second period where the ship is locked against changing reference frames again, just to see what exactly was going on at the moment of transition, and found that with this safeguard in place, there were no problems at all really.

    Well, I think this will do for now! :)

    Just one more question though... About spheres of influence and eccentricity... My (uneducated) assumption would be that whenever your Ap reaches the central body's SOI radius, it would become an escape trajectory with ecc >= 1. In practice, this isn't what I see... I see highly eccentric closed orbits that do lead far outside the sphere of influence radius.

    Is there something wrong with my math? Or is this normal?

    Again, many thanks for the help!!

  7. Nov 5, 2011 #6

    Filip Larsen

    User Avatar
    Gold Member

    This is not so. For instance, if a spacecraft in orbit around a planet has apoapsis just outside the SOI of that planet, the planet and the spacecraft, when outside the SOI, will still be experiencing more or less the same gravitational force from the distant Sun and thus the forces from the Sun more or less cancels out in the relative motion between the planet and the spacecraft.

    Spheres of influence are mostly useful when you have an object on a "sure" escape trajectory in or out of a planet, for instance like when you are planning an interplanetary trajectory. Using patched conics for general simulation in the situation you mention (i.e. when the spacecraft spends relative long periods of time in regions of space where the magnitude of gravitational forces from multiple bodies are comparable) is probably going to produce some pretty inaccurate results compared with a fully numerical integration.

    For satellites in Earth orbit one often applies corrections to the satellites orbital elements due to perturbative forces from the Sun, Moon and planets (in addition to those from the uneven Earth potential and atmospheric interaction). It may be that it is possible to do something similar for your orbits near the SOI boundary but I guess it will be difficult to establish the validity of such corrections unless you can find some specifically derived for usage on those orbits. And I'm willing to bet that such an approach will require far more theoretical work and difficult code implementation than a simple numerical trajectory integrator.
  8. Nov 5, 2011 #7

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Spheres of influence are helpful even if one is using numerical integration. One could use a Neptune-centered inertial frame to integrate a vehicle that is in orbit about the Earth's moon. That choice is far from optimal, but it can be done. (In fact, integrating a vehicle in orbit about the Earth's Moon from the perspective of a Neptune-centered inertial frame is one of my standard tests. I don't expect high accuracy, but I do expect that the integrator will gradually degrade rather than blow up.)

    The reason this choice is far from optimal is because the large distances and speeds that result from integrating in such a frame overwhelms the relatively small changes in position and velocity that result from orbiting the Moon. The same kinds of errors result to a lesser extent from using a barycentric frame, and even from using an Earth-centered inertial frame.

    The best frame for integrating a vehicle in orbit about the Moon is of course a Moon-centered inertial frame. So what to do with a vehicle that is on a translunar trajectory? The answer is to switch the integration frame from an Earth-centered to a Moon-centered frame at some point along the trajectory. Exactly where doesn't really matter so long as it is reasonably close to the Moon's sphere of influence with respect to the Earth.
  9. Nov 7, 2011 #8
    One problem with what you've got is then when you are approaching the point at which you'd switch (when, say, Jupiter is pulling an equal amount as Mars) you would be approaching a (simplified) zero sum. The limited pull of Mars as you go out further would be further diminished by the growing pull of Jupiter, which you don't account for. That will certainly mess some equations up.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook