Phase linking overhaul.#1203
Conversation
|
|
||
| lists_to_link.append([]) | ||
| link_vars = set() | ||
| for subsys in self.external_subsystems: |
There was a problem hiding this comment.
Should we just iterate over all subsystems (I believe that should be self.subsystems), just in case in the future we have a core subsystem use linked variables? Just a future-proofing idea while we're here
There was a problem hiding this comment.
I don't think there's any reason not to do that.
| Return a list of variable names that will be linked when this phase is connected to another | ||
| phase that shares the variable. | ||
|
|
||
| If you have an analytic phase, and you need to link an input parameter to the upstream |
There was a problem hiding this comment.
The subsystem designer will often have no knowledge of whether their subsystem will be used with an analytic phase or not, so I'm not sure how this can be used in practice
There was a problem hiding this comment.
This part of the docstring should only be in the phase builder. It doesn't apply to external subsystems. I will remove it.
| ) | ||
|
|
||
| def link_phases(self, aviary_group, phases, connect_directly=True): | ||
| def link_trajectory(self, aviary_group, phases): |
There was a problem hiding this comment.
The name change confuses me - link_trajectory makes me think there are trajectories being linked together? While link_phases made more sense to me, as it is the individual phases that are being linked together
There was a problem hiding this comment.
The configurator method doesn't actually create links between phases anymore. It just adds components and manually connects to things that are upstream or downstream of the trajectory -- stuff that isn't so generalizable. We could go with something like configure_trajectory.
Summary
Prior to this refactor, all of the phase linkages were added by custom code written independently for each problem origin (gasp, flops, solved twodof) and encapsulated in the configurators. This PR implements a general phase-linking that replaces all of these, and paves the way for a future capability of selecting the ODE individually in each phase.
get_linked_variablesmethod has been added to the phase builder base class. This method allows phases to define which variables should be linked.get_linked_variablesshould contain "initial_mass" instead of "mass".mass_direct_link.link_phasesmethod on the problem configurators has been renamed tolink_trajectory. This method now just performs any problem-specific linkage with components external to the trajectory.initial_andfinal_.Related Issues
Backwards incompatibilities
There is a possibility that your model may run a bit differently due to some scaling changes and some small differences in the resulting linkages (particularly downstream of a Breguet range phase). The new phase keys should restore some of this.
New Dependencies
None