feat(astro): specific orbital angular momentum from elements#397
Merged
Conversation
Add orbit::specific_angular_momentum_from_elements(semi_major_axis, eccentricity), the conserved specific orbital angular momentum: h = sqrt(mu * a * (1 - e^2)) = sqrt(mu * p) (m^2/s) the angular momentum per unit mass of the two-body orbit (twice the areal velocity, Kepler's second law; mu = MU_EARTH). Equivalently sqrt(mu*p) with p the semi_latus_rectum_from_elements (#384); at the apsides h = r*v, and for a circle (e=0) it reduces to circular_angular_momentum sqrt(mu*a) (#348). Guard mirrors semi_latus_rectum_from_elements (a > 0, 0 <= e < 1). Analytic test specific_angular_momentum_from_elements_is_sqrt_mu_p: (a) worked a=7e6, e=0.1 -> h = sqrt(mu*6.93e6); (b) cross-check threading semi_latus_rectum_from_elements (#384): h^2 = mu*p across three (a,e); (c) circular cross-check threading circular_angular_momentum (#348): h(a,0) = sqrt(mu*a); (d) periapsis cross-check threading orbital_speed: h = r_p*v_p; (e) Err guards for a<=0, e>=1, non-finite. Free fn in orbit.rs (reached via valenx_astro::orbit::), no lib.rs change. valenx-astro 221 lib tests (was 220), cargo clippy --all-targets -D warnings clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
orbit::specific_angular_momentum_from_elements(semi_major_axis, eccentricity)— the conserved specific orbital angular momentum:Why
The orbit.rs conic-elements cluster has
eccentricity_from_apsides(#372),semi_major_axis_from_apsides(#378), andsemi_latus_rectum_from_elements(#384), but not the angular momentum.h = sqrt(mu*a*(1-e^2))is the conserved angular momentum per unit mass (twice the areal velocity, Kepler's 2nd law). Equivalentlysqrt(mu*p)withpthe semi-latus rectum; at the apsidesh = r*v(r and v are perpendicular there); and for a circle (e=0) it reduces tocircular_angular_momentumsqrt(mu*a)(#348). Guard mirrorssemi_latus_rectum_from_elements(a > 0,0 <= e < 1).Test
specific_angular_momentum_from_elements_is_sqrt_mu_p:a=7e6, e=0.1 -> h = sqrt(mu*6.93e6);semi_latus_rectum_from_elements(chore(deps)(deps): bump sha2 from 0.10.9 to 0.11.0 #384) —h^2 = mu*pacross three(a,e);circular_angular_momentum(feat(astro): add orbit::circular_angular_momentum (h = sqrt(mu*r)) #348) —h(a,0) = sqrt(mu*a);orbital_speed—h = r_p*v_p;a<=0,e>=1, non-finite.Free fn in
orbit.rs(reached viavalenx_astro::orbit::), nolib.rschange.valenx-astro221 lib tests (was 220);cargo clippy -p valenx-astro --all-targets -- -D warningsclean. Research-grade two-body primitive.