Exemple #1
0
from rocket import max_radius, DAY

F = 0.1405
m_dot = 0.07489


def accel(t):
    return F / (1 - m_dot * t)


tf = np.linspace(20, 490, 50)
s1, s2 = None, None
r1, r2, t1, t2 = [], [], [], []

for t in tf * DAY:
    s1 = max_radius(accel, t, init=s1)
    s2 = max_radius(accel, t, init=s2, min=True)
    r1.append(s1.y[0, -1])
    r2.append(s2.y[0, -1])
    t1.append(s1.tau / DAY)
    t2.append(s2.tau / DAY)

plt.axis([0, r1[-1], 0, t2[-1]])
plt.plot(r1, t1, 'r', label='maximum')
plt.plot(r2, t2, 'b', label='minimum')

t1 = interp1d(r1, t1, 3)
t2 = interp1d(r2, t2, 3)

r = [1.52, 5.2, 0.723, 0.387]  # mars,jupiter,venus,mercury
t = [t1(r[0]), t1(r[1]), t2(r[2]), t2(r[3])]
Exemple #2
0
title = ['Mars', 'Jupiter', 'Venus', 'Mercury']
rf = [1.52, 5.2, 0.723, 0.387]
tf = [192.134, 477.62, 139.315, 252.031]
dt = [
    np.linspace(-30, 50, 40),
    np.linspace(-40, 70, 40),
    np.linspace(-30, 50, 40),
    np.linspace(-30, 45, 40)
]

plt.figure(figsize=(6.4, 6.4))

for i, r in enumerate(rf):
    t = tf[i] * DAY
    s = max_radius(accel, t, min=(r < 1))

    T = []
    tau = s.tau / DAY + dt[i]
    for t in tau * DAY:
        s = min_time(accel, r, t, init=s)
        T.append(s.p[0] / DAY)

    plt.subplot(2, 2, i + 1)
    plt.plot(tau, T)
    plt.xlim(tau[[0, -1]])
    plt.title(title[i], fontsize=14)

    if i & 2: plt.xlabel(r'$\tau$ = launch time  / day', fontsize=14)
    if i & 1 == 0: plt.ylabel(r'$T$ = flight time  / day', fontsize=14)
Exemple #3
0

def accel(t):
    return F / (1 - m_dot * t)


title = ['Mars', 'Jupiter', 'Venus', 'Mercury']
tf = [192.134, 477.62, 139.315, 252.031]
min = [False, False, True, True]
step = [4, 4, 4, 2]

plt.figure(figsize=(6.4, 6.4))

for i, t in enumerate(tf):
    t *= DAY
    s = max_radius(accel, t, min=min[i])
    t, r, th = s.x, s.y[0], s.th
    tau = s.tau / DAY
    a = accel(t)
    phi = np.pi / 2 - s.phi + th

    x, y = r * np.cos(th), r * np.sin(th)
    a, b = a * np.cos(phi), a * np.sin(phi)

    th = th[-1] + (t - t[-1]) / np.sqrt(r[-1]**3)
    th = th[th - th[0] <= 2 * np.pi]
    t = t[t <= 2 * np.pi]

    plt.subplot(2, 2, i + 1)
    plt.axis('equal')
    plt.plot(r[-1] * np.cos(th), r[-1] * np.sin(th), '--g')
Exemple #4
0
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import cumtrapz
from rocket import max_radius,DAY

F = 0.1405
m_dot = 0.07489
def accel(t): return F/(1 - m_dot*t)

tf = 192.13*DAY

s = max_radius(accel,tf)
t = s.x/DAY
r,u,v,lr,lu,lv = s.y
th,phi = s.th,s.phi

plt.figure(figsize=(6.4, 8))
plt.subplots_adjust(left=0.12, right=0.98,
                    bottom=0.08, top=0.98, hspace=0)

plt.subplot(3,1,1)
plt.plot(t,r,label='r')
plt.plot(t,u,label='u')
plt.plot(t,v,label='v')
plt.xlim(t[[0,-1]])
plt.xticks([])
plt.ylabel('r, u, v', fontsize=14)
plt.legend(labelspacing=0.2)

plt.subplot(3,1,2)
plt.plot(t,lr,label=r'$\lambda_r$')