gemseo.disciplines.ode.ode_discipline module#
A discipline for solving ordinary differential equations (ODEs).
- class ODEDiscipline(rhs_discipline, times, time_name='time', state_names=(), initial_state_names=mappingproxy({}), initial_time_name='', final_state_names=mappingproxy({}), final_time_name='', state_trajectory_names=mappingproxy({}), return_trajectories=False, name='', termination_event_disciplines=(), solve_at_algorithm_times=False, 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:
rhs_discipline (Discipline) -- The discipline defining the right-hand side function of the ODE.
times (RealArray) -- 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 associatedrhs_discipline
outputs, passed as{state_name: output_name, ...}
. If empty, use all therhs_discipline
inputs.By default it is set to ().
initial_state_names (Mapping[str, str]) --
The names of the state variables bound to the names of the variables denoting the initial conditions. If empty, use
"state_initial"
for a state variable named"state"
.By default it is set to {}.
initial_time_name (str) --
The name of the variable for the initial time. If empty, use
f"initial_{time_name}"
.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_final"
for a state variable named"state"
.By default it is set to {}.
final_time_name (str) --
The name of the variable for the final time. If empty, use
f"final_{time_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"
for a state variable named"state"
.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
rhs_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) --
Whether to solve the ODE chosen by the algorithm.
By default it is set to False.
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.
- Raises:
ValueError -- If an expected state variable does not appear in
rhs_discipline
.
- termination_event_disciplines: Iterable[Discipline]#
The disciplines defining the stopping conditions.