Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Kenneth-T-Moore/ad74a6179c8dc6e6363581388e42b1c5 to your computer and use it in GitHub Desktop.
Save Kenneth-T-Moore/ad74a6179c8dc6e6363581388e42b1c5 to your computer and use it in GitHub Desktop.
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 Traj(om.Group):
def setup(self):
self.add_subsystem('burn1', Burn1(),
promotes_outputs=['*'])
def configure(self):
self.promotes('burn1', inputs=['design:x'],
src_indices=[0, 0, 0, 0], flat_src_indices=True)
prob = om.Problem(model=Traj())
prob.setup()
prob.run_model()
# builtins.ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
print('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment