-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Part 1 of setup refactor. #312
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c1d1b4a
First step of setup redesign
Kenneth-T-Moore c8cd4b4
First step of setup redesign
Kenneth-T-Moore 8d5c0d7
feature test
Kenneth-T-Moore bb55156
Merge branch 'master' of github.com:OpenMDAO/blue into ken2
Kenneth-T-Moore 211349c
working on doc
Kenneth-T-Moore a3d14b7
feature doc
Kenneth-T-Moore cf8a8f8
Merge branch 'master' of github.com:OpenMDAO/blue into ken2
Kenneth-T-Moore 5a672fe
cleanup
Kenneth-T-Moore cbe3981
cleanup
Kenneth-T-Moore 60faacc
Merge branch 'master' of github.com:OpenMDAO/blue into ken2
Kenneth-T-Moore 27dbbe7
Merge branch 'master' of github.com:OpenMDAO/blue into ken2
Kenneth-T-Moore 514310e
requested change to tests
Kenneth-T-Moore 55774e1
review
Kenneth-T-Moore File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
openmdao/docs/features/grouping_components/standalone_groups.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
Building Models with Standalone Groups | ||
-------------------------------------- | ||
|
||
So far we have showed how to build groups, add subsystems to them, and connect variables in your run script. You can also | ||
create custom groups that can be instantiated as part of larger models. To do this, create a new class that inherits from | ||
Group and give it one method named "setup". Inside this method, you can add subsystems, make connections, and modify the | ||
group level linear and nonlinear solvers. | ||
|
||
Here is an example where we take two Sellar models and connect them in a cycle. We also set the linear and nonlinear solvers. | ||
|
||
.. embed-code:: | ||
openmdao.test_suite.components.sellar_feature.DoubleSellar | ||
|
||
Configuring Child Subsystems | ||
---------------------------- | ||
|
||
Most of the time, the "setup" method is the only one you need to define on a group. The main exception is the case where you | ||
want to modify a solver that was set in one of your children groups. When you call add_subsystem, the system you add is | ||
instantiated, but its "setup" method is not called until after the parent group's "setup" method is finished with its | ||
execution. That means that anything you do with that subsystem (such as changing the nonlinear solver) will potentially be | ||
overwritten by the child system's setup if it is assigned there as well. | ||
|
||
To get around this timing problem, there is a second setup method called "configure" that runs after the "setup" on all | ||
subsystems has completed. While "setup" recurses from top down, "configure" recurses from bottom up, so that the highest | ||
system in the hiearchy takes precedence over all lower ones for any modifications. | ||
|
||
Here is a simple example where a lower system sets a solver, but we want to change it to a different one in the top-most | ||
system. | ||
|
||
.. embed-test:: | ||
openmdao.core.tests.test_problem.TestProblem.test_feature_system_configure | ||
|
||
Here is a reference on what you can do in each method: | ||
|
||
**setup** | ||
|
||
- Add subsystems | ||
- Issue Connections | ||
- Assign linear and nonlinear solvers at group level | ||
- Change solver settings in group | ||
- Assign Jacobians at group level | ||
- Set system execution order | ||
|
||
**configure** | ||
|
||
- Assign linear and nonlinear solvers to subsystems | ||
- Change solver settings in subsystems | ||
- Assign Jacobians to subsystems | ||
- Set execution order in subsystems | ||
|
||
.. tags:: Group, System |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should include some detail about timing here.
"You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed