Skip to main content

NormalGravity

Struct NormalGravity 

Source
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

Source

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).

Source

pub fn wgs84() -> Self

The WGS 84 normal gravity field.

Source

pub fn ellipsoid(&self) -> Ellipsoid

The reference ellipsoid.

Source

pub fn gm_m3_s2(&self) -> f64

Geocentric gravitational constant GM, m³/s².

Source

pub fn angular_velocity_rad_s(&self) -> f64

The Earth’s angular velocity ω, rad/s.

Source

pub fn equatorial_gravity_mps2(&self) -> f64

Normal gravity at the equator on the ellipsoid, γ_e, m/s² (eq. B-24).

Source

pub fn polar_gravity_mps2(&self) -> f64

Normal gravity at the poles on the ellipsoid, γ_p, m/s² (eq. B-25).

Source

pub fn somigliana_constant(&self) -> f64

Somigliana’s constant k = bγ_p/(aγ_e) − 1 (eq. B-26).

Source

pub fn m(&self) -> f64

m = ω²a²b/GM (eq. B-20).

Source

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.

Source

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.

Source

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).

Source

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

Source§

fn clone(&self) -> NormalGravity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NormalGravity

Source§

impl Debug for NormalGravity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NormalGravity

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for NormalGravity

Source§

fn eq(&self, other: &NormalGravity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for NormalGravity

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NormalGravity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.