compute_density#

namespace saltro
namespace orbits#

Functions

bool compute_density(const Eigen::Matrix<double, 3, saltro::limits::MAX_LENGTH_TRAJ> &R, const Eigen::Matrix<double, 3, saltro::limits::MAX_LENGTH_TRAJ> &S, const int jtime_length, const int density_model, Eigen::Matrix<double, 1, saltro::limits::MAX_LENGTH_TRAJ> &rho)#

Compute atmospheric density along a trajectory using a selected model.

Dispatches atmospheric density computation to one of the available density models based on the integer selector density_model. Currently supported:

  • \(0\) → Harris–Priester model

For each trajectory sample \(k\), the density is evaluated as:

\[ \rho_k = \rho_{\text{model}}\!\left(\mathbf{R}_k, \mathbf{S}_k\right) \]

where:

  • \(\mathbf{R}_k\) is the spacecraft position vector (meters),

  • \(\mathbf{S}_k\) is the Sun direction vector at the same sample,

  • \(\rho_k\) is the atmospheric density (kg/m³).

The output is written as a row vector:

\[ \boldsymbol{\rho} = \begin{bmatrix} \rho_0 & \rho_1 & \cdots & \rho_{N-1} \end{bmatrix} \]

This function performs model selection only; the physical computation is delegated to the corresponding model implementation.

Parameters:
  • R – Spacecraft position vectors (meters). Each column corresponds to one trajectory sample.

  • S – Sun direction vectors corresponding to each trajectory sample.

  • jtime_length – Number of valid trajectory samples.

  • density_model – Integer identifier selecting the density model. Currently: 0 = Harris–Priester.

  • rho – Output atmospheric density values (kg/m³).

Returns:

True if the selected model computation succeeds for all samples, false if the model identifier is invalid or a computation fails.