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

I Planetary Orbits: Force needed for circular orbit

  1. Jun 21, 2017 #1
    Hi! first time poster here.

    I'm making an orbital simulation and I am having a problem with one minor detail.

    The gravity is working great, and I've programmed it using this formula:

    A force vector is applied = DirectionOfCentralBodyNormalized * ((GravConstant * centralbodymass * orbitalbodymass) / (distance^2)

    This works great and there are no problems here as far as I'm concerned.

    Now here is the problem:
    I want the orbital body to start off with enough angular velocity to orbit in a perfect circle. So I use this:

    AngularForceVectorAdded = PerpindicularToDirectionOfCentralBody * (SQRT(centralbodymass * orbitingbodymass * gravConstant) / planetObjectDistance))

    The problem is that this formula only works when I set the mass of the orbiting body to 0.0004. If I increase the mass of the orbiting body, not enough force is applied. If I decrease the mass, too much force is applied.

    I have also tried multiplying by the mass of the orbiting body, but this causes the inverse to occur: increasing mass causes too much force to be applied and decreasing mass causes too little to be applied.

    The orbit is nice and circular no matter where I place the orbiting object relative to the central body, but I really have no idea what I need to add to make this work for any amount of mass!!

    Thank you
     
  2. jcsd
  3. Jun 21, 2017 #2

    Drakkith

    User Avatar

    Staff: Mentor

    This looks almost like the formula for centripetal force solved for velocity. You just have an extra mass term that isn't needed. Try: $$v=\sqrt{\frac{GM}{r}}$$
    That should give you the velocity needed at any given radius. Note that the mass of the orbiting body doesn't matter, as it ends up getting divided out of the original formula.
     
  4. Jun 22, 2017 #3
    Hey Drakkith,

    What you gave me ended up working fantastically. I feel a bit silly for not realizing earlier that I was adding in the extra mass term. I was beginning to think the universe was wrong, but it turns out it was just my mistake!

    Strangely, I had to multiply the whole thing by 50 in order to get Unity (the software I'm using) to give enough force for circular orbit. I have no idea why I had to multiply by 50... But it is now working for all different masses of both central and orbital body and at all kinds of different distances, so I'm happy :D

    Here is the functioning code:

    forceAdded = -perpendicularOffset * 50 * GetComponent<Rigidbody2D>().mass * (Mathf.Sqrt(gConstant * centralBodyMass / planetObjectDistance));


    Thanks.
     
  5. Jun 22, 2017 #4

    Drakkith

    User Avatar

    Staff: Mentor

    Hmm... what happens if you don't multiply it by 50? Does the planet go flying off into space?
     
  6. Jun 22, 2017 #5
    No, the planet just falls into the sun because it needs 50 * the force. As far as I can tell everything is working realistically besides that.
     
  7. Jun 22, 2017 #6

    Drakkith

    User Avatar

    Staff: Mentor

    I'm sorry, I'm a bit confused. Are talking about a force applied to the object, or the velocity of the object? Planets in orbits do not experience any force except for the force of gravity. What other force are you referring to?
     
  8. Jun 22, 2017 #7
    I apologize. I just realize that I've been confusing force and velocity all along.

    In my simulation in Unity, I am adding force in order to create the initial velocity. I totally forgot this until you just mentioned it now!

    So to get a circular orbit, I have to multiply the √(GM/r) by 50 and by the mass of the orbiting planet. This is reflected in my code:
    forceAdded = 50 * orbitingBodyMass * (Mathf.Sqrt(gConstant * centralBodyMass / planetObjectDistance));

    You're probably not aware of this, but every post of yours has been a grand illumination for me. The reason I've been having so many problems all along is that I have been adding force to the planets instead of just setting their velocity! The original equation v=√GMr would have worked fine for me if I was doing it properly...

    So I am guessing that the reason I have to multiply by 50 and by the orbiting body mass has something to do with the way force works in unity... maybe it takes 50 units of force to move an object of 1 unit of mass by 1 unit of velocity or something like that.

    Thank you.
     
  9. Jun 22, 2017 #8

    Drakkith

    User Avatar

    Staff: Mentor

    Okay. Well, try setting the velocity and see if your simulation works.

    I don't know the details of how Unity works or how you're programming your simulation. Are you "manually" doing all the calculations, including the positions, velocities, and such of the objects, or are you using some kind of built-in physics code where you're only setting some initial conditions and then letting Unity do everything else for you?
     
  10. Jun 23, 2017 #9
    It works perfectly by setting the velocity thanks.

    Mass, force, velocity and all the basics are all built in. I didn't have to program the way force affects mass to create velocity from scratch and I don't know exactly how a "unit" of force affects a "unit" of mass in this engine (I should find out).

    I only programmed the planetary gravity using the built in mass and velocity functions. And now, with you're help, I've also programmed in an initial velocity for planets that gives them a nice circular orbit.

    My next step is to get a complete output of all the classical orbital elements, periapsis, apoapsis, and , eventually, I really want to have nice orbit lines drawn all over the screen with periapsis and apoapsis clearly marked out.

    My simulation is two dimensional, so it shouldn't be too difficult for me.
     
  11. Jun 23, 2017 #10

    Drakkith

    User Avatar

    Staff: Mentor

    Hmmm. Looking around it appears some other folks have had the same problem of the force needing to be 50x what it should be.

    What function calls are you using to apply the force?
    Are the function calls inside the Update() or FixedUpdate() function?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Planetary Orbits: Force needed for circular orbit
  1. Orbit of Cube planet (Replies: 18)

Loading...