Created
August 21, 2020 12:53
-
-
Save Kenneth-T-Moore/ed91af38fd8cc805831d0fd9953931e6 to your computer and use it in GitHub Desktop.
Exception when promoting on a subgroup during configure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
class Burn1(om.Group): | |
def setup(self): | |
self.add_subsystem('comp1', om.ExecComp(['y1=x*2'], y1=np.ones(4), x=np.ones(4)), | |
promotes_outputs=['*']) | |
self.add_subsystem('comp2', om.ExecComp(['y2=x*2'], y2=np.ones(4), x=np.ones(4)), | |
promotes_outputs=['*']) | |
def configure(self): | |
self.promotes('comp1', inputs=[('x', 'design:x')], | |
src_indices=[0, 0, 0, 0], flat_src_indices=True) | |
self.set_input_defaults('design:x', 75.3) | |
class Phases(om.ParallelGroup): | |
def setup(self): | |
self.add_subsystem('burn1', Burn1(), | |
promotes_outputs=['*']) | |
class Traj(om.Group): | |
def setup(self): | |
self.add_subsystem('phases', Phases(), | |
promotes_outputs=['*']) | |
def configure(self): | |
# Excepton | |
self.phases.promotes('burn1', inputs=['design:x']) | |
# Works | |
#self.promotes('phases', inputs=['burn1.design:x']) | |
prob = om.Problem(model=Traj()) | |
prob.setup() | |
# builtins.RuntimeError: Phases (phases): The following group inputs, passed to set_input_defaults(), could not be found: ['burn1.design:x']. | |
prob.run_model() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment