Calculating an initial velocity for desired planetary orbit

Started by
11 comments, last by taby 16 years, 11 months ago
I know the solution is incredibly simple, but I'm frustrated with the problem and taking a number of breaks from it has produced no result. I apologize if this is a common question, but after a few searches I didn't find anything related. In short, I am designing a game that uses 'realistic' Newtonian physics on the planetary scale, but I cannot figure out a simple equation that will yield the initial velocity needed to produce a desired elliptical orbit about a given mass with a given semi-major axis. Though this much is not a necessity, it would be nice to have the function assume that the current position of the orbiting mass is the (and forgive me for forgetting the proper term) "closest point to the central mass" on the ellipse. Again that's not necessary, but useful. Edit: It is very important to note (and I can't believe I forgot this!) that the game is 2 dimensional! I have never studied anything beyond exceptionally simplified, rudimentary physics (and hated every moment of such blatant oversimplification of useful and eventually necessary information), and my research into the field, while productive in other ways, has left me baffled as to how to solve this. Just for anyone reading this to understand what I understand, I'm aware of the equations required for simplified gravitational effect. Newtons second law of F=ma and Attraction = (G*m1*m2)/r^2. I've already applied these, I'm just too annoyed with other issues to get my mind focused enough to write a function that will determine the aforementioned velocity for the aforementioned orbit. Thank you, reader, for taking the time to read this. And thank you again for anyone who responds.
Advertisement
For your reference, the closest point to the mass is the periapsis, the further point is the apoapsis. [Edit: Thanks to Sharlin for correct terminology].

Please don't be too hard on yourself for not mentioning that this is a simulation upon a 2D plane. The Schwarzschild solution in General Relativity also allows for this type of simulation setup, so you are doing no simplifications that aren't already done in most cases. If someone helping you didn't recognize that, it's not your fault.

Regardless of distance, if the transverse velocity v = 0, the planet would be drawn straight toward the Sun, which is equivalent to an orbit of eccentricity e = 1.

Oppositely, for a circular orbit of e = 0, the required transverse velocity is:

v = sqrt(G*M/r)

For any v less than given by this equation, the starting point becomes the apoapsis of an elliptical orbit. For v greater, the starting point becomes the periapsis of an elliptical orbit (but in the opposing direction).

I'm not sure if eccentricity is linear between v = 0 and v = sqrt(G*M/r), but maybe this is enough information to get you started on your own experiments?

For instance, the planet Mercury has a periapsis (perihelion) distance of 46001272e3 metres. The required orbit velocity for a circular orbit is:

v = sqrt(6.6742e-11*1.988435e30 / 46001272e3)
v = sqrt(13271212877e10 / 46001272e3)
v = sqrt(2884966502.013248)
v = 53711.884178 metres/second.

However, Mercury's periapsis velocity is observed to be 58980 m, which is greater than the circular orbit velocity, leading to an eccentric orbit.

[Edited by - taby on May 12, 2007 6:49:33 PM]
Okay, lets start with a circular orbit. Mass m is orbiting another mass M with a current velocity v. So the force that must be applied to m to keep it in the orbit is F = m * v^2 / r, where r is the radius of the orbit. This must match the force produced by gravity, which is F = G * m * M / r^2. So the radius of a circular orbit is r = G * M / v^2, so it only depends on the mass of the object its orbiting around and the speed in its orbit.

To create an elliptical orbit, just set r to another value than the one calculated above. Also have a look at this wiki page:
http://en.wikipedia.org/wiki/Kepler's_laws_of_planetary_motion
Thank you for the equations, but they're one's I've already seen and haven't been able to apply. Ironically a part of the aforementioned "research" was wikipedia, so I've seen the article mentioned, but thank you.

The trouble is that velocity has something of a double standard. For most calculations it's really what's defined as speed, but in programming I'd need the "real" definition of velocity, both speed and direction. I will admit that I'm probably missing something, and direction can be derived from velocity, but in all honesty I don't know how.

I do know, however, that given the same speed but different trajectory, the orbit will be totally different (traveling 180 degrees from the central mass will eventually result in a head on collision, 35 degrees will result in a sort of spiral - all assuming sufficient attraction).

So I'm still left wondering what the initial speed and direction must be to acquire the desired ellipse.

Thank you again for the informative responses.
Well, if you can assume the initial point is at the periapsis or the apoapsis, the velocity vector will by definition be perpendicular to the line between the two bodies.
Quote:Original post by Sharlin
Well, if you can assume the initial point is at the periapsis or the apoapsis, the velocity vector will by definition be perpendicular to the line between the two bodies.


Well said.

For Mercury, the simulation could be simplified by starting at aphelion. Because the orbiting body starts at the maximum distance, and it can only get closer to the gravitating body. Starting at perihelion does not have this limit, and makes things a little harder to work with.

One can make these types of simplifications because the observer's frame of reference is completely relative in both space (rotational alignment with XY complex plane), and time (starting point, rate of time).

For the Sun:
Position = <0, 0>
Velocity = <0, 0>

For Mercury:
Position = <0, 69817079e3>
Velocity = <-38860, 0>

When starting the simulation at aphelion, several key pieces of information are already available to us:
1) If v = <-sqrt(G*M/69817079e3), 0>, orbit e = 0.
2) If v = <-38860, 0>, orbit e = 0.20563069.
3) If v = <-0, 0>, orbit e = 1.

Note that sqrt(G*M/69817079e3) > 38860.

I have not yet tried to calculate the perihelion point and appropriate transverse velocity from this.

[Edited by - taby on May 12, 2007 8:38:32 PM]
Quote:Original post by taby
I have not yet tried to calculate the perihelion point and appropriate transverse velocity from this.


Another thing to note about the orbit of Mercury when starting at aphelion:
1) If v = <-sqrt(G*M/69817079e3), 0>, perihelion distance is 69817079e3 metres.
2) If v = <-38860, 0>, perihelion distance is 46001272e3 metres.
3) If v = <-0, 0>, perihelion distance is 0.

This re-enforces the notion that for an eccentric orbit, the transverse velocity at perihelion must be greater than sqrt(G*M/46001272e3).

For Mercury starting at perihelion:
Circular v = sqrt(G*M/46001272e3) = 53711.884178 m/s. Aphelion distance would be 46001272e3 metres.
Observed v = 58980 m/s. Aphelion distance is 69817079e3 metres.

Note that sqrt(G*M/46001272e3) < 58980.

The potential transverse velocity at perihelion is limited to c. At v = c, the semi-major axis is practically infinite in length. The orbit path is no longer elliptical, but hyperbolic, because the orbiting body is travelling directly away from the gravitating body.

Oppositely, when at aphelion, if v = 0 then e = 1, and the orbit path is a straight line. However, in this event, the orbiting body travels toward the gravitating body, not away from it. Keeping v < sqrt(G*M/69817079e3), the orbit path cannot form a larger-scale circle, parabola or hyperbola. It's ellipse or nothing, which makes things a little more simple if you're not planning on modelling photon deflection.

[Edited by - taby on May 12, 2007 8:02:24 PM]
wow, I just did a 15 minute presentation on a program I created for my HS physics class that used Newton's laws.

Here is the full source code:

www.sirisian.templarian.com/PlanetSimulation.zip

As for the placement. I just took the smallest velocity the planet ever has then the farthest distance, the perihelion I believe. Since at the furthest point in orbit it's moving the slowest. This placed all of the planets at their furthest distance, but if you knew what angle and distance they were at any time you could step up the simulation for every planet and place it there. Fairly easy, but I only worked on mine for two days.

I have no time model, so the planets in my simulation just went at some random simulation speed.

(on a side note the mouse in my program controlled an orbiting object that accelerated toward the mouse).

wikipedia has all of the velocities for the planets, min, avg, and max.
How to obtain a perpendicular vector step one.

va dot vb = 0
(a,b) dot (c,d) = 0
a*c + b*d = 0
c = -a
d = b

or

c = a
d = -b

How to get a correct size

n(vb)*magnitde = desired vector.

I asume you know how to create normal.

BTW the really difficult thing is create optimal transfer when you have continuous trust acceleration, smaller than acceleration of gravity field.

And yes one more thing, it's completely irrelevant if you are doing it in 2D, or 3D the equations are the same.
http://www.bridgewater.edu/~rbowman/ISAW/KeplerCalc.html

The semi-major axis can be represented in metres by removing the two conversion to Astronomical Units coefficients from the author's equation.

ex:
1 m = 6.68458134e-12 AU
G*M m = 8.871e8 AU

The author's equation for periapsis velocity using AU:
v = sqrt([(G*M*6.68458134e-12)/(a*6.68458134e-12)]*(1 + e)/(1 - e)).

As simplified into metres:
v = sqrt((G*M/a)*(1 + e)/(1 - e)).

The planet Mercury's semi-major axis a = 57909176e3 metres, and has an orbit eccentricity e = 0.20563069:
v = sqrt((6.6742e-11 * 1.988435e30 / 57909176e3) * (1 + 0.20563069) / (1 - 0.20563069)),
v = 58976.3015.

That's very close to the maximum orbit speed of Mercury, as 58980 m/s on wikipedia.org.

Oppositely, for the apoapsis velocity:
v = sqrt((G*M/a)*(1 - e)/(1 + e)),
v = 38858.47.

Also very close to the minimum orbit speed of Mercury, as 38860 m/s on wikipedia.org.

Note that in the apoapsis equation I have swapped the + and - signs, instead of how the author swapped the * and / signs.

In the case where e = 0, the familiar circular orbit velocity equation reappears:
v = sqrt(G*M/r).

[Edited by - taby on May 13, 2007 3:29:22 PM]

This topic is closed to new replies.

Advertisement