Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gravity and Earth rotation

This page covers the gravity a rocket feels, which changes with latitude and height, and the Coriolis push the spinning Earth gives it.

In short

  • What it models: the pull a rocket feels. It is WGS 84 normal gravity, the gravity of a smooth, spinning model Earth, which changes with latitude and height. It also models the Coriolis effect, the sideways push on anything that moves over the spinning Earth.
  • Sources: the NGA’s WGS 84 standard, NGA.STND.0036 (2014), chapter 4 and appendix B.
  • How well it is validated: the derived constants reproduce the standard’s printed values to their last digit. At 11 points, both poles and heights up to 200 km (124 mi) included, gravity’s strength matches the published formulas within 2e-14 relative. A reference script evaluates the formulas in 40-digit arithmetic. HPR Sim’s copy of RocketPy’s formula matches RocketPy at 8 points, to under 1e-12 relative. On NASA’s check case 1, a sphere falling 30 s with no drag, HPR Sim ends 19.51 mm (0.77 in) below the codes NASA published, whose field stops at its second term: normal gravity’s further terms account for 19.50 mm (0.77 in) of that (a free body against NASA’s check cases). No real-flight check.
  • What it leaves out: the real Earth’s gravity anomalies, typically within ±1e-4 relative. RocketPy’s formula, an option for like-for-like comparisons, differs from the exact field by 1.4e-5 relative at 100 km (62 mi).

Code and sources

Code: hpr_core::gravity and hpr_core::earth (what the flight engine uses). Source: [NGA] NGA.STND.0036_1.0.0_WGS84 (2014), chapter 4 and appendix B, pinned as wgs84-nga-stnd-0036.

Normal gravity

What normal gravity is, the WGS 84 parameters that define it, and the formulas that compute it.

What normal gravity is

Normal gravity γ is the gravity of the level ellipsoid: the attraction of the WGS 84 ellipsoid plus the centrifugal acceleration of the Earth’s rotation. It is what a body at rest on the rotating Earth feels.

  • In the Earth-fixed launch frame, the only extra inertial term is Coriolis, −2𝛀×𝐯. Adding a centrifugal term as well would count it twice.
  • Normal gravity ignores the real Earth’s gravity anomalies, typically within ±1e-4 relative (±100 mGal). A geopotential model such as EGM2008 is a later option.

Defining parameters and derived constants

The four defining parameters ([NGA] Table 3.1) are:

  • a=6378137.0m
  • 1/f=298.257223563
  • GM is 3.986004418×1014m3/s2
  • ω=7.292115×10−5rad/s

Everything else is derived from them ([NGA] appendix B). The lines below are, in order, the second eccentricity e′ and eqs. B-18, B-19, B-20, B-24, B-25 and B-26:

e′=E/b,q0=12[(1+3e′2)arctane′−3e′],q0′=3(1+1e′2)×(1−arctane′e′)−1,m=ω2a2bGM,γe=GMab(1−m−me′q0′6q0),γp=GMa2(1+me′q0′3q0),k=bγp−aγeaγe

Cancellation. The closed forms for q and q′ cancel about five digits at ε=E/u≤0.082. A first version computed k with a relative error of 2.6e-11, so it no longer rounded to Table 3.6. Below ε=0.5 the code therefore uses the series from

arctanε=∑n≥0(−1)nε2n+12n+1:
q=∑n≥1(−1)n+12nε2n+1(2n+1)(2n+3),q′=∑n≥1(−1)n+16ε2n(2n+1)(2n+3)

Check. These reproduce the printed values to their last digit:

quantityvalue (m/s², or ratio)printed in
q07.334625787083e-5eq. B-18
q0′2.688041300461e-3eq. B-19
γe9.7803253359 m/s²Table 3.6
γp9.8321849379 m/s²Table 3.6
k1.931852652458e-3Table 3.6
m3.449786506841e-3Table 3.6

Formulas

  • On the ellipsoid (Somigliana, eq. 4-1):

    γ=γe1+ksin2φ1−e2sin2φ
  • As a Taylor series in height (eq. 4-3):

    γhγ=1−2a(1+f+m−2fsin2φ)h+3a2h2

    RocketPy uses this form. The reference values in validation/fixtures/earth/wgs84-normal-gravity.json give its error against the exact field. It is 1e-8 relative at 1.4 km (0.87 mi) and 3e-7 at 30 km (19 mi). At 100 km (62 mi) it is 1.4e-5, and at 200 km (124 mi) 1.1e-4.

  • For the exact field (eqs. 4-5 to 4-13), ellipsoidal-harmonic coordinates (u,β) give the components γu and γβ. The code rotates them into ECEF with R1 (eq. 4-18). Eq. 4-8 is used in the equivalent form

    u2=12[s+s2+4E2z2],

    with s=x2+y2+z2−E2, which never divides by s.

    • β comes from atan2, so every quadrant works.
    • The field is undefined on the focal disc (u=0, the equatorial plane within 522 km (324 mi) of the center). The code returns an error there.
  • The local components are in the ENU axes at the point. −𝜸⋅𝐮ˆ is the exact normal component γh (eq. 4-16), and 𝜸⋅𝐧ˆ is γφ (eq. 4-23, positive north). The length is |𝜸total| (eq. 4-4).

    • Above the ellipsoid, the vector tilts slightly toward the equator: γφ<0 in the northern hemisphere, −8.1e-4 m/s² at 45° N and 100 km (62 mi).
    • That sign is confirmed independently. The reference script differentiates the normal potential numerically, and its value on the ellipsoid matches Table 3.6’s U0.

In the flight engine

The gravity models a flight can use, and RocketPy’s formula for like-for-like comparisons.

Gravity models for the flight engine (earth::GravityModel)

modelvector in Luse
constant { g_mps2 }(0,0,−g)analytic tests; comparisons with tools that use 9.80665
vertical_taylor(0,0,−γh) from eq. 4-3 at (φ0,h0+z)like-for-like with RocketPy’s formula (see its flight quirks below)
vertical(0,0,−|γ|) exact at (φ0,λ0,h0+z)along the launch vertical
ellipsoidal (default)the full vector at the body’s position, rotated into Leverything else

The ellipsoidal model follows the vertical as it turns downrange: by about d/(N+h) east-west and d/(M+h) north-south, with M the meridian radius,

M=a(1−e2)(1−e2sin2φ)3/2.

A test checks both at 20 km (12 mi), to 1e-4 east and 1e-3 north (the curvature changes along a meridian). Earth rotation (earth::EarthRotation) is coriolis by default, −2𝛀×𝐯 with 𝛀=ω(0,cosφ0,sinφ0), or ignore.

STANDARD_GRAVITY_MPS2 = 9.80665 is the conventional g0 (3rd CGPM, 1901; also used by the U.S. Standard Atmosphere 1976). It is a unit convention, not a model of local gravity. Loft used it as gravity, which put Loft 0.3% off RocketPy at the equator (Loft’s lesson on constant gravity).

RocketPy 1.13.0, for like-for-like cases

Recorded by validation/oracles/rocketpy/gravity.py into validation/fixtures/earth/rocketpy-gravity.json, for the validation milestone’s RocketPy comparison.

  • The formula is Somigliana (4-1) times the Taylor factor (4-3), with Table 3.6 constants (rocketpy/environment/environment.py, somigliana_gravity). It matches NormalGravity::taylor_mps2 to under 1e-12 relative.
  • A flight samples the formula at 100 points between 0 and max_expected_height (80 km (50 mi) by default). It holds the last value above that. At 45° and 100 km (62 mi) a flight uses 9.563982 m/s², where the formula gives 9.504874.
  • RocketPy feeds it height above sea level, not above the ellipsoid.
  • With no latitude given, the default of 0 gives equatorial gravity.
  • Coriolis is included as −2𝛀×𝐯 with Ω=2π/(86164.1s), in the 6-DOF and parachute equations but not in the rail phase.

Tests that pin this

  • gravity::tests::somigliana_matches_published_values (Loft’s lesson on constant gravity, and the done when of the core math, frames and Earth milestone):
    • Table 3.6 constants to their printed digits.
    • At 11 latitude/longitude/height points, including the equator, both poles, launch sites and heights up to 200 km (124 mi):
      • surface (4-1), Taylor (4-3), |γ| (4-4) and γh (4-16) within 1e-6 relative, and in fact within 2e-14 relative;
      • γφ and the ECEF vector within 1e-12 m/s².
    • The reference values come from validation/oracles/wgs84/normal_gravity.py. It evaluates the published formulas in 40-digit arithmetic and checks the constants against the tables. It also checks the vector against the gradient of the normal potential.
  • taylor_series_matches_the_rocketpy_oracle: 8 points against RocketPy’s formula.
  • exact_field_reduces_to_somigliana_on_the_ellipsoid: 37 latitudes, zero horizontal component.
  • q_functions_match_appendix_b: the printed q0 and q0′, and continuity where the series hands over to the closed form.
  • earth::tests: the models agree at the pad; the ellipsoidal model follows the vertical downrange; the Coriolis direction and magnitude.
  • cargo xtask check-cases, held by the gate where the codes’ files are fetched: NASA’s check case 1 against five codes’ published histories of a 4.4 km (2.7 mi) fall, a sixth left out. HPR Sim’s altitude ends 19.51 mm (0.77 in) lower, 137 times the codes’ spread of 0.1424 mm (0.0056 in). The codes’ gravitation stops at J2, the term for the Earth’s bulge at the equator, and the terms normal gravity holds past it account for 19.50 mm (0.77 in), which leaves at most 0.1364 mm (0.0054 in) of a kept code’s largest difference, inside the spread (a free body against NASA’s check cases). The same terms are part of the traces of cases 6 to 8, the dragged sphere, with each code’s own air.
  • hpr_sim::free_body::tests::the_coriolis_force_lifts_a_long_fall: a body dropped over the equator is carried east at Ωgt2 and so ends Ω2gt4/6 higher than with the Earth’s rotation off, 7.0 mm (0.28 in) after 30 s; the flown fall matches both within 1%.
FusionSpace HPRVersion 0.1.0Issued 2026-11-21In preparationAbout HPR Sim