OpenMDAO / dymos

Open Source Optimization of Dynamic Multidisciplinary Systems
Apache License 2.0
212 stars 67 forks source link

several dymos components are doing unnecessary unit conversions #972

Open naylor-b opened 1 year ago

naylor-b commented 1 year ago

Description

Several components (AnalyticTimeseriesOutputComp, ExplicitShootingTimeseriesComp, PseudospectralTimeseriesOutputComp, and SolveIVPTimeseriesOutputComp) have the following logic:

if input_units is None or units is None:
     ... 
else:
     self._conversion_factors[name] = unit_conversion(input_units, units)

Later, unit conversion is done if name is found in self._conversion_factors. This results in unnecessary unit conversions in cases where units and input_units are the same.

GaussLobattoInterleaveComp also seems to have a similar issue.

Example

I noticed this when looking through the code, but it looks like calling _add_output_configure on one of these timeseries comps with units that are the same as the src units (or if src is None) will result in unnecessary conversions.

Dymos Version

1.8.1

Relevant environment information

No response

robfalck commented 1 year ago

This is a holdover from the days before OpenMDAO supported unit conversion on constraints and objectives. We can get rid of it now.