Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
naylor-b committed Aug 21, 2020
1 parent 6a7303d commit e22f7f1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions openmdao/core/tests/test_auto_ivc.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,47 @@ def configure(self):

prob.setup()
prob.run_model()

def test_src_inds_2_subs(self):
# this test passes if it doesn't raise an exception.

class RHS(om.Group):

def initialize(self):
self.options.declare('size', 1)

def setup(self):
size = self.options['size']
self.add_subsystem('comp1', om.ExecComp(['y1=x*2'], y1=np.ones(size), x=np.ones(size)),
promotes_inputs=['*'], promotes_outputs=['*'])

# Works if you comment out this comp.
self.add_subsystem('comp2', om.ExecComp(['y2=x*2'], y2=np.ones(size), x=np.ones(size)),
promotes_inputs=['*'], promotes_outputs=['*'])


class Phase(om.Group):
def setup(self):
self.add_subsystem('rhs', RHS(size=4))

def configure(self):
self.promotes('rhs', 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('src', om.ExecComp(['q = b*3']))

self.add_subsystem('phase', Phase())

self.connect('src.q', 'phase.design:x')


prob = om.Problem(model=Traj())

prob.setup()

prob.run_model()

0 comments on commit e22f7f1

Please sign in to comment.