Classes | Typedefs | Functions

sc_gravity.h File Reference

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_tinit_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_harmNumber of zonal harmonics
t_harmNumber of tesseral harmonics
sphericalIf non-zero, include the spherical gravity term in the output force
p_radiusPlanet equatorial radius
muPlanet spherical gravity coefficient
s_coefThe sine term coefficients
c_coefThe cosine term coefficients
jThe 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.

void destroy_gravity ( gravity_t gravity )

Deallocate a gravity structure.

Parameters:
gravityThe gravity structure to be deallocated.
ml_matrix compute_gravity ( gravity_t gravity,
const ml_matrix &  x_eci,
const ml_matrix &  m_eci_to_ef 
)
Parameters:
gravityThe gravity structure to use in the computation.
x_eciThe position matrix at which to calculate the gravity.
m_eci_to_efTransformation matrix from eci to earth fixed.
Returns:
A 3x1 matrix representing the acceleration due to gravity at the specified location and time.

References gravity_s::c_dist, gravity_s::l_coef, gravity_s::mu, gravity_s::p_radius, gravity_s::s_dist, gravity_s::spherical, gravity_s::t_harm, and gravity_s::z_harm.

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:
xState vector [r1;v1;r2;v2;...rn;vn]
massPlanet 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:
rState vector [r1 r2 ... rn]
massPlanet mass [m1, m2, ... mn]
epsFactor 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:
rVector of the spacecraft from the central body
muPlanet gravitational parameter(s)
rhoVector 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:
rVector of the spacecraft from the central body
muPlanet gravitational parameter(s)
rhoVector of the perturbing planet(s) from the central body