1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Gravity: spherical, spherical harmonics (Gottlieb), tides, and relativistic terms.
//!
//! Pure-Rust port of JEOD's `models/environment/gravity/`. The crate produces
//! gravitational acceleration, the gravity-gradient tensor, and the
//! gravitational potential at a body's position, given a configured set of
//! gravity sources.
//!
//! ## Public surface
//!
//! - **Spherical (point-mass) gravity**: [`calc_spherical`], [`gravitation`],
//! and [`gravitation_with_scratch`] from [`compute`]. Output is a
//! `astrodyn_dynamics::GravityAcceleration` containing acceleration, gradient,
//! and potential — gradient and potential are filled even for the point-
//! mass case so downstream consumers (gravity-gradient torque, energy
//! diagnostics) have what they need.
//! - **Spherical harmonics**: [`calc_nonspherical`],
//! [`calc_nonspherical_typed`], [`calc_nonspherical_with_scratch`], and
//! [`GottliebScratch`] from [`spherical_harmonics_calc_nonspherical`].
//! This is the ported Gottlieb algorithm from JEOD
//! `models/environment/gravity/src/spherical_harmonics_calc_nonspherical.cc`
//! — a numerically stable normalized Legendre recursion that scales to
//! high degree and order without the underflow/overflow problems of the
//! classical formulation.
//! - **Configuration types**: [`GravitySource`], [`GravityModel`],
//! gravity-controls re-exports from [`gravity_controls`] and
//! [`spherical_harmonics_gravity_controls`], and the
//! [`SphericalHarmonicsData`] coefficient container.
//! - **Tides and relativistic corrections**: [`tides`] and [`relativistic`]
//! carry the small post-Newtonian and luni-solar tide terms.
//!
//! JEOD coefficient data lives in
//! `models/environment/gravity/data/include/earth_GGM05C.hh` (and similar
//! per-body files); [`coefficients`] contains the parsing logic that turns
//! the C++ array headers into `Vec<Vec<f64>>` C and S coefficient tables.
//! Coefficients are normalized as in JEOD; the recursion expects normalized
//! input. Pure Rust, zero Bevy dependency.
//!
//! ## Example
//!
//! Point-mass gravity at the equator of a body with Earth's `mu` should
//! point inward (toward the body's centre):
//!
//! ```
//! use astrodyn_gravity::calc_spherical;
//! use glam::DVec3;
//!
//! let mu = 3.986_004_415e14; // Earth GGM05C, m^3/s^2
//! let r = DVec3::new(6_778_137.0, 0.0, 0.0); // 400 km altitude on +X axis
//!
//! let g = calc_spherical(mu, r);
//! // Acceleration points back toward the origin (-X) at ~8.7 m/s^2.
//! assert!(g.grav_accel.x < 0.0);
//! assert!((g.grav_accel.length() - mu / r.length().powi(2)).abs() < 1e-6);
//! ```
pub use ;
pub use ;
pub use *;
pub use *;
pub use ;
pub use *;
pub use SphericalHarmonicsData;