def test_compare_a_eci_to_rv(self): X0_mee = mee_0 X0_rv = rv_0 order_H = 6 kep_dyn_mee = mee.KeplerianDynamics() zon_grav_mee = mee.ZonalGravity(order=order_H) kep_dyn_rv = rv.KeplerianDynamics() zon_grav_rv = rv.ZonalGravity(order=order_H) segs_per_orbit = 6 segments = orbits * segs_per_orbit domains = [k * period / segs_per_orbit for k in range(segments + 1)] seg_number = len(domains) - 1 N = (order_mcpi, ) * seg_number mcpi_mee = mcpyi.MCPI(kep_dyn_mee, domains, N, 'warm', X0_mee, tol) mcpi_rv = mcpyi.MCPI(kep_dyn_rv, domains, N, 'warm', X0_rv, tol) X_mee = mcpi_mee.solve_serial()(T) X_rv = mcpi_rv.solve_serial()(T) zon_grav_mee.eci_acceleration(T, convert.rv_mee(X_mee)) zon_grav_rv.eci_acceleration(T, X_rv) np.testing.assert_allclose(zon_grav_mee.a_eci, zon_grav_rv.a_eci, rtol=0, atol=tol)
def test_compare_zonal_to_coe(self): X0_mee = mee_0 X0_coe = coe_0 order_H = 6 kep_dyn_mee = mee.KeplerianDynamics() zon_grav_mee = mee.ZonalGravity(order=order_H) sysmee = utl.SystemDynamics(kep_dyn_mee, zon_grav_mee) kep_dyn_coe = coe.KeplerianDynamics() zon_grav_coe = coe.ZonalGravity(order=order_H) syscoe = utl.SystemDynamics(kep_dyn_coe, zon_grav_coe) segs_per_orbit = 6 orbits = 1 segments = orbits * segs_per_orbit domains = [k * period / segs_per_orbit for k in range(segments + 1)] seg_number = len(domains) - 1 N = (order_mcpi, ) * seg_number mcpi_mee = mcpyi.MCPI(sysmee, domains, N, 'warm', X0_mee, tol) mcpi_coe = mcpyi.MCPI(syscoe, domains, N, 'warm', X0_coe, tol) X_mee = mcpi_mee.solve_serial()(T) X_coe = mcpi_coe.solve_serial()(T) diff = convert.mod_angles(np.abs(X_coe - convert.coe_mee(X_mee))) indices_2pi = np.where(2 * np.pi - tol < diff) diff[indices_2pi] -= 2 * np.pi np.testing.assert_allclose(diff, 0., rtol=0, atol=tol)
def test_zonal_gravity(self): X0 = mee_0 order_H = 6 kep_dyn = mee.KeplerianDynamics() zon_grav = mee.ZonalGravity(order=order_H) system = utl.SystemDynamics(kep_dyn, perturbations=zon_grav) segs_per_orbit = 6 segments = orbits * segs_per_orbit domains = [k * period / segs_per_orbit for k in range(segments + 1)] seg_number = len(domains) - 1 N = (order_mcpi, ) * seg_number mcpi = mcpyi.MCPI(system, domains, N, 'warm', X0, tol) X = mcpi.solve_serial()(T) H = mee.Hamiltonian(order=order_H)(T, X) np.testing.assert_allclose(H[0, 0], H, rtol=0, atol=tol * 10)
def test_compare_zonal_to_mee(self): X0_meeMl0 = meeMl0_0 X0_mee = mee_0 order_H = 6 kep_dyn_meeMl0 = meeMl0.KeplerianDynamics() zon_grav_meeMl0 = meeMl0.ZonalGravity(order=order_H) sysmeeMl0 = utl.SystemDynamics(kep_dyn_meeMl0, zon_grav_meeMl0) kep_dyn_mee = mee.KeplerianDynamics() zon_grav_mee = mee.ZonalGravity(order=order_H) sysmee = utl.SystemDynamics(kep_dyn_mee, zon_grav_mee) segs_per_orbit = 6 segments = orbits * segs_per_orbit domains = [k * period / segs_per_orbit for k in range(segments + 1)] seg_number = len(domains) - 1 N = (order_mcpi, ) * seg_number mcpi_meeMl0 = mcpyi.MCPI(sysmeeMl0, domains, N, 'warm', X0_meeMl0, tol) mcpi_mee = mcpyi.MCPI(sysmee, domains, N, 'warm', X0_mee, tol) X_meeMl0 = mcpi_meeMl0.solve_serial()(T) X_mee = mcpi_mee.solve_serial()(T) diff = convert.mod_angles(X_mee - convert.mee_meeMl0(T, X_meeMl0)) np.testing.assert_allclose(diff, 0.0, rtol=0, atol=tol * 10)