pub struct NormalGravity { /* private fields */ }Expand description
The normal gravity field of a level ellipsoid, fixed by four defining parameters: a, 1/f,
GM and ω. Everything else is derived from them (NGA.STND.0036 appendix B).
Implementations§
Source§impl NormalGravity
impl NormalGravity
Sourcepub fn new(
ellipsoid: Ellipsoid,
gm_m3_s2: f64,
omega_rad_s: f64,
) -> Result<Self, CoreError>
pub fn new( ellipsoid: Ellipsoid, gm_m3_s2: f64, omega_rad_s: f64, ) -> Result<Self, CoreError>
The field of ellipsoid with geocentric gravitational constant gm_m3_s2 and angular
velocity omega_rad_s.
§Errors
CoreError::Domain unless the ellipsoid is oblate (the ellipsoidal-harmonic formulas
divide by its linear eccentricity), GM is finite and positive, ω is finite and not
negative, and the derived constants are usable: q₀ positive (it underflows for a
flattening below about 1e-200), k finite, and γ_e, γ_p finite and positive (the
equator does not spin faster than orbit).
Sourcepub fn angular_velocity_rad_s(&self) -> f64
pub fn angular_velocity_rad_s(&self) -> f64
The Earth’s angular velocity ω, rad/s.
Sourcepub fn equatorial_gravity_mps2(&self) -> f64
pub fn equatorial_gravity_mps2(&self) -> f64
Normal gravity at the equator on the ellipsoid, γ_e, m/s² (eq. B-24).
Sourcepub fn polar_gravity_mps2(&self) -> f64
pub fn polar_gravity_mps2(&self) -> f64
Normal gravity at the poles on the ellipsoid, γ_p, m/s² (eq. B-25).
Sourcepub fn somigliana_constant(&self) -> f64
pub fn somigliana_constant(&self) -> f64
Somigliana’s constant k = bγ_p/(aγ_e) − 1 (eq. B-26).
Sourcepub fn surface_mps2(&self, latitude_rad: f64) -> Result<f64, CoreError>
pub fn surface_mps2(&self, latitude_rad: f64) -> Result<f64, CoreError>
Normal gravity on the ellipsoid at geodetic latitude φ, by Somigliana’s closed formula
(eq. 4-1), m/s²:
γ = γ_e (1 + k sin²φ) / √(1 − e² sin²φ)§Errors
CoreError::Domain if |φ| > π/2 or φ is NaN, which catches degrees passed as
radians for most launch sites.
Sourcepub fn taylor_mps2(
&self,
latitude_rad: f64,
height_m: f64,
) -> Result<f64, CoreError>
pub fn taylor_mps2( &self, latitude_rad: f64, height_m: f64, ) -> Result<f64, CoreError>
Magnitude of normal gravity at geodetic latitude φ and ellipsoidal height h by the
truncated Taylor series (eq. 4-3), m/s²:
γ_h = γ [1 − (2/a)(1 + f + m − 2f sin²φ) h + (3/a²) h²]RocketPy’s gravity formula has this form. It drifts from the exact field with height:
about 3e-7 relative at 30 km and 1.4e-5 at 100 km (docs/physics/gravity.md). Prefer
NormalGravity::enu_at_mps2 unless matching an oracle that uses it.
§Errors
As NormalGravity::surface_mps2, and CoreError::Domain for a non-finite height.
Sourcepub fn ecef_mps2(&self, position_ecef_m: DVec3) -> Result<DVec3, CoreError>
pub fn ecef_mps2(&self, position_ecef_m: DVec3) -> Result<DVec3, CoreError>
The normal gravity vector at an ECEF position, resolved in ECEF, m/s². Exact closed form
in ellipsoidal-harmonic coordinates (u, β) (eqs. 4-5 to 4-13), rotated to Cartesian
components by R₁ (eq. 4-18):
u² = ½ [s + √(s² + 4E²z²)], s = x² + y² + z² − E² (4-8)
β = atan2(z √(u² + E²), u √(x² + y²)) (4-9)
w = √((u² + E² sin²β)/(u² + E²)) (4-10)
q = ½ [(1 + 3u²/E²) atan(E/u) − 3u/E] (4-11)
q′ = 3 (1 + u²/E²) [1 − (u/E) atan(E/u)] − 1 (4-13)
γ_u = −(1/w) [GM/(u² + E²) + ω²a²E/(u² + E²) (q′/q₀)(½ sin²β − 1/6)] + (1/w) ω² u cos²β
γ_β = (1/w) ω²a²/√(u² + E²) (q/q₀) sin β cos β − (1/w) ω² √(u² + E²) sin β cos βEquation 4-8 is written in the algebraically equivalent form above, which has no
division by s.
§Errors
CoreError::Domain if the position is not finite or lies on the focal disc (u = 0:
the equatorial plane within E, about 522 km, of the center).
Sourcepub fn enu_at_mps2(&self, point: Geodetic) -> Result<DVec3, CoreError>
pub fn enu_at_mps2(&self, point: Geodetic) -> Result<DVec3, CoreError>
The normal gravity vector at a geodetic position, resolved in that point’s local
East-North-Up axes, m/s². −z is the exact normal component γ_h (eq. 4-16), y is
γ_φ (eq. 4-23, positive north) and x is zero up to rounding; the length is
|γ_total| (eq. 4-4).
§Errors
CoreError::Domain if point fails Geodetic::new’s checks, or as
NormalGravity::ecef_mps2, which cannot fail for heights above −5800 km (the focal
disc lies 5856 km below the equator).
Trait Implementations§
Source§impl Clone for NormalGravity
impl Clone for NormalGravity
Source§fn clone(&self) -> NormalGravity
fn clone(&self) -> NormalGravity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NormalGravity
Source§impl Debug for NormalGravity
impl Debug for NormalGravity
Source§impl<'de> Deserialize<'de> for NormalGravity
impl<'de> Deserialize<'de> for NormalGravity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for NormalGravity
impl PartialEq for NormalGravity
Source§fn eq(&self, other: &NormalGravity) -> bool
fn eq(&self, other: &NormalGravity) -> bool
self and other values to be equal, and is used by ==.