Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Kenneth-T-Moore/23ec1b571c314fdb42a9b87d1d0c9c19 to your computer and use it in GitHub Desktop.
Save Kenneth-T-Moore/23ec1b571c314fdb42a9b87d1d0c9c19 to your computer and use it in GitHub Desktop.
Two Parallel Subsystems in Series
import openmdao.api as om
prob = om.Problem()
model = prob.model
model.add_subsystem('p1', om.IndepVarComp('x', 1.0))
parallel = model.add_subsystem('parallel', om.ParallelGroup())
parallel.add_subsystem('c1', om.ExecComp(['y=-2.0*x']))
parallel2 = model.add_subsystem('parallel_copy', om.ParallelGroup())
parallel2.add_subsystem('comp1', om.ExecComp(['y=-2.0*x']))
model.add_subsystem('con', om.ExecComp('y = 3.0*x'))
model.connect("p1.x", "parallel.c1.x")
model.connect('parallel.c1.y', 'parallel_copy.comp1.x')
model.connect('parallel_copy.comp1.y', 'con.x')
prob.setup(check=True)
prob.run_model()
print('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment