Kerbal Space Program - Duna Flight Math

collinsmark

Homework Helper
Gold Member
2,849
1,167
The Sands of Duna

<Intermission (1/2)>

An intermission of math.

Skip this post (and the next) if you are not interested in the math. But since you are reading this on Physics Forums after all, there's a good chance you are interested. If so, read on. :smile:

Collinsmark is not affiliated with Squad nor Kerbal Space Program.

Here is the justification to some claims I've made in the last few posts, and the derivation to a couple equations.

It's a straightforward calculation to find the velocity of an object in a circular orbit around a much larger object. We simply set the acceleration of gravity equal to the centripetal acceleration.

[tex] \underbrace{\frac{v^2}{r}}_{\mathrm{centripetal}} = \underbrace{\frac{GM}{r^2}}_{\mathrm{gravitational}} [/tex]

Solving for [itex] v [/itex] gives us

[tex] v = \sqrt{\frac{GM}{r}} .[/tex]

By the way, when we assume that the smaller body, say our ship, is in orbit around a much larger body, like a moon or planet (or even the Sun), like we are doing here, it is called a restricted two-body problem. The assumption that the larger body is much, much more massive than the smaller is what makes it "restricted." So when you hear of a restricted two-body, restricted three-body, or restricted n-body problem, it means the mass of the ship is small compared to the mass of the other bodies being considered, and its effect on the motion of the larger body (or bodies) can be neglected.

We can also find the potential energy, U, of our ship when it is at some height above when orbiting a moon or planet. It is assumed that the potential energy, U, is zero when the ship is far, far away from the body. As the ship approaches the body, U, decreases, meaning it becomes more negative.

We can find this potential energy by integrating the force from its initial orbital height, up to infinity. In other words, we calculate the work required to slowly lift the ship from its present orbital height up to infinity.

[tex] W = \int \vec {F(r)} \cdot d \vec r [/tex]

Note that in our case, we are slowly moving the ship toward infinity, although the force is pointing in the opposite direction. That's where the negative sign comes from.

[tex] U = -\int_r^{\infty}G \frac{Mm}{{r'}^2} dr' [/tex]

Evaluating the integral gives us

[tex] U = - G \frac{Mm}{r} .[/tex]

The kinetic energy is the good 'ol [itex] T = \frac{1}{2}mv^2 [/itex], once we've chosen a suitable frame of reference. For the rest of this post, it's assumed that our frame of reference is that of the planet or moon the ship is orbiting, unless otherwise stated.

So the total energy of the ship is the ship's kinetic plus potential energy.

[tex] E = T + U = \frac{1}{2}mv^2 - G \frac{Mm}{r^2} [/tex]

It is often convenient to normalize this to energy per unit mass of the ship, by dividing by m. (This is particularly useful for those intervals of time when the ship is not burning any fuel and thus its mass remains constant.) That gives us

[tex] \epsilon = \frac{1}{2}v^2 - \frac{GM}{r},[/tex]

which brings us to our derivation of the standard escape equation in Figure 103.

KSP_458.jpg

[Figure 103: Standard escape equation]

We know that eventually, when the ship is far away from the moon/planet, and traveling at its final, free-space velocity, [itex] v_{fs} [/itex] that its potential energy has dropped to zero. So in the end, the ship's total energy is all kinetic energy. Its initial (normalized) potential energy is simply [itex] -\frac{GM}{r_{or}} [/itex]. But what we don't know yet is its initial kinetic energy immediately after the burn. We know that before the burn, its orbital velocity is [itex] v_{or} [/itex]. Immediately after the burn, its velocity is [itex] v_{or} + \Delta v[/itex].

So we apply conservation of energy. We know that the ship's total energy is the same immediately after the burn as it is when the ship eventually reaches its final speed, [itex] v_{fs} [/itex].

[tex] \frac{1}{2} v_{fs}^2 = \frac{1}{2} \left( v_{or} + \Delta v \right)^2 - \frac{GM}{r_{or}} [/tex]

Substituting [itex] v_{or}^2 [/itex] in for [itex] \frac{GM}{r_{or}} [/itex] gives

[tex] \frac{1}{2} v_{fs}^2 = \frac{1}{2} \left( v_{or} + \Delta v \right)^2 - v_{or}^2. [/tex]

Multiplying by 2 and rearranging produces

[tex] \left( v_{or} + \Delta v \right)^2 = v_{fs}^2 + 2 v_{or}^2. [/tex]

And with a touch more algebra we find,

[tex] \Delta v = \sqrt{v_{fs}^2 + 2 v_{or}^2} - v_{or} [/tex]

which is the standard escape equation.

Note that when we take the derivative of [itex] \Delta v [/itex] with respect to [itex] v_{or} [/itex] and set that equal to zero, we find a minimum at [itex] v_{or} = \frac{v_{fs}}{\sqrt{2}} [/itex]. Plugging those back into our equation, we find that that minimum is [itex] \Delta v_{min} = v_{or} = \frac{v_{fs}}{\sqrt{2}} [/itex].

What that implies is that there is an optimal, orbital height for your ship to escape, if you are using the standard escape strategy (a single burn to escape). Assuming that you already know your final escape speed, the optimal orbital radius (for a circular orbit, and one you plan to use a standard escape with) is

[tex] r_{optimal} = 2 \frac{GM}{v_{fs}^2} [/tex]

Of course, KSP doesn't display orbital height in terms of radius to the center of the planet/moon. Rather it displays it as height above sea-level. So if you want to go by the height that KSP displays, you need to take the radius of planet/moon into account. Doing that gives

[tex] h_{optimal} = 2 \frac{GM}{v_{fs}^2} - r_{planet}[/tex]

where [itex] r_{planet} [/itex] is the radius of the moon/planet.

For every given planet or moon, you can find its radius and its standard gravitational parameter GM on the KSP wiki: http://wiki.kerbalspaceprogram.com/wiki/Main_Page.

You know that you have it right if you create a maneuver node in your present, circular orbit, for your desired destination, and the Δv displayed on the maneuver node equals (or nearly equals) your present orbital speed.

But what if you don't yet know your desired [itex] v_{fs} [/itex]? That's okay, you can calculate it. Create a maneuver node to your desired destination and jot down the Δv and your present orbital speed, [itex] v_{or} [/itex]. Then solve,

[tex] v_{fs} = \sqrt{ \left( v_{or} + \Delta v \right)^2 - 2 v_{or}^2} [/tex]

There's some serious implications to all of this. I've heard it said that "Minmus makes a great place to put a refueling station because it is near the edge of Kerbin's SOI, making it easier to escape." Ahh! No! That makes it a horrible place to put a refueling station, if you plan to escape the Kerbin system using the standard escape strategy.* With a standard escape, you'll use less fuel escaping if you start from a lower orbit.

*(There is one exception to this: asteroids. Asteroids travel in nearly the same orbit as Kerbin, so the ship's [itex] v_{fs} [/itex] is almost zero, with respect to Kerbin. So yes, a Minimus output would work quite well for asteroid redirect missions. But that's about it, if you limit yourself to standard escapes. On the other hand, if you want to use the fancy-shmancy escape, Minmus has advantages because it is so high above Kerbin. More on that in the next post.)

And, when using the standard escape, the ideal orbital height is closer to Kerbin, the farther the destination is, orbital wise. Putting it another way, the greater [itex] v_{fs} [/itex], the optimal orbital height is lower, all else the same (assuming standard escape).

If you work out the math, you'll find that the Mun would make a great place for a refueling station for the purpose of going to Duna, using a Hohmann transfer to Duna (Minmus is way to high for a standard escape to Duna). For planets that are farther way than Duna, even the Mun is too high for an optimal, Direct escape. So for planets beyond Duna, either put your refueling stations in a lower Kerbin orbit, or be prepared to do the fancy-shmancy via Kerbin, on the way out of the system.

The things to take home with you regarding the standard escape are:
  • There is an optimal, orbital height for entering and leaving a system for a given [itex] v_{fs} [/itex], when using the standard arrival or standard escape (single burn). This is great place to park massive service modules and massive refueling stations. Parking massive service modules/refueling stations in other orbital heights, either higher or lower, will require the ships to burn more fuel on arriving and escaping, assuming the standard arrival or standard escape (single burn).
  • This optimal height is dependent on the destination. More correctly, it is dependent on the [itex] v_{fs} [/itex] needed when escaping the system. (Assuming that the same type of orbit is used on arriving, the arrival [itex] v_{fs} [/itex] should be the same as the escape [itex] v_{fs} [/itex], btw.) And of course it is also dependent on the standard gravitational parameter, GM, of the moon/planet you are orbiting.
  • All that said, there is the potential to save even more fuel by parking in yet higher orbits, if you use the fancy-shmancy arrival/escape, which we'll talk about in the second half of the intermission.

[Edit: By the way, for the record, I am not a big fan of having refueling stations around Kerbin. They will invariably require more fuel used, overall, if you take into account the cost of getting the stations into orbit in the first place, and all the fuel needed to put the remaining fuel in orbit. That said, refueling stations can have tremendous advantages around systems with multiple moons like Jul. And if you ever attempt to take off from Eve (a large, gravitationally strong planet), you'll definitely want some fuel waiting in orbit. I know that many KSP players are fans of single-ship (or single-stage) to orbit (SSTO) crafts, and while I've never been a big fan of SSTOs, refueling stations can also be good for those.]
 
Last edited:

collinsmark

Homework Helper
Gold Member
2,849
1,167
The Sands of Duna

<Intermission (2/2)>

Skip this post if you are not interested in the math (there's also a touch of history in this one). But since you are reading this on Physics Forums, there's a good chance you are interested. If so, read on.

First, some history

Below is Isaac Newton's vis viva equation (It's alive! :eek:):

[tex] v^2 = GM \left( \frac{2}{r} - \frac{1}{a} \right) [/tex]

where,
[itex] r [/itex] is the distance from the smaller, orbiting body to the larger body,​
[itex] a [/itex] is the semi-major axis of the ellipse traced out by the smaller, orbiting body.​
[itex] GM [/itex] is the standard gravitational parameter of the larger body (which is Newton's, gravitational constant times the mass of the larger body).​
and [itex] v [/itex] is the velocity of the smaller body at the given position of it's orbit (its speed for a given value of [itex] r [/itex]).​

From a historical point of view, the relationship embodied in his vis viva equation changed the world forever after, at least indirectly if not more.

You might not be familiar with this equation, and perhaps have never even heard of it. It's not the equation for which Newton is best known. But from a historical point of view Newton's vis viva relationship is paramount to a revolutionary change. The vis viva relationship is the first to show how a force could cause a moon/planet to orbit in a ellipse. But historically, it was involved in much more.

It was on an August day in 1684 when Edmond Halley (eventually of Halley's comet fame), paid a call on a young Issac Newton. Halley and Newton had already met some years before. Newton had made a small name for himself by his studies with light and inventing the reflecting telescope. The purpose of Halley's visit this time was to inquire if Newton had made progress with the problem of how a gravitational force might cause an orbiting body to move in an ellipse around it.

Both Newton and Halley knew that planets move in ellipses. This had been known for more than a half century by the work of Johannes Kepler's Astronomia nova. When traveling to visit Newton, Halley might have even suspected that the gravitational force obeys the inverse square law (although that's difficult to say for sure). Inverse square law or not, Halley himself failed to show how a force (of whatever sort) would cause a planet to move around the Sun in an ellipse. Hence the reason for calling on Newton.

So when Halley arrived in Cambridge that day in 1648, he asked Newton about it. Newton said that he had already solved it, and that the result was laying around in his notes somewhere. Newton couldn't find the relationship in his notes, but said he'd forward them on when he found them.

In November of that year, Newton did forward the relationship and related material (either reproducing or re-deriving them) to Halley in De motu corporum in gyrum ("On the motion of bodies in an orbit"). Halley was impressed to say the least, and urged Newton to create a more detailed version, assuring him it would be published by the Royal Society.

Isaac Newton followed Halley's advice and created the much more detailed Philosophiæ Naturalis Principia Mathematica. This work, I'm sure you've heard of. It contains Newton's laws of motion, his universial law of gravity (including the vis viva equation, along with the inverse square law and the rest), and is the very basis of Newtonian physics that we still use today.

The story doesn't simply end with the publication. The Royal Society was broke at the time, and did not have the money to publish Newton's masterpiece. Halley himself had to raise most of the publication expenses, much of them coming out of his own pocket. Apparently, the Royal Society even offered to compensate Halley in the form of unsold copies of fish books.

But it all started with Edmund Halley's short visit to Isaac Newton that one August day, looking for something along the lines of what we now call the vis viva equation.

I won't derive the vis viva equation here, since there is already a good derivation on the Wiki site: http://en.wikipedia.org/wiki/Vis-viva_equation. But that's a good place to start with our fancy shmancy-equation derivation.

The fancy-shmancy

KSP_459.jpg

[Figure 104: Fancy-shmancy escape equation]

It's a pretty straightforward derivation if we first derive the Δv of each burn individually, and invoke Newton's vis viva equation.

We know that the ship's velocity immediately after the first burn is [itex] v_{or} - \Delta v_1 [/itex]. Just after the first burn, the ship's path is elliptical, with the major axis equal to [itex] r_{or} + r_{lo} [/itex]. The ellipse's semi-major axis is half that, making [itex] a = \frac{r_{or} + r_{lo}}{2} [/itex]. Plugging those into the vis viva equation at apoapsis gives

[tex] \left(v_{or} - \Delta v_1 \right)^2 = GM \left( \frac{2}{r_{or}} - \frac{2}{r_{or} + r_{lo}} \right).[/tex]

Next we can make a few substitutions, to express the equation into their circular orbit velocities, instead of their radius counterparts, by noting,

[tex] r_{or} = \frac{GM}{v_{or}^2}, \ \ r_{lo} = \frac{GM}{v_{lo}^2}. [/tex]

Keep in mind that [itex] v_{or} [/itex] and [itex] v_{lo} [/itex] are not the velocities of the ship at apoapsis and periapsis of the ship, when this ship is in this elliptical orbit. Rather those represent the velocity the ship would have if the ship was orbiting at either of those radii, in a circular orbit. We're representing things in terms of those velocities since they are easy to calculate, and even easy to measure directly.

Making the substitutions,

[tex] \left(v_{or} - \Delta v_1 \right)^2 = GM \left( \frac{2 v_{or}^2}{GM} - \frac{1}{GM} \frac{2 v_{or}^2 v_{lo}^2}{v_{or}^2 + v_{lo}^2} \right)[/tex]

and simplifying

[tex] \left(v_{or} - \Delta v_1 \right)^2 = 2 v_{or}^2 - \frac{2 v_{or}^2 v_{lo}^2}{v_{or}^2 + v_{lo}^2} [/tex]

and more simplification on the right hand side,

[tex] \left(v_{or} - \Delta v_1 \right)^2 = \frac{2 v_{or}^2 \left( v_{or}^2 + v_{lo}^2 \right)}{v_{or}^2 + v_{lo}^2} - \frac{2 v_{or}^2 v_{lo}^2}{v_{or}^2 + v_{lo}^2} = \frac{2 v_{or}^4}{v_{or}^2 + v_{lo}^2}[/tex]

and taking the square root,

[tex] v_{or} - \Delta v_1 = \sqrt{\frac{2 v_{or}^4}{v_{or}^2 + v_{lo}^2}} = v_{or}^2 \sqrt{\frac{2 }{v_{or}^2 + v_{lo}^2}} [/tex]

thus

[tex] \Delta v_1 = v_{or} - v_{or}^2 \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}}. [/tex]

Keep that one handy. We'll come back to that.

But first, as an intermediate step, we need to find the ship's speed at periapsis. Let's call it [itex] v_{peri}. [/itex] And for that, the vis viva equation comes to the rescue again. The set up of the right hand side of the equation is the same as last time, except now [itex] r = r_{lo} [/itex] rather than [itex] r_{or} [/itex].

[tex] v_{peri}^2 = GM \left( \frac{2}{r_{lo}} - \frac{2}{r_{or} + r_{lo}} \right) [/tex]

Making the same substitutions as before, and the same sort of simplifications,

[tex] v_{peri} = v_{lo}^2 \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}}. [/tex]

Recall the orbital energy equation,

[tex] \epsilon = \frac{1}{2} v^2 - \frac{GM}{r}. [/tex]

We can invoke conservation of energy again here. The left hand side of the equation below is the energy when the ship is far, far away from the planet/moon, and the right hand side of the equation is immediately after the second burn.

[tex] \frac{1}{2}v_{fs}^2 = \frac{1}{2} \left( v_{peri} + \Delta v_2 \right)^2 - \frac{GM}{r_{lo}} [/tex]

Making our standard substitution,

[tex] \frac{1}{2}v_{fs}^2 = \frac{1}{2} \left( v_{peri} + \Delta v_2 \right)^2 - v_{lo}^2 [/tex]

Solving for [itex] \Delta v_2 [/itex] gives

[tex] \Delta v_2 = \sqrt{ v_{fs}^2 + 2 v_{lo}^2} - v_{peri} [/tex]

And finally making the [itex] v_{peri} [/itex] substitution from what we calculated earlier,

[tex] \Delta v_2 = \sqrt{ v_{fs}^2 + 2 v_{lo}^2} - v_{lo}^2 \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}}. [/tex]

Now we can combine our [itex] \Delta v_1 [/itex] and [itex] \Delta v_2 [/itex] to make our [itex] \Delta v_{total}. [/itex]

[tex] \Delta v_{total} = \Delta v_1 + \Delta v_2 [/tex]
[tex] = \sqrt{v_{fs}^2 + 2 v_{lo}^2} + v_{or} -v_{or}^2 \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}} -v_{lo}^2 \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}} [/tex]
[tex] = \sqrt{v_{fs}^2 + 2 v_{lo}^2} + v_{or} - \left( v_{or}^2 + v_{lo}^2 \right) \sqrt{\frac{2}{v_{or}^2 + v_{lo}^2}} [/tex]

And one last simplification yields,

[tex] \Delta v_{total} = \Delta v_1 + \Delta v_2 = \sqrt{v_{fs}^2 + 2 v_{lo}^2} + v_{or} - \sqrt{ 2 v_{or}^2 + 2 v_{lo}^2 }[/tex]

And remember, [itex] v_{lo} [/itex] can either be calculated using [itex] v_{lo} = \sqrt{\frac{GM}{r_{lo}}}[/itex], or directly measured. It's likely that at some point or another, you will have a ship in low, circular orbit around the planet/moon in question. Simply jot down its orbital velocity while it's in that low, circular orbit, and that's your [itex] v_{lo} [/itex] that you can use later, if you wish to do fancy-shmancy escape calculations.

A couple of final things:
  • Note that this equation does not have a local minimum. Instead, [itex] \Delta v_{total} [/itex] keeps getting smaller for higher orbits, eventually settling out at [itex] \sqrt{v_{fs}^2 + 2 v_{lo}^2} - \sqrt{2} \left(v_{lo} \right) [/itex], for extremely high orbits.
  • When [itex] v_{or} = \frac{v_{fs}}{\sqrt{2}}[/itex], the total [itex] \Delta v [/itex] is the same as the standard escape. So for orbits lower than this critical value, use the standard escape. For higher orbits, use this fancy-shmancy escape if you wish to save fuel.
And now back to our story. ...

Full Series
Part 1: Introduction and Basics
Part 2: Efficient Launch Into Orbit
Part 3: Rocket Design Basics
Part 4: Rocket Design and Orbital Mechanics
Part 5: Getting to the Mun
Part 6: Getting to the Mun P2
Part 7: Preparing to Land on the Mun
Part 8: Mun Touchdown
Part 9: Staying on the Mun
Part 10: Preparing to Leave the Lander
Part 11: Walking on the Mun
Part 12: Leaving the Mun
Part 13: Rendezvous and Docking
Part 14: Retrograde and Approach
Part 15: Preparing for Docking
Part 16: Docking and Lander Reunion
Part 17: Heading Home
Part 18: Entering Earth's Orbit
Part 19: Landing Back on Earth
Part 20: Launch for Duna
Part 21: Duna Probe Launch
Part 22: Duna Rocket Launch
Part 23: Duna Burn and Periapsis
Part 24: Duna Oberth Effect
Part 25: Duna Mid-course Corrections
Part 26: Using Gravity to Orbit Duna
Part 27: Landing on Duna
Part 28: Exploring Duna
Part 29: Launching Off Duna
Part 30: Fast Return Path From Duna
Part 31: Advanced Duna Flight Math
Part 32: Burn 2 Escape Duna
Part 33: Returning to Earth From Duna
 
Last edited by a moderator:

Want to reply to this thread?

"Kerbal Space Program - Duna Flight Math" You must log in or register to reply here.

Related Threads for: Kerbal Space Program - Duna Flight Math

Replies
3
Views
1K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
12
Views
1K
Replies
2
Views
2K
Replies
1
Views
1K
  • Posted
Replies
3
Views
3K
Replies
5
Views
2K
Top