def test_geo_cases_numerical(ecc_0, ecc_f): a = 42164 # km inc_0 = 0.0 # rad, baseline inc_f = (20.0 * u.deg).to(u.rad).value # rad argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-7 # km / s2 # Retrieve r and v from initial orbit s0 = Orbit.from_classical( Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg, ) a_d, _, _, t_f = change_inc_ecc(s0, ecc_f, inc_f, f) # Propagate orbit def f_geo(t0, u_, k): du_kep = func_twobody(t0, u_, k) ax, ay, az = a_d(t0, u_, k) du_ad = np.array([0, 0, 0, ax, ay, az]) return du_kep + du_ad sf = s0.propagate(t_f * u.s, method=cowell, f=f_geo, rtol=1e-8) assert_allclose(sf.ecc.value, ecc_f, rtol=1e-2, atol=1e-2) assert_allclose(sf.inc.to(u.rad).value, inc_f, rtol=1e-1)
def test_geo_cases_beta_dnd_delta_v(ecc_0, inc_f, expected_beta, expected_delta_V): a = 42164 # km ecc_f = 0.0 inc_0 = 0.0 # rad, baseline argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-7 # km / s2, unused inc_f = np.radians(inc_f) expected_beta = np.radians(expected_beta) s0 = Orbit.from_classical( Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg, ) _, delta_V, beta, _ = change_inc_ecc(s0, ecc_f, inc_f, f) assert_allclose(delta_V, expected_delta_V, rtol=1e-2) assert_allclose(beta, expected_beta, rtol=1e-2)
def test_geo_cases_numerical(ecc_0, ecc_f): a = 42164 # km inc_0 = 0.0 # rad, baseline inc_f = (20.0 * u.deg).to(u.rad).value # rad argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-7 # km / s2 k = Earth.k.to(u.km**3 / u.s**2).value # Retrieve r and v from initial orbit s0 = Orbit.from_classical(Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg) a_d, _, _, t_f = change_inc_ecc(s0, ecc_f, inc_f, f) # Propagate orbit sf = s0.propagate(t_f * u.s, method=cowell, ad=a_d, rtol=1e-8) assert_allclose(sf.ecc.value, ecc_f, rtol=1e-2, atol=1e-2) assert_allclose(sf.inc.to(u.rad).value, inc_f, rtol=1e-1)
def test_geo_cases_beta_dnd_delta_v(ecc_0, inc_f, expected_beta, expected_delta_V): a = 42164 # km ecc_f = 0.0 inc_0 = 0.0 # rad, baseline argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-7 # km / s2, unused inc_f = np.radians(inc_f) expected_beta = np.radians(expected_beta) s0 = Orbit.from_classical( Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg ) _, delta_V, beta, _ = change_inc_ecc(s0, ecc_f, inc_f, f) assert_allclose(delta_V, expected_delta_V, rtol=1e-2) assert_allclose(beta, expected_beta, rtol=1e-2)
def test_geo_cases_numerical(ecc_0, ecc_f): a = 42164 # km inc_0 = 0.0 # rad, baseline inc_f = (20.0 * u.deg).to(u.rad).value # rad argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-7 # km / s2 # Retrieve r and v from initial orbit s0 = Orbit.from_classical( Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg ) a_d, _, _, t_f = change_inc_ecc(s0, ecc_f, inc_f, f) # Propagate orbit sf = s0.propagate(t_f * u.s, method=cowell, ad=a_d, rtol=1e-8) assert_allclose(sf.ecc.value, ecc_f, rtol=1e-2, atol=1e-2) assert_allclose(sf.inc.to(u.rad).value, inc_f, rtol=1e-1)
argp = 0.0 # rad, the method is efficient for 0 and 180 f = 2.4e-6 # km / s2 k = Earth.k.to(u.km**3 / u.s**2).value s0 = Orbit.from_classical( Earth, a * u.km, ecc_0 * u.one, inc_0 * u.deg, 0 * u.deg, argp * u.deg, 0 * u.deg, epoch=Time(0, format="jd", scale="tdb"), ) a_d, _, _, t_f = change_inc_ecc(s0, ecc_f, inc_f, f) tofs = TimeDelta(np.linspace(0, t_f * u.s, num=1000)) rr2 = propagate(s0, tofs, method=cowell, rtol=1e-6, ad=a_d) # In[12]: frame = OrbitPlotter3D() frame.set_attractor(Earth) frame.plot_trajectory(rr2, label="orbit with artificial thrust") # ### Combining multiple perturbations # # It might be of interest to determine what effect multiple perturbations have on a single object. In order to add multiple perturbations we can create a custom function that adds them up: