Planetary Orbits: Force needed for circular orbit

Click For Summary

Discussion Overview

The discussion revolves around the challenges of simulating planetary orbits in a software environment, specifically addressing the calculation of the necessary force and initial angular velocity for an orbital body to maintain a circular orbit. Participants explore the relationship between gravitational force, mass, and velocity in the context of their simulation code.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes their initial approach to calculating the force needed for a circular orbit, noting that the formula works only for a specific mass of the orbiting body.
  • Another participant suggests simplifying the formula by removing an unnecessary mass term, proposing the use of the equation for orbital velocity, $$v=\sqrt{\frac{GM}{r}}$$, which does not depend on the mass of the orbiting body.
  • A later reply confirms that the suggested formula worked, but the participant had to multiply the result by 50 to achieve the desired effect in their simulation software.
  • There is a discussion about the implications of this multiplication factor, with one participant questioning the necessity of the factor and another explaining that it relates to how force is applied in the simulation environment.
  • Confusion arises regarding the distinction between force and velocity, with one participant acknowledging their misunderstanding and clarifying that they were adding force instead of setting velocity directly.
  • Participants discuss the built-in physics of the simulation software and how it affects the calculations, with one expressing a desire to understand the relationship between force, mass, and velocity in the context of the software.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of the multiplication factor and the distinction between force and velocity. While some agree on the effectiveness of the proposed formula, the discussion remains unresolved regarding the underlying mechanics of the simulation software and the reasons for the factor of 50.

Contextual Notes

Participants mention limitations in their understanding of how force interacts with mass in the simulation engine, indicating a potential gap in knowledge regarding the physics engine's implementation.

Who May Find This Useful

This discussion may be useful for individuals interested in programming simulations of celestial mechanics, particularly those using Unity or similar game development platforms, as well as those exploring the mathematical foundations of orbital dynamics.

maltmana
Messages
5
Reaction score
3
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
 
  • Like
Likes   Reactions: RusdiMustafa
Physics news on Phys.org
maltmana said:
AngularForceVectorAdded = PerpindicularToDirectionOfCentralBody * (SQRT(centralbodymass * orbitingbodymass * gravConstant) / planetObjectDistance))

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.
 
  • Like
Likes   Reactions: maltmana
Drakkith said:
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.

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.
 
  • Like
Likes   Reactions: RusdiMustafa
maltmana said:
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

Hmm... what happens if you don't multiply it by 50? Does the planet go flying off into space?
 
  • Like
Likes   Reactions: RusdiMustafa
Drakkith said:
Hmm... what happens if you don't multiply it by 50? Does the planet go flying off into space?

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.
 
  • Like
Likes   Reactions: RusdiMustafa
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?
 
  • Like
Likes   Reactions: RusdiMustafa
Drakkith said:
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?

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.
 
Okay. Well, try setting the velocity and see if your simulation works.

maltmana said:
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.

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?
 
Drakkith said:
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?

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.
 
  • #10
maltmana said:
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).

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?
 
  • Like
Likes   Reactions: RusdiMustafa

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
907
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 84 ·
3
Replies
84
Views
7K