Template Function lupnt::AccelarationGravityField

Function Documentation

template<typename T>
Vector3<T> lupnt::AccelarationGravityField(const Vector3<T> &r, T GM, T R_ref, const MatrixX<T> &CS, int n_max, int m_max)

Compute the gravitational acceleration of a spherical-harmonic gravity field at a body-fixed position, via Montenbruck & Gill’s harmonic (Pines/Cunningham) recursion.

Called once per integration step by NumericalOrbitDynamics::CalcContrib (templated on Real for autodiff or double for fast numerical propagation) to add the central body’s high-fidelity gravity contribution &#8212; e.g. an EGM96 Earth field or GRGM900C lunar field loaded via ReadHarmonicGravityField &#8212; once r has been rotated into the body-fixed frame (e.g. ITRF or MOON_PA).

Template Parameters:

T – Numeric type (double for fast propagation, Real for autodiff)

Parameters:
  • r – Position vector in the body-fixed frame [m]

  • GM – Gravitational parameter of the central body [m^3/s^2]

  • R_ref – Reference radius of the gravity field model [m]

  • CS – Unnormalized spherical-harmonic coefficients (C on/above diagonal, S below), from GravityField::CS

  • n_max – Maximum degree of the spherical-harmonic expansion to evaluate

  • m_max – Maximum order of the spherical-harmonic expansion to evaluate (m_max <= n_max; m_max = 0 for zonals only)

Returns:

Gravitational acceleration in the body-fixed frame [m/s^2]