astrodynx.prop.custom_steps

Contents

astrodynx.prop.custom_steps#

astrodynx.prop.custom_steps(orbdyn, x0, t1, ts, solver=Tsit5(), stepsize_controller=PIDController(rtol=1e-08, atol=1e-08))[source]#

Propagate orbital state using Cowell’s method with custom output times.

This function solves the orbital dynamics differential equation and saves the solution at user-specified time points. It uses adaptive step size control for accuracy while providing output at exactly the requested times through interpolation.

Parameters:
  • orbdyn (OrbDynx) – Orbital dynamics configuration containing the differential equation terms, static arguments, and optional events.

  • x0 (ArrayLike) – (6,)Initial state vector [x, y, z, vx, vy, vz] in canonical units. Position components are in distance units, velocity components are in distance/time units.

  • t1 (DTypeLike) – Final integration time in canonical time units. Must be positive and should be >= max(ts) for complete coverage.

  • ts (ArrayLike) – Array of time points where the solution should be saved, in canonical time units. Can be irregularly spaced and does not need to include t=0 or t=t1.

  • solver (AbstractSolver) – Numerical integration method. Defaults to diffeq.Tsit5() (5th-order Runge-Kutta method).

  • stepsize_controller (AbstractStepSizeController) – Adaptive step size controller.

Return type:

Solution

Returns:

Integration solution containing
  • ts: Array of requested time points (same as input ts)

  • ys: Array of interpolated state vectors at requested times

  • stats: Integration statistics from the adaptive stepping

  • result: Integration termination status

Notes

This function is ideal when you need the orbital state at specific times (e.g., for comparison with observations, mission planning, or analysis at predetermined epochs). The integrator uses adaptive stepping internally but interpolates to provide output at exactly the requested times.

The max_steps parameter is set to None, allowing unlimited steps to ensure the integration can reach all requested time points.

If any requested time in ts is beyond t1, those points will not be computed. Ensure t1 >= max(ts) for complete coverage.

Examples

Orbital state at specific observation times:

>>> import jax.numpy as jnp
>>> from astrodynx import diffeq
>>> import astrodynx as adx
>>> def vector_field(t, x, args):
...     acc = adx.gravity.point_mass_grav(t, x, args)
...     return jnp.concatenate([x[3:], acc])
>>> orbdyn = adx.prop.OrbDynx(
...     terms=diffeq.ODETerm(vector_field),
...     args={"mu": 1.0}
... )
>>> x0 = jnp.array([1.0, 0.0, 0.0, 0.0, 1.0, 0.0])
>>> t1 = jnp.pi*2  # One orbital period
>>> obs_times = jnp.array([0.5, 1.2, 2.8, 4.1, 5.9])
>>> sol = adx.prop.custom_steps(orbdyn, x0, t1, obs_times)