OpenMDAO / dymos

Open Source Optimization of Dynamic Multidisciplinary Systems
Apache License 2.0
208 stars 66 forks source link

Phase subgroups #307

Closed robfalck closed 2 years ago

robfalck commented 4 years ago

Summary of Issue

Allow groups of phases to be added to trajectories. These phases will be placed into subgroups which can contain their own solvers and other group-level properties.

Issue Type

Description

Currently, phases are added to a trajectory one phase at a time. At times, certain phases in a trajectory will have circular dependencies requiring that they be run in their own Group.

Rather than forcing all phases to be run in this iterative group, this change will allow subgroups to be run in parallel with other phases.

Example

Consider the following structure

Trajectory
    Phases
        Phase1
        Group
            Phase2
            Phase3
        Phase4

This would be accomplished by doing the following

traj.add_phase('phase1', phase1) traj.add_phase(name=['phase2', 'phase3'], phase=[phase2, phase3], phase_add_kwargs=[kwargs2, kwargs3], group_name='subgroup1', **kwargs) traj.add_phase('phase4', phase4)

Proposed API:

A new method will be added to Trajectory that allows a group of phases to be added to the phases subgroup. This group will be of class Group(). All phases within that group, and the group itself, will promote all inputs and outputs.

The existing API is:

trajectory.add_phase(name, phase, **kwargs)

The new API will be:

trajectory.add_phase(name, phase, phase_add_kwargs=None, group_name=None, kwargs**)

Here the use of kwargs will be deprecated in favor of phase_add_kwargs.

When adding multiple phases simultaneously:

If group_name is provided, the add_phase method will return the Group to which the phases will be added during setup. This group will need to be cached so that it can be added to phases during setup, but still available before that so properties like solvers can be set.

Environment

N/A

robfalck commented 2 years ago

I think this issue should be moot with the introduction of proc groups in OpenMDAO.