gemseo / problems / ode

Hide inherited members

orbital_dynamics module

The 2-body astrodynamics problem.

Predict the motion and position of two massive objects viewed as point particles that only interact with one another using classical mechanics. This problem is treated here as a classical central force problem.

Consider the frame defined by one particle. The position \((x, y)\) and the velocity \((v_x, v_y)\) of the other particle as a function of time can be described by the following set of equations:

with \(r = \sqrt{x(t)^2 + y(t)^2}\).

We use the initial conditions:

where \(e\) is the eccentricity of the particle trajectory.

The Jacobian of the right-hand side of this ODE is:

class gemseo.problems.ode.orbital_dynamics.OrbitalDynamics(eccentricity=0.5, use_jacobian=True, state_vector=None)[source]

Bases: ODEProblem

Equations of motion of a massive point particle under the influence of a central force.

Parameters:
  • eccentricity (float) –

    The eccentricity of the particle trajectory.

    By default it is set to 0.5.

  • use_jacobian (bool) –

    Whether to use the analytical expression of the Jacobian.

    By default it is set to True.

  • state_vector (NDArray[float] | None) – The state vector \(s(t)=(x(t), y(t), \dot{x(t)}, \dot{y(t)})\) of the system.

check()

Ensure the parameters of the problem are consistent.

Raises:

ValueError – If the state and time shapes are inconsistent.

Return type:

None

check_jacobian(state_vector, approximation_mode=ApproximationMode.FINITE_DIFFERENCES, step=1e-06, error_max=1e-08)

Check if the analytical jacobian is correct.

Compare the value of the analytical jacobian to a finite-element approximation of the jacobian at user-specified points.

Parameters:
  • state_vector (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – The state vector at which the jacobian is checked.

  • approximation_mode (ApproximationMode) –

    The approximation mode.

    By default it is set to “finite_differences”.

  • step (float) –

    The step used to approximate the gradients.

    By default it is set to 1e-06.

  • error_max (float) –

    The error threshold above which the jacobian is deemed to be incorrect.

    By default it is set to 1e-08.

Raises:

ValueError – Either if the approximation method is unknown, if the shapes of the analytical and approximated Jacobian matrices are inconsistent or if the analytical gradients are wrong.

Returns:

Whether the jacobian is correct.

Return type:

None

func: Callable[[NDArray[float], NDArray[float]], NDArray[float]]

The right-hand side of the ODE.

initial_state: NDArray[float]

The initial conditions \((t_0,s_0)\) of the ODE.

integration_interval: tuple[float, float]

The interval of integration.

jac: Callable[[NDArray[float], NDArray[float]], NDArray[float]]

The Jacobian function of the right-hand side of the ODE.

result: ODEResult

The result of the ODE problem.

time_vector: NDArray[float]

The times at which the solution should be evaluated.