Module: sphericalHarmonicsGravityModel
-
class SphericalHarmonicsGravityModel : public GravityModel
- #include <sphericalHarmonicsGravityModel.h>
The Spherical Harmonics gravity model
Public Functions
-
std::optional<std::string> initializeParameters() override
Initialize all parameters necessary for the computation of gravity.
The attributes
muBody
andradEquator
must be set separately.Will return an error message (string) if
cBar
orsBar
were not set. Otherwise, returns an empty optional.
-
std::optional<std::string> initializeParameters(const GravBodyData&) override
Initialize all parameters necessary for the computation of gravity.
The attributes
muBody
andradEquator
are read from the givenGravBodyData
.Will return an error message (string) if
cBar
orsBar
were not set. Otherwise, returns an empty optional.
-
Eigen::Vector3d computeField(const Eigen::Vector3d &position_planetFixed) const override
Returns the gravity acceleration at a position around this body.
The position is given in the body-fixed reference frame. Likewise, the resulting acceleration should be given in the body-fixed reference frame.
-
Eigen::Vector3d computeField(const Eigen::Vector3d &position_planetFixed, size_t degree, bool include_zero_degree) const
Returns the gravity acceleration at a position around this body.
The position is given in the body-fixed reference frame. Likewise, the resulting acceleration should be given in the body-fixed reference frame.
If the given
degree
is smaller than the maximum degree stored in this class, then the field is computed using only degrees up todegree
. If the requested degree is higher than the available one, an error is thrown.If include_zero_degree is false the degree that corresponds to the spherical term (point-mass) of the gravity is ignored.
-
double computePotentialEnergy(const Eigen::Vector3d &positionWrtPlanet_N) const override
Returns the gravitational potential energy at a position around this body.
The current implementation returns the potential energy of a point-mass (the spherical harmonics coefficients of the body are ignored)
The position is given relative to the body and in the inertial reference frame.
Public Members
-
double radEquator = 0
[m] Reference radius for the planet
-
double muBody = 0
[m^3/s^2] Gravitation parameter for the planet
-
size_t maxDeg = 0
The maximum degree of Spherical Harmonics to use
A value of maxDeg greater than the size of cBar or sBar will cause an error. A value that is lower will truncate the spherical harmonics, ignoring any parameters in cBar/sBar with degree greater than maxDeg.
-
std::vector<std::vector<double>> cBar
The normalized “C” spherical harmonics coefficients
-
std::vector<std::vector<double>> sBar
The normalized “S” spherical harmonics coefficients
Private Members
-
mutable std::vector<std::vector<double>> aBar
The following parameters are used internally to compute the gravity.
They are coefficients used in the method of Pines for the gravity due to SH. For their definition, see the ‘Basilisk-GravityEffector’ documentation. [-] Eq. 61
-
std::vector<std::vector<double>> n1
[-] Eq. 63
-
std::vector<std::vector<double>> n2
[-] Eq. 64
-
std::vector<std::vector<double>> nQuot1
[-] Eq. 79
-
std::vector<std::vector<double>> nQuot2
[-] Eq. 80
-
std::optional<std::string> initializeParameters() override