Template Function lupnt::AccelarationGravityField¶
Defined in File forces.h
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 onRealfor autodiff ordoublefor fast numerical propagation) to add the central body’s high-fidelity gravity contribution — e.g. an EGM96 Earth field or GRGM900C lunar field loaded viaReadHarmonicGravityField— oncerhas been rotated into the body-fixed frame (e.g. ITRF or MOON_PA).- Template Parameters:
T – Numeric type (
doublefor fast propagation,Realfor 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::CSn_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]