Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 21e93eb8f6d0
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a57dc0d46479
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jun 29, 2019

  1. Copy the full SHA
    a7473c8 View commit details
  2. Merge pull request #2225 from eggrobin/sign-ω

    Fix the signs of ω and ν for retrograde orbits
    eggrobin authored Jun 29, 2019
    Copy the full SHA
    a57dc0d View commit details
Showing with 18 additions and 20 deletions.
  1. +15 −17 astronomy/lunar_orbit_test.cpp
  2. +3 −3 physics/kepler_orbit_body.hpp
32 changes: 15 additions & 17 deletions astronomy/lunar_orbit_test.cpp
Original file line number Diff line number Diff line change
@@ -221,50 +221,50 @@ constexpr std::array<GeopotentialTruncation, 4> geopotential_truncations = {
/*max_degree=*/50,
/*zonal_only=*/false,
/*first_period_eccentricity_vector_drift=*/0.00018,
/*first_period_descending_nodes=*/{-0.0055, +0.0051, +0.018, +0.027},
/*period_ends=*/{+0.0026, +0.0037, +0.0200, +0.021},
/*first_period_descending_nodes=*/{-0.0055, +0.0051, -0.027, -0.018},
/*period_ends=*/{+0.0026, +0.0037, -0.021, -0.0200},
/*periods=*/10,
},
{
#endif
/*max_degree=*/30,
/*zonal_only=*/false,
/*first_period_eccentricity_vector_drift=*/0.00032,
/*first_period_descending_nodes=*/{-0.0058, +0.0048, +0.018, +0.027},
/*period_ends=*/{+0.0019, +0.0050, +0.0190, +0.022},
/*first_period_descending_nodes=*/{-0.0058, +0.0048, -0.027, -0.018},
/*period_ends=*/{+0.0019, +0.0050, -0.022, -0.0190},
/*periods=*/28,
},
{
/*max_degree=*/25,
/*zonal_only=*/false,
/*first_period_eccentricity_vector_drift=*/0.00110,
/*first_period_descending_nodes=*/{-0.0060, +0.0044, +0.018, +0.027},
/*period_ends=*/{-0.0017, +0.0089, +0.0110, +0.021},
/*first_period_descending_nodes=*/{-0.0060, +0.0044, -0.027, -0.018},
/*period_ends=*/{-0.0017, +0.0089, -0.021, -0.0110},
/*periods=*/28,
},
{
/*max_degree=*/20,
/*zonal_only=*/false,
/*first_period_eccentricity_vector_drift=*/0.00130,
/*first_period_descending_nodes=*/{-0.0064, +0.0045, +0.018, +0.028},
/*period_ends=*/{-0.0030, +0.0100, +0.0083, +0.021},
/*first_period_descending_nodes=*/{-0.0064, +0.0045, -0.028, -0.018},
/*period_ends=*/{-0.0030, +0.0100, -0.021, -0.0083},
/*periods=*/28,
},
{
/*max_degree=*/10,
/*zonal_only=*/false,
/*first_period_eccentricity_vector_drift=*/0.00370,
/*first_period_descending_nodes=*/{-0.0091, +0.0036, +0.018, +0.028},
/*period_ends=*/{-0.0160, +0.0210, -0.0160, +0.021},
/*first_period_descending_nodes=*/{-0.0091, +0.0036, -0.028, -0.018},
/*period_ends=*/{-0.0160, +0.0210, -0.021, +0.0160},
/*periods=*/28,
#if PRINCIPIA_GEOPOTENTIAL_MAX_DEGREE_50
},
{
/*max_degree=*/50,
/*zonal_only=*/true,
/*first_period_eccentricity_vector_drift=*/0.00098,
/*first_period_descending_nodes=*/{+0.0038, +0.0040, +0.021, +0.022},
/*period_ends=*/{-0.0047, +0.0040, +0.0170, +0.025},
/*first_period_descending_nodes=*/{+0.0038, +0.0040, -0.022, -0.021},
/*period_ends=*/{-0.0047, +0.0040, -0.025, -0.0170},
/*periods=*/28,
#endif
}},
@@ -357,11 +357,9 @@ TEST_P(LunarOrbitTest, NearCircularRepeatGroundTrackOrbit) {
IsNear(1.4e-10));
EXPECT_THAT(RelativeError(initial_osculating.inclination, i0),
IsNear(9.7e-9));
// TODO(egg): Figure out why we don't have the same sign as Russel and Lara
// here.
EXPECT_THAT(
RelativeError(*initial_osculating.argument_of_periapsis, -ω0),
IsNear(7.1e-11));
EXPECT_THAT(RelativeError(*initial_osculating.argument_of_periapsis,
2 * π * Radian + ω0),
IsNear(2.0e-11));
EXPECT_THAT(RelativeError(initial_osculating.longitude_of_ascending_node,
2 * π * Radian + Ω0),
IsNear(4.7e-13));
6 changes: 3 additions & 3 deletions physics/kepler_orbit_body.hpp
Original file line number Diff line number Diff line change
@@ -194,15 +194,15 @@ KeplerOrbit<Frame>::KeplerOrbit(
// Inclination (above the xy plane).
Angle const i = AngleBetween(x_wedge_y, h);
// Argument of periapsis.
Angle const ω = positive_angle(
OrientedAngleBetween(ascending_node, periapsis, x_wedge_y));
Angle const ω =
positive_angle(OrientedAngleBetween(ascending_node, periapsis, h));
// Longitude of ascending node.
// This is equivalent to |OrientedAngleBetween(x, ascending_node, x_wedge_y)|
// since |ascending_node| lies in the xy plane.
Angle const Ω = positive_angle(
ArcTan(ascending_node.coordinates().y, ascending_node.coordinates().x));
Angle const true_anomaly =
positive_angle(OrientedAngleBetween(periapsis, r, x_wedge_y));
positive_angle(OrientedAngleBetween(periapsis, r, h));

SpecificEnergy const ε = v.Norm²() / 2 - μ / r.Norm();
double const e = eccentricity_vector.Norm();