gemseo.disciplines.ode.ode_discipline module#

A discipline for solving ordinary differential equations (ODEs).

class ODEDiscipline(discipline, times, time_name='time', state_names=(), final_state_names=mappingproxy({}), state_trajectory_names=mappingproxy({}), return_trajectories=False, name='', termination_event_disciplines=(), solve_at_algorithm_times=None, ode_solver_name='RK45', **ode_solver_settings)[source]#

Bases: Discipline

A discipline for solving ordinary differential equations (ODE).

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • discipline (Discipline) -- The discipline defining the right-hand side function of the ODE.

  • times (ArrayLike) -- Either the initial and final times or the times of interest where the state must be stored, including the initial and final times. When only initial and final times are provided, the times of interest are the instants chosen by the ODE solver to compute the state trajectories.

  • time_name (str) --

    The name of the time variable.

    By default it is set to "time".

  • state_names (Iterable[str] | Mapping[str, str]) --

    Either the names of the state variables, passed as (state_name, ...), or the names of the state variables bound to the associated discipline outputs, passed as {state_name: output_name, ...}. If empty, use all the discipline inputs.

    By default it is set to ().

  • final_state_names (Mapping[str, str]) --

    The names of the state variables bound to their names at final time. If empty, use state_name_final for a state variable named state_name.

    By default it is set to {}.

  • state_trajectory_names (Mapping[str, str]) --

    The names of the state variables bound to the names of their trajectories. If empty, use state_name_trajectory for a state variable named state_name.

    By default it is set to {}.

  • return_trajectories (bool) --

    Whether to output both the trajectories of the state variables and their values at final time. Otherwise, output only their values at final time.

    By default it is set to False.

  • name (str) --

    The name of the discipline. If empty, use the name of the class.

    By default it is set to "".

  • termination_event_disciplines (Iterable[Discipline]) --

    The disciplines encoding termination events. Each discipline must have the same inputs as discipline and only one output defined as an arrays of size 1 indicating the value of an event function. The resolution of the ODE problem stops when one of the event functions crosses the threshold 0. If empty, the integration covers the entire time interval.

    By default it is set to ().

  • solve_at_algorithm_times (bool | None) -- Whether to solve the ODE chosen by the algorithm. Otherwise, use times defined in the vector times. If None, it is initialized as False if no terminal event is considered, and True otherwise.

  • ode_solver_name (str) --

    The name of the ODE solver.

    By default it is set to "RK45".

  • **ode_solver_settings (Any) -- The settings of the ODE solver.

output_trajectory: bool#

Whether to output both the state trajectories and the states at final time.

Otherwise, output only their values at final time.