Spherical harmonic gravity model.
More...
Classes |
struct | gravity_s |
| Structure for storing gravitational properties of a planet, used to compute the gravitational matrix at a location and time. More...
|
Typedefs |
typedef struct gravity_s | gravity_t |
| Structure for storing gravitational properties of a planet, used to compute the gravitational matrix at a location and time.
|
Functions |
gravity_t * | init_gravity (int z_harm, int t_harm, int spherical, double p_radius, double mu, const ml_matrix &c_dist, const ml_matrix &s_dist, const ml_matrix &j) |
| Allocate and initialize a gravity structure.
|
void | destroy_gravity (gravity_t *gravity) |
| Deallocate a gravity structure.
|
ml_matrix | compute_gravity (gravity_t *gravity, const ml_matrix &x_eci, const ml_matrix &m_eci_to_ef) |
| Compute the gravity matrix at a location and time.
|
double | total_energy_n_body (const ml_matrix &r, const ml_matrix &v, const ml_matrix &mass) |
| Compute the total energy for n bodies.
|
ml_matrix | gravity_n_body (const ml_matrix &r, const ml_matrix &mass, double eps=0) |
| Compute the gravity for n bodies.
|
ml_matrix | accel_planet (const ml_matrix &r, ml_matrix &mu, ml_matrix &rho) |
| Compute the gravity for n bodies.
|
ml_matrix | accel_planet (const ml_matrix &r, double mu, ml_matrix &rho) |
| Compute the gravity for n bodies.
|
Detailed Description
Function Documentation
gravity_t* init_gravity |
( |
int |
z_harm, |
|
|
int |
t_harm, |
|
|
int |
spherical, |
|
|
double |
p_radius, |
|
|
double |
mu, |
|
|
const ml_matrix & |
c_coef, |
|
|
const ml_matrix & |
s_coef, |
|
|
const ml_matrix & |
j |
|
) |
| |
Allocate and initialize a gravity structure.
- Parameters:
-
z_harm | Number of zonal harmonics |
t_harm | Number of tesseral harmonics |
spherical | If non-zero, include the spherical gravity term in the output force |
p_radius | Planet equatorial radius |
mu | Planet spherical gravity coefficient |
s_coef | The sine term coefficients |
c_coef | The cosine term coefficients |
j | The J coefficients |
- Returns:
- A newly allocated gravity structure. This structure should be deallocated using destroy_gravity() when it is no longer needed.
References gravity_s::c_coef, gravity_s::c_dist, gravity_s::l_coef, gravity_s::mu, gravity_s::p_radius, gravity_s::s_coef, gravity_s::s_dist, gravity_s::spherical, gravity_s::t_harm, and gravity_s::z_harm.
Deallocate a gravity structure.
- Parameters:
-
gravity | The gravity structure to be deallocated. |
ml_matrix compute_gravity |
( |
gravity_t * |
gravity, |
|
|
const ml_matrix & |
x_eci, |
|
|
const ml_matrix & |
m_eci_to_ef |
|
) |
| |
double total_energy_n_body |
( |
const ml_matrix & |
r, |
|
|
const ml_matrix & |
v, |
|
|
const ml_matrix & |
mass |
|
) |
| |
Compute the total energy for n bodies.
- Parameters:
-
x | State vector [r1;v1;r2;v2;...rn;vn] |
mass | Planet mass [m1, m2, ... mn] |
- Returns:
- total energy
ml_matrix gravity_n_body |
( |
const ml_matrix & |
r, |
|
|
const ml_matrix & |
mass, |
|
|
double |
eps |
|
) |
| |
Compute the gravity for n bodies.
- Parameters:
-
r | State vector [r1 r2 ... rn] |
mass | Planet mass [m1, m2, ... mn] |
eps | Factor to account for being too close to a gravity source |
- Returns:
- x dot
ml_matrix accel_planet |
( |
const ml_matrix & |
r, |
|
|
ml_matrix & |
mu, |
|
|
ml_matrix & |
rho |
|
) |
| |
Compute the gravity for n bodies.
- Parameters:
-
r | Vector of the spacecraft from the central body |
mu | Planet gravitational parameter(s) |
rho | Vector of the perturbing planet(s) from the central body |
ml_matrix accel_planet |
( |
const ml_matrix & |
r, |
|
|
double |
mu, |
|
|
ml_matrix & |
rho |
|
) |
| |
Compute the gravity for n bodies.
- Parameters:
-
r | Vector of the spacecraft from the central body |
mu | Planet gravitational parameter(s) |
rho | Vector of the perturbing planet(s) from the central body |