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, . 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:
- is
Everything else is derived from them ([NGA] appendix B). The lines below are, in order, the second eccentricity and eqs. B-18, B-19, B-20, B-24, B-25 and B-26:
Cancellation. The closed forms for and cancel about five digits at . A first version computed with a relative error of 2.6e-11, so it no longer rounded to Table 3.6. Below the code therefore uses the series from
Check. These reproduce the printed values to their last digit:
| quantity | value (m/s², or ratio) | printed in |
|---|---|---|
| 7.334625787083e-5 | eq. B-18 | |
| 2.688041300461e-3 | eq. B-19 | |
| 9.7803253359 m/s² | Table 3.6 | |
| 9.8321849379 m/s² | Table 3.6 | |
| 1.931852652458e-3 | Table 3.6 | |
| 3.449786506841e-3 | Table 3.6 |
Formulas
-
On the ellipsoid (Somigliana, eq. 4-1):
-
As a Taylor series in height (eq. 4-3):
RocketPy uses this form. The reference values in
validation/fixtures/earth/wgs84-normal-gravity.jsongive 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 give the components and . The code rotates them into ECEF with (eq. 4-18). Eq. 4-8 is used in the equivalent form
with , which never divides by .
- comes from
atan2, so every quadrant works. - The field is undefined on the focal disc (, the equatorial plane within 522 km (324 mi) of the center). The code returns an error there.
- comes from
-
The local components are in the ENU axes at the point. is the exact normal component (eq. 4-16), and is (eq. 4-23, positive north). The length is (eq. 4-4).
- Above the ellipsoid, the vector tilts slightly toward the equator: 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 .
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)
| model | vector in | use |
|---|---|---|
constant { g_mps2 } | analytic tests; comparisons with tools that use 9.80665 | |
vertical_taylor | from eq. 4-3 at | like-for-like with RocketPy’s formula (see its flight quirks below) |
vertical | exact at | along the launch vertical |
ellipsoidal (default) | the full vector at the body’s position, rotated into | everything else |
The ellipsoidal model follows the vertical as it turns downrange: by about east-west and north-south, with the meridian radius,
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, with
, or ignore.
STANDARD_GRAVITY_MPS2 = 9.80665 is the conventional (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 matchesNormalGravity::taylor_mps2to 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 with , 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 (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 and , 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 , 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 and so ends higher than with the Earth’s rotation off, 7.0 mm (0.28 in) after 30 s; the flown fall matches both within 1%.