\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{listings}
\usepackage{color}
\newcommand*{\rK}{1.36}
\newcommand*{\rE}{0.983}
\newcommand*{\rJ}{6.88}
\title{A fuel-optimal mission to an outer planet with an Eve flyby}
\author{Hörður Mar Tómasson}
\date{July 2014}
\begin{document}
\maketitle
\begin{abstract}
The parameters of a fuel-optimal mission from Kerbin via Eve to an outer planet with an arbitrary orbit radius were calculated. The $\Delta v$ gain of performing the Eve flyby instead a direct Hohmann transfer to the outer planet is on the order of 50 m/s. Eccentricity and inclination of planets' orbits were not considered.
\end{abstract}
\tableofcontents
\newpage
\section{Introduction}
An outer planet-bound spacecraft initially shares Kerbin's circular orbit around Kerbol, but must somehow raise its apoapsis to at least the orbit radius of the outer planet.
The straightforward way to accomplish this is to burn into a Hohmann transfer orbit straight from Kerbin to the target. Here, however, we shall consider scheduling an Eve encounter along the way to the outer planet.
Going to Eve means that at the start of our journey we throw away perfectly good $\Delta v$ on lowering our periapsis. However, there are three reasons why this might pay off in the end. Firstly, by diving into the deep gravity well of Eve we can increase the energy worth of our remaining $\Delta v$. Secondly, we can get a gravity assist from Eve, accepting some of Eve's own momentum. Thirdly, a transfer orbit from Eve to an outer planet is slightly lower in energy than a transfer orbit from Kerbin since its major axis is a little shorter.
When going to Jool, we can just barely break even in terms of $\Delta v$ when we do the Eve flyby instead of just the straight Hohmann transfer from Kerbin. The gain in $\Delta v$ is rather insignificant considering the fewer launch windows, longer travel time and increased effort and risk. However, with the addition of more outer planets to KSP, we can anticipate there will be greater $\Delta v$ gains to be had from an Eve flyby.
\section{Theory}
The path of the spacecraft is strung together out of the following five conic section patches.
\begin{itemize}
\item Hyperbolic escape from Kerbin.
\item Elliptic transfer from Kerbin to Eve.
\item Hyperbolic approach to Eve.
\item Hyperbolic escape from Eve.
\item Elliptic transfer from Eve to outer planet.
\end{itemize}
We shall consider each patch in reverse order.
\subsection{Eve to outer planet transfer}
Of all the transfer orbits from Eve to an outer planet, the one that requires the least speed as a spacecraft escapes Eve is the Hohmann transfer. Therefore, it is in terms of $\Delta v$ the cheapest transfer orbit to enter, whether the spacecraft is coming from Eve's surface or all the way from Kerbin.\footnote{Proving this is left as an excercise for the reader.}
The Hohmann transfer orbit is the elliptic orbit that is tangent to both Eve's orbit and the outer planet's orbit. We designate as $P_9$ the point where the spacecraft leaves Eve and as $P_{10}$ the point where it encounters the outer planet. The velocity at either point is easily found from the vis viva equation,
\begin{align}
v_{10} &= \sqrt{2\mu_S \bigg( \frac{1}{r_J} - \frac{1}{r_J+r_E} \bigg)}\ , \\
v_9 &= \sqrt{2\mu_S \bigg( \frac{1}{r_E} - \frac{1}{r_J+r_E} \bigg)}\ .
\end{align}
\begin{figure}[ht]
\begin{center}
\begin{tikzpicture}
\draw [color=gray] (0,0) circle (0.5*\rE);
\draw [color=gray] (0,0) circle (0.5*\rJ);
\node [fill=white] at (0.5*\rE,0) [right] {$P_9$ (Eve)};
\node at (-0.5*\rJ,0) [left] {$P_{10}$ (Outer planet)};
\draw [domain=-1:1, samples=200, smooth] plot ({\x*0.25*(\rJ+\rE)-0.25*(\rJ-\rE)},{sqrt((\rJ+\rE)*(\rJ+\rE)-(\rJ-\rE)*(\rJ-\rE)/4)*0.25*sqrt(1-\x*\x)});
\fill [green!60!black] (-0.5*\rJ,0) circle (0.07);
\fill [purple] (0.5*\rE,0) circle (0.07);
\draw [fill=yellow] (0,0) circle (0.14);
\end{tikzpicture}
\end{center}
\caption{Eve to outer planet transfer orbit.}
\end{figure}
\subsection{Eve escape}
The next patch to consider is the hyperbolic escape orbit from Eve. $P_8$ is where the spacecraft leaves Eve's sphere of influence. $P_7$ is the periapsis of the orbit. Its distance from Eve's centre is $r_{LE}$.
To find $v_8$ from $v_9$ we translate from Kerbol's frame of reference to Eve's frame of reference, simply adding Eve's orbital velocity $v_E$,
\begin{align}
v_8 &= v_9 + v_E \nonumber \\
&= \sqrt{2\mu_S \bigg( \frac{1}{r_E} - \frac{1}{r_J+r_E} \bigg)} + v_E \ .
\end{align}
Next we find $v_7$ from the conservation of orbital energy,
\begin{align}
v_7 &= \sqrt{v_8^{\phantom{8}2} + \frac{2\mu_E}{r_{LE}}} \ .
\end{align}
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\draw [fill=violet!50!white] (0,0) circle (0.7);
\draw (0,0) circle (0.8);
\draw (0,0) -- (0.8,0);
\node at (0.3,0) [below] {$r_{LE}$};
\draw [domain=-1.8:0, samples=200, smooth] plot (xy polar cs:angle={(\x + 0.468) r}, radius={-2.57365/(1 + 2.217059 * cos(\x r))});
\draw [domain=0:2, samples=200, smooth] plot (xy polar cs:angle={(\x + 0.468) r}, radius={-1.89213/(1 + 1.36516 * cos(\x r))});
\fill ({180+0.468*180/3.1416}:0.8) circle (0.07);
\node at ({180+0.468*180/3.1416}:0.8) [below left] {$P_6$, $P_7$};
\draw [->] (0,2) -- (0,3);
\node at (0,2.5) [right] {Eve prograde};
\node at ({-1.8 r + 0.468 r + 180}:5.19) [left] {$P_8$};
\node at ({2 r + 0.468 r + 180}:4.38) [below] {$P_5$};
\end{tikzpicture}
\end{center}
\caption{Eve approach and escape.}
\end{figure}
\subsection{Eve approach}
Preceding Eve escape is the Eve approach, a hyperbolic orbit with the same periapsis as the escape orbit. At that periapsis we do a transfer burn, so although $P_6$ designates the same location as $P_7$, $v_8$ and $v_7$ differ by the velocity added by the burn, $v_{\Delta}$,
\begin{align}
v_6 &= v_7 - v_{\Delta} \ .
\end{align}
Selecting the optimal value of $v_{\Delta}$ is addressed in subsection \ref{subsec:optimize}.
$P_5$ is where the spacecraft enters Eve's sphere of influence. Again, we find $v_5$ from the conservation of orbital engergy,
\begin{align}
v_5 &= \sqrt{v_6^{\phantom{6}2} - \frac{2\mu_E}{r_{LE}}} \ .
\end{align}
Having found the speed $v_5$ at $P_5$, let us then find the direction of travel, $\phi_5$. We take Eve's prograde direction to be 0 and right turns to be positive when north is up. We have a formula for the angle between the asymptote and the transverse axis of a hyperbolic orbit. Note that since one of the asymptotes points against the direction of travel we must subtract $\pi$ to find the correct angle.
\begin{align}
\phi_5 &= -\pi + \sec^{-1} \bigg( \frac{r_{LE}}{\mu_E} \cdot v_5^2 + 1 \bigg) + \sec^{-1} \bigg( \frac{r_{LE}}{\mu_E} \cdot v_8^2 + 1 \bigg) \ .
\end{align}
We can then represent the velocity vector at $P_5$ in terms of its component along Eve's prograde direction, with magnitude $v_{5p}$, and its component along Eve's radial out direction, with magnitude $v_{5r}$,
\begin{align}
v_{5p} &= v_5 \cdot \cos \phi_5 \ , \\
v_{5r} &= v_5 \cdot \sin \phi_5 \ .
\end{align}
\subsection{Kerbin to Eve transfer}
Translating again to Kerbol's frame of reference we find the velocity at $P_4$, where the spacecraft encounters Eve on the Kerbin--Eve transfer orbit,
\begin{align}
v_{4p} &= v_{5p} + v_E \ , \\
v_{4r} &= v_{5r} \ .
\end{align}
We then find the velocity at $P_3$, where the spacecraft leaves Kerbin. $v_{3p}$ is found from the conservation of angular momentum and then $v_{3r}$ is found from the conservation of orbital energy,
\begin{align}
v_{3p} &= \frac{r_E}{r_K} \cdot v_{4p} \ , \\
v_{3r} &= \sqrt{v_{4p}^{\phantom{4p}2} + v_{4r}^{\phantom{4r}2} - v_{3p}^{\phantom{3p}2} + 2\Big(v_K^{\phantom{K}2} - v_E^{\phantom{E}2}\Big)} \nonumber \\
&= \sqrt{\bigg( 1 - \frac{r_E^{\phantom{E}2}}{r_K^{\phantom{K}2}} \bigg) v_{4p}^{\phantom{4p}2} + v_{4r}^{\phantom{4r}2} + 2\Big(v_K^{\phantom{K}2} - v_E^{\phantom{E}2}\Big)} \ .
\end{align}
\begin{figure}[ht]
\begin{center}
\begin{tikzpicture}
\draw [color=gray] (0,0) circle (2*\rE);
\draw [color=gray] (0,0) circle (2*\rK);
\node [fill=white] at (79.53:2.1*\rE) [above] {$P_4$ (Eve)};
\node at (2*\rK,0) [right] {$P_3$ (Kerbin)};
\draw [domain=0:79.53, samples=200, smooth] plot (xy polar cs:angle={\x}, radius={1.852/(1 + 0.3191 * cos(180-\x))});
\fill [blue] (2*\rK,0) circle (0.07);
\fill [purple] (79.53:2*\rE) circle (0.07);
\draw [fill=yellow] (0,0) circle (0.14);
\end{tikzpicture}
\end{center}
\caption{Kerbin to Eve transfer orbit.}
\end{figure}
\subsection{Kerbin escape}
Lastly we consider the hyperbolic escape orbit from Kerbin. Its periapsis, designated $P_1$, is at a distance $r_{LK}$ from Kerbin's centre. $P_2$ is where the spacecraft escapes Kerbin's sphere of influence. To find the velocity at $P_2$ we translate from Kerbol's to Kerbin's frame of reference,
\begin{align}
v_{2p} &= v_{3p} - v_K \\
v_{2r} &= v_{3r} \\
v_1 &= \sqrt{v_{2p}^2 + v_{2r}^2 + \frac{2\mu_K}{r_{LK}}} \nonumber \\
&= \sqrt{(v_{3p} - v_K)^2 + v_{3r}^2 + \frac{2\mu_K}{r_{LK}}}
\end{align}
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\draw [fill=blue!50!white] (0,0) circle (0.6);
\draw (0,0) circle (0.7);
\draw (0,0) -- (0.7,0);
\node at (0.2,0) [below] {$r_{LK}$};
\draw [domain=0:2.2, samples=200, smooth] plot (xy polar cs:angle={(\x - 0.9866) r}, radius={-1.5399/(1 + 1.19984 * cos(\x r))});
\fill (123.49:0.7) circle (0.07);
\node at (123.49:0.7) [above left] {$P_1$};
\node at ({2.2 r - 0.9866 r + 180}:5.24) [left] {$P_2$};
\draw [->] (0,-3) -- (0,-4);
\node at (0,-3.5) [right] {Kerbin retrograde};
\end{tikzpicture}
\end{center}
\caption{Kerbin escape orbit.}
\end{figure}
\subsection{Optimizing $v_{\Delta}$} \label{subsec:optimize}
To find the optimal $v_{\Delta}$ we try different values until we find the one that leads to the minimum value of $v_{\Delta} + v_1$. Equivalently, we can find the value of $v_{\Delta}$ that makes $v_{3r}$ go to zero. The fuel-optimal path has a Kerbin to Eve transfer orbit that is tangent to Kerbin's orbit.\footnote{Proving this is left as another excercise for the reader.}
\subsection{When to launch}
It is preferable when the spacecraft reaches Eve's orbit that Eve is actually situated at that point on its orbit. When we know $v_1$, we can find the right time to launch for that to happen.
From the vis viva equation we can find the semi-major axis $a$ of the Kerbin to Eve transfer orbit. Then we find its eccentricity $e$. From these parameters of the transfer orbit's geometry we can find the true anomaly $\theta$ and, from that, the eccentric anomaly $E$ of the Eve encounter.\footnote{The relevant equations are given on Wikipedia's page for \emph{True anomaly}.} The true anomaly of Kerbin at launch is $\pi$.
\begin{align}
a &= \frac{2\mu_S r_E}{2\mu_S-r_E v_1^{\phantom{1}2}} \ ,\\
e &= \frac{r_K}{a}-1 \ , \\
\theta &= -\arccos \bigg( \frac{a(1-e^2)-r_E}{e \cdot r_E} \bigg) \ , \\
E &= -\arccos \bigg( \frac{e + \cos \theta}{1 + e \cos \theta} \bigg) \ .
\end{align}
We then find the mean anomaly $M$ from the Kepler equation,
\begin{align}
M &= E - e \sin E \ .
\end{align}
We also need to know the orbital periods $T_E$, $T_J$, $T_{KE}$ and $T_{EJ}$ of respectively Eve's orbit, the outer planet's orbit, the Kerbin to Eve transfer orbit and the Eve to outer planet transfer orbit.
\begin{align}
T_{KE} &= 2\pi \sqrt{\frac{a^3}{\mu_S}} \ , \\
T_{EJ} &= 2\pi \sqrt{\frac{(r_J+r_E)^3}{8\mu_S}} \ . \\
\end{align}
The travel time from Kerbin to Eve is $(\pi-M) \cdot T_{KE} / 2\pi$ and the travel time from Eve to the outer planet is $T_{EJ}/2$. The true anomaly of the Eve encounter is $\theta$ and the true anomaly of the outer planet encounter is $\theta + \pi$. Now we can find the true anomalies $\theta_E$ and $\theta_J$ at which we want respectively Eve and the outer planet at launch time,
\begin{align}
\theta_E &= \theta - \frac{(M-\pi) \cdot T_{KE}}{T_E} \ , \\
\theta_J &= \theta + \pi - \frac{(M-\pi) \cdot T_{KE} + \pi \cdot T_{EJ}}{T_J} \ .
\end{align}
To escape in Kerbin's retrograde direction, we burn when at an angle $-\phi_1$ counterclockwise from the its prograde direction,
\begin{align}
-\phi_1 &= \sec^{-1} \bigg( \frac{r_{LK}}{\mu_K} \cdot v_1^2 + 1 \bigg) \ .
\end{align}
\newpage
\section{Implementation and results}
\subsection{Implementation}
To calculate the parameters of the described fuel optimal mission a Python script, here included as appendix \ref{app:script}, was written. It was run for a range of values of $r_J$, the radius of the outer planet's orbit.
The mission is assumed to start from Kerbin orbit at an altitude of 100 km. The periapsis of the Eve flyby is also assumed to have an altitude of 100 km.
\subsection{Positions of planets at launch}
Figure \ref{fig:positions} shows how the relevant planets should be positioned at launch. The optimal position of Eve does not vary significantly with $r_J$ over the considered range. For most of the range, launch should be scheduled when Eve is $45.52^{\circ}$ behind Kerbin.
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\foreach \ang in {0,...,35} {
\draw [lightgray] (0,0) -- (\ang*360/36:3);
}
\foreach \lab/\dir in {
0/right,
30/{above right},
60/{above right},
90/above,
120/{above left},
150/{above left},
180/left,
210/{below left},
240/{below left},
270/below,
300/{below right},
330/{below right}} {
\draw (\lab:3) -- (\lab:3.1);
\node [fill=white] at (\lab:3.1) [\dir] {\scriptsize $\lab^{\circ}$};
}
\draw (0,0) circle (3);
\foreach \s in {1, 2, 3} {
\draw [lightgray] (0,0) circle (\s-0.5);
\draw [lightgray] (0,0) circle (\s-1);
\node at (\s+0.1, 0) [below] {\scriptsize $\s$};
}
\draw (0,0) circle (0.408);
\draw (0,0) circle (0.688);
\node at (2,0) [above, color=blue] {Kerbin};
\node at (-45.5:2) [above right, color=purple] {Eve};
\node at (195:1.7) [below, color=green!60!black] {Outer planet};
\draw [color=blue] (0.30,0) -- (3,0);
\draw [color=purple]
(-45.56:0.30) -- (-45.55:0.35) -- (-45.54:0.40) -- (-45.53:0.45) -- (-45.53:0.50) -- (-45.53:0.55) -- (-45.53:0.60) -- (-45.53:0.65) -- (-45.52:0.70) -- (-45.52:0.75) -- (-45.52:0.80) -- (-45.52:0.85) -- (-45.52:0.90) -- (-45.52:0.95) -- (-45.52:1.00) -- (-45.52:1.05) -- (-45.52:1.10) -- (-45.52:1.15) -- (-45.52:1.20) -- (-45.52:1.25) -- (-45.52:1.30) -- (-45.52:1.35) -- (-45.52:1.40) -- (-45.52:1.45) -- (-45.52:1.50) -- (-45.52:1.55) -- (-45.52:1.60) -- (-45.52:1.65) -- (-45.52:1.70) -- (-45.52:1.75) -- (-45.52:1.80) -- (-45.52:1.85) -- (-45.52:1.90) -- (-45.52:1.95) -- (-45.52:2.00) -- (-45.52:2.05) -- (-45.52:2.10) -- (-45.52:2.15) -- (-45.52:2.20) -- (-45.52:2.25) -- (-45.51:2.30) -- (-45.51:2.35) -- (-45.51:2.40) -- (-45.51:2.45) -- (-45.51:2.50) -- (-45.51:2.55) -- (-45.51:2.60) -- (-45.51:2.65) -- (-45.51:2.70) -- (-45.51:2.75) -- (-45.51:2.80) -- (-45.51:2.85) -- (-45.51:2.90) -- (-45.51:2.95) -- (-45.51:3.00);
\draw [color=green!60!black]
(138.93:0.30) -- (148.82:0.35) -- (155.92:0.40) -- (161.25:0.45) -- (165.38:0.50) -- (168.67:0.55) -- (171.35:0.60) -- (173.57:0.65) -- (175.44:0.70) -- (177.03:0.75) -- (178.40:0.80) -- (179.59:0.85) -- (180.63:0.90) -- (181.56:0.95) -- (182.38:1.00) -- (183.11:1.05) -- (183.77:1.10) -- (184.37:1.15) -- (184.92:1.20) -- (185.41:1.25) -- (185.87:1.30) -- (186.29:1.35) -- (186.67:1.40) -- (187.03:1.45) -- (187.36:1.50) -- (187.67:1.55) -- (187.95:1.60) -- (188.22:1.65) -- (188.47:1.70) -- (188.70:1.75) -- (188.92:1.80) -- (189.13:1.85) -- (189.33:1.90) -- (189.51:1.95) -- (189.69:2.00) -- (189.85:2.05) -- (190.01:2.10) -- (190.16:2.15) -- (190.30:2.20) -- (190.44:2.25) -- (190.57:2.30) -- (190.69:2.35) -- (190.81:2.40) -- (190.92:2.45) -- (191.03:2.50) -- (191.13:2.55) -- (191.23:2.60) -- (191.32:2.65) -- (191.41:2.70) -- (191.50:2.75) -- (191.59:2.80) -- (191.67:2.85) -- (191.74:2.90) -- (191.82:2.95) -- (191.89:3.00);
\draw [fill=yellow] (0,0) circle (0.14);
\end{tikzpicture}
\end{center}
\caption{Plots of optimal position at launch as a function of outer planet orbit radius. The scale of the radial dimension is $10^{11}$ m. Black circles at 0.4 and 0.69 mark orbital radii of Dres and Jool.} \label{fig:positions}
\end{figure}
\newpage
\subsection{$\Delta v$ budget}
Figure \ref{fig:speed} shows the optimal $v_1$ and $v_1 + |v_{\Delta}|$ as a function of $r_J$.
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\foreach \rad in {1,...,3} {
\draw [color=lightgray] (2*\rad,0) -- (2*\rad,5);
\draw [color=lightgray] (2*\rad-1,0) -- (2*\rad-1,5);
\node at (2*\rad,0) [below] {\rad};
}
\node at (0,0) [below] {0};
\foreach \speed in {1,...,5} {
\draw [color=lightgray] (0,\speed) -- (6,\speed);
\node at (0,\speed) [left] {\speed{}000};
}
\node at (0,0) [left] {0};
\draw (0,5) -- (0,0) -- (6,0);
\node at (3,-0.5) [below] {$r_J$ [$10^{11}\,$m]};
\node at (-1,2.5) [left] {[m/s]};
\node at (6,3.32) [right] {$v_1$};
\node at (6,4.68) [right] {$v_1+|v_{\Delta}|$};
\draw (2*0.408,0) -- (2*0.408,5);
\draw (2*0.688,0) -- (2*0.688,5);
\draw
(0.52,3.38) -- (0.53,3.38) -- (0.54,3.37) -- (0.55,3.37) -- (0.56,3.37) -- (0.58,3.37) -- (0.60,3.36) -- (0.70,3.35) -- (0.80,3.35) -- (0.90,3.34) -- (1.00,3.34) -- (1.10,3.34) -- (1.20,3.33) -- (1.30,3.33) -- (1.40,3.33) -- (1.50,3.33) -- (1.60,3.33) -- (1.70,3.33) -- (1.80,3.33) -- (1.90,3.33) -- (2.00,3.33) -- (2.10,3.33) -- (2.20,3.33) -- (2.30,3.32) -- (2.40,3.32) -- (2.50,3.32) -- (2.60,3.32) -- (2.70,3.32) -- (2.80,3.32) -- (2.90,3.32) -- (3.00,3.32) -- (3.10,3.32) -- (3.20,3.32) -- (3.30,3.32) -- (3.40,3.32) -- (3.50,3.32) -- (3.60,3.32) -- (3.70,3.32) -- (3.80,3.32) -- (3.90,3.32) -- (4.00,3.32) -- (4.10,3.32) -- (4.20,3.32) -- (4.30,3.32) -- (4.40,3.32) -- (4.50,3.32) -- (4.60,3.32) -- (4.70,3.32) -- (4.80,3.32) -- (4.90,3.32) -- (5.00,3.32) -- (5.10,3.32) -- (5.20,3.32) -- (5.30,3.32) -- (5.40,3.32) -- (5.50,3.32) -- (5.60,3.32) -- (5.70,3.32) -- (5.80,3.32) -- (5.90,3.32) -- (6.00,3.32);
\draw
(0.52,3.45) -- (0.53,3.43) -- (0.54,3.40) -- (0.55,3.38) -- (0.56,3.39) -- (0.58,3.43) -- (0.60,3.46) -- (0.70,3.62) -- (0.80,3.74) -- (0.90,3.84) -- (1.00,3.93) -- (1.10,4.00) -- (1.20,4.06) -- (1.30,4.11) -- (1.40,4.16) -- (1.50,4.20) -- (1.60,4.24) -- (1.70,4.27) -- (1.80,4.30) -- (1.90,4.33) -- (2.00,4.35) -- (2.10,4.37) -- (2.20,4.39) -- (2.30,4.41) -- (2.40,4.43) -- (2.50,4.45) -- (2.60,4.46) -- (2.70,4.47) -- (2.80,4.49) -- (2.90,4.50) -- (3.00,4.51) -- (3.10,4.52) -- (3.20,4.53) -- (3.30,4.54) -- (3.40,4.55) -- (3.50,4.56) -- (3.60,4.57) -- (3.70,4.57) -- (3.80,4.58) -- (3.90,4.59) -- (4.00,4.60) -- (4.10,4.60) -- (4.20,4.61) -- (4.30,4.61) -- (4.40,4.62) -- (4.50,4.62) -- (4.60,4.63) -- (4.70,4.63) -- (4.80,4.64) -- (4.90,4.64) -- (5.00,4.65) -- (5.10,4.65) -- (5.20,4.66) -- (5.30,4.66) -- (5.40,4.66) -- (5.50,4.67) -- (5.60,4.67) -- (5.70,4.67) -- (5.80,4.68) -- (5.90,4.68) -- (6.00,4.68);
\end{tikzpicture}
\end{center}
\caption{Plots of optimal $v_1$ and $v_1 + |v_{\Delta}|$ as a function of outer planet orbit radius. Vertical lines at 0.4 and 0.69 mark orbital radii of Dres and Jool.} \label{fig:speed}
\end{figure}
Figure \ref{fig:gain} shows the $\Delta v$ gain of performing an Eve flyby instead of burning into a direct Hohmann transfer from Kerbin to the outer planet.
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\foreach \rad in {1,...,3} {
\draw [color=lightgray] (2*\rad,0) -- (2*\rad,6);
\draw [color=lightgray] (2*\rad-1,0) -- (2*\rad-1,6);
\node at (2*\rad,0) [below] {\rad};
}
\node at (0,0) [below] {0};
\foreach \speed in {1,...,6} {
\draw [color=lightgray] (0,\speed) -- (6,\speed);
}
\node at (0,0) [left] {0};
\node at (0,1) [left] {20};
\node at (0,2) [left] {40};
\node at (0,3) [left] {60};
\node at (0,4) [left] {80};
\node at (0,5) [left] {100};
\node at (0,6) [left] {120};
\draw (0,6) -- (0,0) -- (6,0);
\node at (3,-0.5) [below] {$r_J$ [$10^{11}\,$m]};
\node at (-0.7,2.5) [left] {[m/s]};
\draw (2*0.408,0) -- (2*0.408,6);
\draw (2*0.688,0) -- (2*0.688,6);
\draw
(0.52,0.10) -- (0.53,2.07) -- (0.54,3.98) -- (0.55,5.85) -- (0.56,6.02) -- (0.58,5.45) -- (0.60,4.95) -- (0.70,3.20) -- (0.80,2.26) -- (0.90,1.75) -- (1.00,1.49) -- (1.10,1.38) -- (1.20,1.36) -- (1.30,1.40) -- (1.40,1.47) -- (1.50,1.56) -- (1.60,1.66) -- (1.70,1.77) -- (1.80,1.88) -- (1.90,1.99) -- (2.00,2.10) -- (2.10,2.21) -- (2.20,2.32) -- (2.30,2.42) -- (2.40,2.51) -- (2.50,2.61) -- (2.60,2.70) -- (2.70,2.79) -- (2.80,2.87) -- (2.90,2.95) -- (3.00,3.02) -- (3.10,3.10) -- (3.20,3.17) -- (3.30,3.23) -- (3.40,3.30) -- (3.50,3.36) -- (3.60,3.42) -- (3.70,3.48) -- (3.80,3.53) -- (3.90,3.58) -- (4.00,3.63) -- (4.10,3.68) -- (4.20,3.73) -- (4.30,3.78) -- (4.40,3.82) -- (4.50,3.86) -- (4.60,3.90) -- (4.70,3.94) -- (4.80,3.98) -- (4.90,4.02) -- (5.00,4.05) -- (5.10,4.09) -- (5.20,4.12) -- (5.30,4.15) -- (5.40,4.18) -- (5.50,4.21) -- (5.60,4.24) -- (5.70,4.27) -- (5.80,4.30) -- (5.90,4.33) -- (6.00,4.35);
\end{tikzpicture}
\end{center}
\caption{Plot of the gained $\Delta v$ as a function of outer planet orbit radius. Vertical lines at 0.4 and 0.69 mark orbital radii of Dres and Jool.} \label{fig:gain}
\end{figure}
\newpage
\appendix
\section{Script for calculations} \label{app:script}
\lstset{language=Python}
\begin{lstlisting}
from math import *
import sys
muS = 1.1723328e18
rLK = 700e3
rK = 13599840256.0
muK = 3.5316e12
vK = sqrt(muS/rK)
rLE = 800e3
rE = 9.83e9
muE = 8.1717302e12
vE = sqrt(muS/rE)
TE = 5657995
rJ = float(sys.argv[1])*1e9
TJ = 2*pi*sqrt(rJ**3/muS)
vJ = sqrt(muS/rJ)
# rJ for Jool is 68.8e9
# TJ for Jool is 104661432
v9 = sqrt(muS*(2/rE - 2/(rE+rJ)))
v8 = v9 - vE
v7 = sqrt(v8**2+2*muE/rLE)
v3r2 = 10.0
vDeltaLo = 0.0
vDeltaHi = v7-sqrt(2*muE/rLE)
vDelta = 0.0
while (v3r2 >= 0.01 or v3r2 < 0):
vDelta = (vDeltaLo+vDeltaHi)/2
v6 = v7-vDelta
v5 = sqrt(v6**2-2*muE/rLE)
phiEi = -pi+acos(1/(v8**2*rLE/muE+1))+acos(1/(v5**2*rLE/muE+1))
v5p = v5*cos(phiEi)
v5r = v5*sin(phiEi)
v4p = v5p + vE
v4r = v5r
v4 = sqrt(v4p**2+v4r**2)
v3p = v4p*rE/rK
v3r2 = v4**2-2*muS/rE+2*muS/rK-v3p**2
if (v3r2 > 0):
vDeltaLo = vDelta
else:
vDeltaHi = vDelta
v3r = sqrt(v3r2)
v2p = v3p - vK
v2r = v3r
v2 = sqrt(v2p**2+v2r**2)
v1 = sqrt(v2**2+2*muK/rLK)
a = 2*muS*rE/(2*muS-rE*v1**2)
e = rK/a-1
theta = 2*pi-acos((a*(1-e**2)-rE)/(e*rE))
E = -acos((e+cos(theta))/(1+e*cos(theta)))
M = 2*pi+E-e*sin(E)
TKE = 2*pi*sqrt(a**3/muS)
TEJ = 2*pi*sqrt((rJ+rE)**3/(8*muS))
thetaE = theta-(M-pi)*TKE/TE
thetaJ = theta+pi-((M-pi)*TKE+pi*TEJ)/TJ
phi2 = -acos(v2p/v2)
phi1 = phi2+pi-acos(1/(v2**2*rLK/muK+1))
e1 = 1/cos(phi2-phi1+pi)
a1 = -rLK/(e-1)
vH = sqrt(muS*(2/rK - 2/(rK+rJ)))
v1H = sqrt((vH-vK)**2+2*muK/rLK)
print("vDelta: %.2f m/s"%vDelta)
print("Eve encounter position: %.2f deg"%(theta*180/pi-180))
print("Eve at launch: %.2f deg"%(thetaE*180/pi-180))
print("Outer planet at launch: %.2f deg"%(thetaJ*180/pi-180))
print("phi1: %.2f deg"%(phi1*360/6.28))
print("v1: %.2f m/s"%v1)
print("v1+vDelta: %.2f m/s"%(v1+vDelta))
print("Direct Hohmann transfer: %.2f m/s"%v1H)
print("Gain from Eve flyby: %.2f m/s"%(v1H-v1-vDelta))
\end{lstlisting}
\end{document}