Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elements #2264

Merged
merged 27 commits into from
Aug 9, 2019
Merged

Elements #2264

merged 27 commits into from
Aug 9, 2019

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Aug 5, 2019

Mean element computation.

Tests covering more diverse orbits—including, notably, retrograde orbits, which go through a different code path, computing the mean inclination from the average of (cotg i/2 cos Ω, cotg i/2 sin Ω) instead of (tg i/2 cos Ω, tg i/2 sin Ω)—will come in a subsequent pull request; these will be based on SP3 files, and their addition would make this one unwieldy.


// The classical Keplerian elements (a, e, i, Ω, ω, M),
// together with an epoch.
struct ClassicalElements {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not using KeplerianElements?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, the completion of KeplerianElements performed by KeplerOrbit would be nonsensical: the resulting period would not be any of the three interesting periods exposed by this class.

The mean elements are near-invariants of the perturbed motion (or, for Ω, ω, and M, their derivatives are near-invariants of motion) that happen to coincide with the Keplerian elements for unperturbed motion; this does not mean that they can meaningfully be used as the elements of some unperturbed orbit.


// Mean element time series. These elements are free of short-period
// variations, i.e., variations whose period is the orbital period.
std::vector<ClassicalElements> const& mean_elements() const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a map time -> elements? At some level it's the same thing but it would be easier for clients.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the processing done within this class to compute ranges (which works fine with this structure), I don't really see mean_elements being useful for much more than the occasional plot; if we end up needing an associative container we can reconsider.

astronomy/orbital_elements.hpp Outdated Show resolved Hide resolved
astronomy/orbital_elements.hpp Show resolved Hide resolved
// from the mean elements.

// The equinoctial elements, together with an epoch.
// See Broucke and Cefola (1972), On the equinoctial orbit elements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Article title?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the equinoctial orbit elements.

return result;
}

inline void OrbitalElements::ComputePeriodsAndPrecession() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again comments would help or at least a reference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments.

astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
Instant const& initial_time,
Instant const& final_time,
Ephemeris<ICRS>& ephemeris) {
MassiveBody const& earth = [&ephemeris]() -> MassiveBody const& {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use a lambda.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this a static function.

astronomy/orbital_elements_test.cpp Show resolved Hide resolved
MasslessBody{});
ASSERT_THAT(status_or_elements, IsOk());
OrbitalElements const& elements = status_or_elements.ValueOrDie();
EXPECT_THAT(elements.anomalistic_period() - *initial_osculating.period,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why AbsoluteError in the previous test and not here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous test it is noise, I am testing that it is small; here it is due to the perturbation, its sign is interesting.

astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
@pleroy pleroy added the LGTM label Aug 8, 2019
@pleroy
Copy link
Member

pleroy commented Aug 8, 2019

Apparently ʃ works in identifiers. It's U+0283, Latin Small Letter Esh. Could we use this?

@eggrobin
Copy link
Member Author

eggrobin commented Aug 9, 2019

Apparently ʃ works in identifiers. It's U+0283, Latin Small Letter Esh. Could we use this?

That ſeems reaſonable; both are baſed on the italic glyph for ſ.

@@ -177,7 +177,7 @@ inline Time OrbitalElements::SiderealPeriod(
Time const Δt =
equinoctial_elements.back().t - equinoctial_elements.front().t;
Instant const t0 = equinoctial_elements.front().t + Δt / 2;
Product<Angle, Square<Time>> ſ_λt_dt;
Product<Angle, Square<Time>> ʃ_λt_dt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much better.

@eggrobin eggrobin merged commit f48ea15 into mockingbirdnest:master Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants