Skip to content

Commit 7ab251f

Browse files
committed
Fix erasure of Integrator subsystems
1 parent 82bdf26 commit 7ab251f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

openconcept/mission/mission_groups.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,18 @@ def _setup_procs(self, *args):
212212
# (This IntegratorGroup is never added directly to the OM model)
213213
time_units = self._oc_time_units
214214
num_nodes = self.options["num_nodes"]
215-
self.add_subsystem(
216-
"ode_integ",
217-
Integrator(time_setup="duration", method="simpson", diff_units=time_units, num_nodes=num_nodes),
218-
)
215+
try:
216+
# In OM 3.40 and later, static_mode is no longer True when this method is called, which leads to any
217+
# subsystems that are added here to later be erased. So here we force static_mode to True while we add the
218+
# Integrator subsystem to get around the issue. See https://github.com/OpenMDAO/OpenMDAO/issues/3621 for
219+
# more details
220+
self._problem_meta['static_mode'] = True
221+
self.add_subsystem(
222+
"ode_integ",
223+
Integrator(time_setup="duration", method="simpson", diff_units=time_units, num_nodes=num_nodes),
224+
)
225+
finally:
226+
self._problem_meta['static_mode'] = False
219227

220228
# Call om.Group's _setup_procs which does a lot of things as an initial phase of setup.
221229
# We pass *args because the signature of this method varies depending on the OM version.

0 commit comments

Comments
 (0)