OpenMDAO / dymos

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

Long setup times for dymos model #892

Open caksland opened 1 year ago

caksland commented 1 year ago

Task Description

This is a follow up to the stack exchange post here: https://stackoverflow.com/questions/75129083/can-i-add-or-remove-design-variables-from-a-problem-after-setup-call

The model (repo here) has an extremely long setup time that is strongly dependent on the number of nodes in the Dymos problem. The readme and stack exchange fully describes the issue. The contents of the readme is posted below. Any recommendations to address this issue would be appreciated. Thanks!

README Contents: This model is used to design a flow system. Currently, the code doesn't optimize any control or parameters values. It only converges the ODE dynamics. Run: OptLQRModel.py.

The setup times are really long and strongly dependent on the number of nodes in the phase nn. eg. when nn=5, the setup time is about ~7s. when nn=20, the setup time inceasese to ~150s. The majority of the setup time happens when transcription.configure_timeseries_outputs(self) is called in phase.py configure(self) function (149 of the 150s when nn=20)

Package versions: dymos 1.2.0 openmdao 3.16.0

NOTE 1. there is a manual bug fix that is required for the code to run. in trajectory.py, the add_parameter() function definition needs to specify None units as default: e.g. def add_parameter(self, name, units=None, val=_unspecified, desc=_unspecified, opt=False,

NOTE 2. I've also run the code in the latest version of dymos and openmdao dymos 1.6.1 openmdao 3.23.0 and the setup time is still slow. However, the optimization does not complete.

robfalck commented 1 year ago

I strongly suspect this is caused by automatic report generation in OpenMDAO. Initializing the Problem instance with reports=False will likely resolve this.