Template Function lupnt::ReadHarmonicGravityField(const std::string&, int, int, bool)

Function Documentation

template<typename T>
GravityField<T> lupnt::ReadHarmonicGravityField(const std::string &filename, int n, int m, bool normalized)

Read a harmonic gravity field from a file.

Load and unnormalize a spherical-harmonic gravity field of degree/order nxm from filename, in SI units.

Used by Body::Earth/Moon/Mars/Venus (and directly in examples/tests) to populate GravityField::CS, GM, and R for high-fidelity gravity acceleration via AccelarationGravityField. Parses a GFC-style coefficient file (POTFIELD/RECOEF records); if normalized is true, coefficients are converted to unnormalized form on load.

Parameters:
  • filename – Harmonic gravity field filename

  • n – Degree of the spherical harmonics expansion

  • m – Order of the spherical harmonics expansion

  • normalized – Whether the coefficients are normalized

  • filename – Coefficient file name, resolved via the LuPNT data path (e.g. “EGM96.cof”, “grgm900c.cof”)

  • n – Max degree to retain (must be <= the field’s stored n_max)

  • m – Max order to retain (must be <= the field’s stored m_max)

  • normalized – True if the file’s stored coefficients are normalized and should be converted to unnormalized form

Returns:

Gravity field object

Returns:

GravityField<T> with GM [m^3/s^2], R [m], and unnormalized CS coefficients up to degree/order n/m