Expand description
§tpt-sci-astro
Orbital-mechanics and coordinate-frame primitives for the tpt-science
pillar, built entirely from scratch on top of the in-house tpt-math-linalg
dense linear algebra (no external astrodynamics or geometry wrappers).
The crate implements the classical two-body problem in an Earth-Centered Inertial (ECI) reference frame:
- Classical (Keplerian)
OrbitalElements, validated on construction. - Conversion between Keplerian elements and ECI Cartesian state vectors
(
OrbitalElements::state_vectorandOrbitalElements::from_state). - Time propagation via Kepler’s equation (
state -> mean anomaly -> advance -> solve -> true anomaly) inOrbitalElements::propagate. - First-order secular
J₂perturbation:OrbitalElements::propagate_j2andOrbitalElements::j2_secular_ratesgive the dominant long-term nodal regression and apsidal precession for oblate-body missions (e.g. sun-synchronous orbit design).OrbitalElements::propagate_j4/OrbitalElements::j4_secular_ratesextend this with theJ₄zonal term. - Atmospheric drag:
atmospheric_density(single-band exponential model) andOrbitalElements::propagate_drag/OrbitalElements::drag_da_dtfor secular along-track decay. - Simplified (Kozai-Lidov, quadrupole-order) third-body secular
perturbation:
OrbitalElements::third_body_secular_rates/OrbitalElements::propagate_third_body. - Cannonball solar radiation pressure with a cylindrical Earth-shadow
eclipse test:
srp_acceleration,in_earth_shadow,OrbitalElements::srp_acceleration_vector.
All angles are in radians. The model assumes an ideal point-mass central body for the pure two-body propagation; each perturbation above is an independent first-order secular add-on (not a combined integrated force model), so short-periodic oscillations are not captured and the perturbations are not accumulated together automatically.
§Examples
use tpt_math_linalg::tpt_math_linalg_dense::{DVector, DMatrix};
use tpt_sci_astro::OrbitalElements;
// A unit circular orbit about a unit-mass body.
let el = OrbitalElements::new(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0).unwrap();
let (r, _v) = el.state_vector();
assert!((r.norm() - 1.0).abs() < 1e-9);Licensed under either of MIT or Apache-2.0 at your option.
Structs§
- Orbital
Elements - A classical (Keplerian) set of orbital elements describing an elliptical orbit in an Earth-Centered Inertial (ECI) frame.
Enums§
- Astro
Error - Errors produced by the astrodynamics primitives.
Constants§
- ASTRONOMICAL_
UNIT_ KM - One astronomical unit, in km.
- EARTH_
ATM_ H0_ KM - Reference altitude (km) for
EARTH_ATM_RHO0_KG_M3/EARTH_ATM_SCALE_HEIGHT_KM. - EARTH_
ATM_ RHO0_ KG_ M3 - Reference atmospheric density (kg/m³) for the single-band exponential
Earth atmosphere model, evaluated at
EARTH_ATM_H0_KM. - EARTH_
ATM_ SCALE_ HEIGHT_ KM - Atmospheric scale height (km) for the ~400 km exponential density band
(see
EARTH_ATM_RHO0_KG_M3). - EARTH_
J2 - Earth’s second zonal harmonic
J₂(dimensionless), the leading oblateness term that drives nodal regression and apsidal precession. - EARTH_
J4 - Earth’s fourth zonal harmonic
J₄(dimensionless), the next zonal oblateness term afterJ₂. - EARTH_
MU - Gravitational parameter of the Earth, μ = GM, in km³·s⁻².
- EARTH_
RADIUS_ EQ - Earth’s equatorial radius
Rₑin km, the reference length for theJ₂perturbation (the perturbation scales as(Rₑ/p)²). - MOON_
DISTANCE_ KM - Mean Earth-Moon distance, in km.
- MOON_MU
- Gravitational parameter of the Moon,
μ_Moon = GM_Moon, in km³·s⁻². - SOLAR_
PRESSURE_ 1AU - Solar radiation pressure at 1 AU, in N/m² (solar constant / speed of light, ≈ 1361 W/m² / 2.998e8 m/s).
- SUN_MU
- Gravitational parameter of the Sun,
μ☉ = GM☉, in km³·s⁻².
Functions§
- atmospheric_
density - Exponential atmospheric density model,
ρ(h) = ρ0 · exp(-(h - h0) / H). - cross3
- Cross product of two 3-vectors,
a × b. - eccentric_
to_ true - Convert an eccentric anomaly
Eto a true anomalynufor eccentricitye. - in_
earth_ shadow - Cylindrical Earth-shadow (eclipse) test.
- perifocal_
to_ eci - The 3×3 rotation matrix
Qthat maps perifocal-frame coordinates to ECI. - solve_
kepler - Solve Kepler’s equation
M = E - e·sin(E)forEvia Newton iteration. - srp_
acceleration - Cannonball-model solar radiation pressure acceleration magnitude, in km/s².
- true_
to_ eccentric - Convert a true anomaly
nuto an eccentric anomalyEfor eccentricitye.