diff --git a/doc/constants.rst b/doc/constants.rst index 7913907..6f78d3f 100644 --- a/doc/constants.rst +++ b/doc/constants.rst @@ -15,22 +15,26 @@ the various `pykep` objects and functionalities. - Symbol in pykep - Units - Value - * - Astronomical Unit + * - Astronomical Unit - pykep.AU - :math:`m` - - 149597870700.0 + - 1.495978707e+11 * - Cavendish constant - pykep.CAVENDISH - - :math:`\frac{N m^2}{kg^2}` - - 7.36687e-10 + - :math:`\frac{m^3}{sec^2 kg}` + - 6.67430e-11 * - Sun's gravitational parameter - pykep.MU_SUN - :math:`\frac{m^3}{sec^2}` - - 1.32712440018e+20 - * - Earth's gravitational parameter + - 1.32712440041279419e20 + * - Earth's gravitational parameter (JPL DE440) - pykep.MU_EARTH - :math:`\frac{m^3}{sec^2}` - - 398600441800000.0 + - 3.98600435507e+14 + * - Moon's gravitational parameter (JPL DE440) + - pykep.MU_MOON + - :math:`\frac{m^3}{sec^2}` + - 4.902800118e+12 * - Earth's velocity - pykep.EARTH_VELOCITY - :math:`\frac{m}{sec}` @@ -43,6 +47,10 @@ the various `pykep` objects and functionalities. - pykep.EARTH_J2 - -- - 0.00108262668 + * - CR3BP: Moon-Earth parameter + - pykep.CR3BP_EARTH_MOON + - -- + - 0.01215058439470971 * - Seconds in one day - pykep.DAY2SEC - -- @@ -51,3 +59,7 @@ the various `pykep` objects and functionalities. - pykep.RAD2DEG - -- - 57.29577951308232 + * - Radians in one degree + - pykep.DEG2RAD + - -- + - 0.017453292519943295 diff --git a/doc/propagation.rst b/doc/propagation.rst index 7c831be..3873586 100644 --- a/doc/propagation.rst +++ b/doc/propagation.rst @@ -12,7 +12,7 @@ seamlessly via variational equations. The main routines are listed here: -Keplerian dynamics +Keplerian ****************** .. currentmodule:: pykep @@ -23,7 +23,7 @@ Keplerian dynamics --------------------------------------------------------- -Non-Keplerian dynamics +Non-Keplerian ************************ .. currentmodule:: pykep diff --git a/include/kep3/core_astro/constants.hpp b/include/kep3/core_astro/constants.hpp index 2401f43..a5d8cae 100644 --- a/include/kep3/core_astro/constants.hpp +++ b/include/kep3/core_astro/constants.hpp @@ -22,14 +22,13 @@ enum elements_type { MEQ_R, // Modified Equinoctial Elements (retrogade) POSVEL, // position and Velocity }; - inline constexpr double pi = boost::math::constants::pi(); inline constexpr double half_pi = boost::math::constants::half_pi(); - -inline constexpr double AU = 149597870700.0; // Astronomical Unit (m) -inline constexpr double CAVENDISH = 73.6687e-11; // Cavendish constant (N M^2 / kg^2) -inline constexpr double MU_SUN = 1.32712440018e20; // Sun's gravitational parameter (m^3/s^2 kg) -inline constexpr double MU_EARTH = 398600441800000.0; // Earth's gravitational parameter (m^3/s^2 kg) +inline constexpr double AU = 149597870700.0; // Astronomical Unit (m) - IAU 2012 Resolution B1 +inline constexpr double CAVENDISH = 6.67430e-11; // Cavendish constant (m^3/s^2/kg) +inline constexpr double MU_SUN = 1.32712440041279419e20; // Sun's gravitational parameter (m^3/s^2 kg) - DE440 +inline constexpr double MU_EARTH = 398600435507000.0; // Earth's gravitational parameter (m^3/s^2 kg) - DE440 +inline constexpr double MU_MOON = 4902800118000.0; // Moon's gravitational parameter (m^3/s^2 kg) - DE440 inline constexpr double EARTH_VELOCITY = 29784.691831696804; // Earth's velocity. (m/s) inline constexpr double EARTH_J2 = 1.08262668E-03; inline constexpr double EARTH_RADIUS = 6378137; // Earth's radius (m) @@ -39,6 +38,8 @@ inline constexpr double DAY2SEC = 86400.0; inline constexpr double SEC2DAY = (1. / DAY2SEC); inline constexpr double DAY2YEAR = (1. / 365.25); inline constexpr double G0 = 9.80665; // Acceleration at Earth's surface (m/s^2) +inline constexpr double CR3BP_EARTH_MOON = 0.01215058439470971; // (M_moon + M_Earth) / M_Earth + } // namespace kep3 diff --git a/pykep/core.cpp b/pykep/core.cpp index d34a0ac..fd5af84 100644 --- a/pykep/core.cpp +++ b/pykep/core.cpp @@ -57,10 +57,12 @@ PYBIND11_MODULE(core, m) m.attr("EARTH_J2") = py::float_(kep3::EARTH_J2); m.attr("EARTH_RADIUS") = py::float_(kep3::EARTH_RADIUS); m.attr("RAD2DEG") = py::float_(kep3::RAD2DEG); + m.attr("DEG2RAD") = py::float_(kep3::RAD2DEG); m.attr("DAY2SEC") = py::float_(kep3::DAY2SEC); m.attr("SEC2DAY") = py::float_(kep3::SEC2DAY); m.attr("DAY2YEAR") = py::float_(kep3::DAY2YEAR); m.attr("G0") = py::float_(kep3::G0); + m.attr("CR3BP_EARTH_MOON") = py::float_(kep3::CR3BP_EARTH_MOON); // We expose here global enums: py::enum_(m, "el_type", "") diff --git a/pykep/docstrings.cpp b/pykep/docstrings.cpp index 7e2eda9..a18cc3b 100644 --- a/pykep/docstrings.cpp +++ b/pykep/docstrings.cpp @@ -1286,7 +1286,7 @@ std::string get_stark_docstring() { return R"(get_stark(tol) -Gets the Taylor adaptive propagator (Heyoka) for the Stark problem from the global cache and returns a copy. +Returns a Taylor adaptive propagator (Heyoka) for the Stark problem retreiving one from a global cache and making a copy. In `pykep`, abusing a term well established in electrodynamics, this is the initial value problem of a fixed inertial thrust mass-varying spacecraft orbiting a main body. @@ -1320,7 +1320,7 @@ std::string get_stark_var_docstring() { return R"(get_stark_var(tol) -Gets the variational (order 1) Taylor adaptive propagator (Heyoka) for the Stark problem from the global cache and returns a copy. +Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the Stark problem retreiving one from a global cache and making a copy. .. note: Variations are only considered with repsect to initial conditions and the fixed inertial thurst. diff --git a/test/ta_cr3bp_test.cpp b/test/ta_cr3bp_test.cpp index 823507c..d41499b 100644 --- a/test/ta_cr3bp_test.cpp +++ b/test/ta_cr3bp_test.cpp @@ -65,6 +65,7 @@ TEST_CASE("dynamics") std::vector ic{1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622}; std::copy(ic.begin(), ic.end(), ta.get_state_data()); + // Assign value for cis-lunar case. (note: not the official pykep on in this case) *ta.get_pars_data() = 0.01215058560962404; auto out = ta.propagate_until(5.7856656782589234); std::vector const ground_truth = {0.43038358727124, -1.64650668902846, 0.10271923139472, @@ -90,6 +91,7 @@ TEST_CASE("variational_dynamics") std::vector ic{1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622}; std::copy(ic.begin(), ic.end(), ta.get_state_data()); + // Assign value for cis-lunar case. (note: not the official pykep on in this case) *ta.get_pars_data() = 0.01215058560962404; auto out = ta.propagate_until(5.7856656782589234); std::vector const ground_truth = {0.43038358727124, -1.64650668902846, 0.10271923139472,