OpenMDAO / dymos

Open Source Optimization of Dynamic Multidisciplinary Systems
Apache License 2.0
204 stars 65 forks source link

Unit ambiguity issue in Birkhoff transcription #1069

Closed kaushikponnapalli closed 4 months ago

kaushikponnapalli commented 4 months ago

Description

Using phase.set_val() does not work in Birkhoff transcription when the ODE promotes a variable in multiple locations and uses different units.

Example

In test_ex_min_time_climb.py changing line 121 from p['traj.phase0.states:h'] = phase.interp('h', [100.0, 20000.0]) to phase.set_val('states:h', phase.interp('h', [100.0, 20000.0])) causes the error RuntimeError: <model> <class Group>: The following inputs, ['traj.phases.phase0.ode_iter_group.collocation_comp.states:h', 'traj.phases.phase0.ode_iter_group.ode_all.atmos.h', 'traj.phases.phase0.ode_iter_group.ode_all.prop.max_thrust_comp.h', 'traj.phases.phase0.timeseries.timeseries_comp.input_values:h'], promoted to 'states:h', are connected but their metadata entries ['units'] differ. Call <group>.set_input_defaults('states:h', units=?), where <group> is the Group named 'traj.phases.phase0' to remove the ambiguity.

A similar error does not appear when using Radau-ps or GaussLobatto

Dymos Version

1.10.1-dev

Relevant environment information

No response

kaushikponnapalli commented 4 months ago

Resolved by OpenMDAO PR 3248