forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request idaholab#28964 from joshuahansel/chain-controls
Added the ChainControl system
- Loading branch information
Showing
55 changed files
with
2,057 additions
and
52 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
framework/doc/content/source/actions/AddChainControlAction.md
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,5 @@ | ||
# AddChainControlAction | ||
|
||
This action adds a [ChainControl](syntax/ChainControls/index.md) to the `ControlWarehouse`. | ||
|
||
!syntax parameters /ChainControls/AddChainControlAction |
12 changes: 12 additions & 0 deletions
12
framework/doc/content/source/actions/ChainControlSetupAction.md
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,12 @@ | ||
# ChainControlSetupAction | ||
|
||
This [Action.md] is responsible for setup and checks that should occur after | ||
all [ChainControls](syntax/ChainControls/index.md) have been added. It does | ||
the following: | ||
|
||
- Checks that all requested [/ChainControlData.md] has been declared and throws | ||
an error if not. | ||
- Calls `init()` on all `ChainControls`. | ||
- Adds dependencies for each `ChainControl` on other `ChainControls` based on | ||
the dependencies of the `ChainControlData`; if the `ChainControl` depends on | ||
a `ChainControlData`, then it depends on the `ChainControl` that declared that data. |
11 changes: 11 additions & 0 deletions
11
framework/doc/content/source/base/ChainControlDataSystem.md
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,11 @@ | ||
# ChainControlDataSystem | ||
|
||
The `ChainControlDataSystem` manages [/ChainControlData.md] objects and provides | ||
interfaces to do the following: | ||
|
||
- Check if control data exists (and if it has a certain type). | ||
- Get control data | ||
- Declare control data | ||
|
||
This object is owned by [/MooseApp.md], which provides a `getChainControlDataSystem()` | ||
method to get it. |
4 changes: 4 additions & 0 deletions
4
framework/doc/content/source/chaincontrols/ChainControlData.md
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,4 @@ | ||
# ChainControlData | ||
|
||
`ChainControlData` is used in the [ChainControls system](syntax/ChainControls/index.md). | ||
Each `ChainControlData` has a unique name and some type. |
12 changes: 12 additions & 0 deletions
12
framework/doc/content/source/chaincontrols/GetFunctionValueChainControl.md
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,12 @@ | ||
# GetFunctionValueChainControl | ||
|
||
This [ChainControl](syntax/ChainControls/index.md) creates a new [/ChainControlData.md] | ||
named `<control>:value`, where `<control>` is the name of the `ChainControl` | ||
object, and it computes its value by evaluating a given [Function](syntax/Functions/index.md) | ||
at the current time and a given point in space. | ||
|
||
!syntax parameters /ChainControls/GetFunctionValueChainControl | ||
|
||
!syntax inputs /ChainControls/GetFunctionValueChainControl | ||
|
||
!syntax children /ChainControls/GetFunctionValueChainControl |
17 changes: 17 additions & 0 deletions
17
framework/doc/content/source/chaincontrols/GetPostprocessorChainControl.md
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,17 @@ | ||
# GetPostprocessorChainControl | ||
|
||
This [ChainControl](syntax/ChainControls/index.md) copies the current value of a | ||
[Postprocessor](syntax/Postprocessors/index.md) into a [/ChainControlData.md] of | ||
type `Real`. This data will be named as `<control>:value`, where `<control>` | ||
is the user-given name of the control, unless | ||
[!param](/ChainControls/GetPostprocessorChainControl/name_data_same_as_postprocessor) | ||
is set to `true`, in which case the data is named the same as the post-processor. | ||
|
||
Note that modification | ||
of this `ChainControlData` does not modify the value of the original post-processor. | ||
|
||
!syntax parameters /ChainControls/GetPostprocessorChainControl | ||
|
||
!syntax inputs /ChainControls/GetPostprocessorChainControl | ||
|
||
!syntax children /ChainControls/GetPostprocessorChainControl |
15 changes: 15 additions & 0 deletions
15
framework/doc/content/source/chaincontrols/ParsedChainControl.md
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,15 @@ | ||
# ParsedChainControl | ||
|
||
This [ChainControl](syntax/ChainControls/index.md) allows the user to specify | ||
a function expression to be parsed and evaluated to populate a new [/ChainControlData.md] | ||
named `<control>:value`, where `<control>` is the user-given name of the control. | ||
|
||
See [ChainControlParsedFunctionWrapper.md] for a list of acceptable types of | ||
values for the entries in [!param](/ChainControls/ParsedChainControl/symbol_values) | ||
and acceptable syntax for [!param](/ChainControls/ParsedChainControl/expression). | ||
|
||
!syntax parameters /ChainControls/ParsedChainControl | ||
|
||
!syntax inputs /ChainControls/ParsedChainControl | ||
|
||
!syntax children /ChainControls/ParsedChainControl |
23 changes: 23 additions & 0 deletions
23
framework/doc/content/source/chaincontrols/SetValueChainControl.md
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,23 @@ | ||
# SetValueChainControl | ||
|
||
## SetRealValueChainControl | ||
|
||
This [ChainControl](syntax/ChainControls/index.md) sets the value of one or | ||
more parameters of type `Real` from a `Real`-valued [/ChainControlData.md]. | ||
|
||
!syntax parameters /ChainControls/SetRealValueChainControl | ||
|
||
!syntax inputs /ChainControls/SetRealValueChainControl | ||
|
||
!syntax children /ChainControls/SetRealValueChainControl | ||
|
||
## SetBoolValueChainControl | ||
|
||
This [ChainControl](syntax/ChainControls/index.md) sets the value of one or | ||
more parameters of type `bool` from a `bool`-valued [/ChainControlData.md]. | ||
|
||
!syntax parameters /ChainControls/SetBoolValueChainControl | ||
|
||
!syntax inputs /ChainControls/SetBoolValueChainControl | ||
|
||
!syntax children /ChainControls/SetBoolValueChainControl |
17 changes: 17 additions & 0 deletions
17
framework/doc/content/source/functions/ChainControlParsedFunctionWrapper.md
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,17 @@ | ||
# ChainControlParsedFunctionWrapper | ||
|
||
This class wraps `libMesh::ParsedFunction` for use of various parsed | ||
[ChainControls](syntax/ChainControls/index.md). | ||
|
||
For valid syntax for the function expression, see the | ||
[function parser site](http://warp.povusers.org/FunctionParser/). | ||
|
||
The user-defined symbols may include the following: | ||
|
||
- `bool` or `Real` [/ChainControlData.md] | ||
- [Functions](syntax/Functions/index.md) | ||
- Scalar variables | ||
- Constant values | ||
|
||
Pre-defined symbols that may be used in the function expression are `x`, `y`, `z`, and `t`, | ||
representing the corresponding spatial coordinates and time value. |
16 changes: 16 additions & 0 deletions
16
framework/doc/content/source/postprocessors/ChainControlDataPostprocessor.md
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,16 @@ | ||
# ChainControlDataPostprocessor | ||
|
||
This [Postprocessor](syntax/Postprocessors/index.md) gets the current value of a | ||
[/ChainControlData.md], which may be of type `Real` or `bool`. For `bool`, | ||
a value of `true` converts to "1.0", and a value of `bool` converts to "0.0". | ||
|
||
!alert warning title=A lag may be present | ||
Within an execution step, [Controls](syntax/Controls/index.md) are executed | ||
*before* post-processors, except for `INITIAL`, so depending on the sequence | ||
of executions, a lag may be present. | ||
|
||
!syntax parameters /Postprocessors/ChainControlDataPostprocessor | ||
|
||
!syntax inputs /Postprocessors/ChainControlDataPostprocessor | ||
|
||
!syntax children /Postprocessors/ChainControlDataPostprocessor |
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,25 @@ | ||
# ChainControls System | ||
|
||
The `ChainControls` system is an extension of the [Controls system](syntax/Controls/index.md) | ||
that uses `ChainControl` objects, which instead of working directly with | ||
controllable parameters, work with an additional layer of "control data", | ||
[/ChainControlData.md]. `ChainControl` objects can do the following: | ||
|
||
- Declare new control data | ||
- Retrieve control data declared elsewhere | ||
- Change control data values | ||
- Set controllable parameters in MOOSE objects using control data | ||
|
||
The main advantage of this additional capability is to chain control operations together, | ||
which is useful for composing complex control systems. | ||
|
||
`ChainControlData` is managed by the [/ChainControlDataSystem.md]. | ||
|
||
## Objects and Associated Actions | ||
|
||
!syntax list /ChainControls objects=True actions=False subsystems=False | ||
|
||
!syntax list /ChainControls objects=False actions=False subsystems=True | ||
|
||
!syntax list /ChainControls objects=False actions=True subsystems=False | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "AddControlAction.h" | ||
|
||
/** | ||
* Adds a ChainControl to the control warehouse. | ||
*/ | ||
class AddChainControlAction : public AddControlAction | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
AddChainControlAction(const InputParameters & parameters); | ||
}; |
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,25 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "Action.h" | ||
|
||
/** | ||
* Performs various setup tasks and checks for ChainControls. | ||
*/ | ||
class ChainControlSetupAction : public Action | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
ChainControlSetupAction(const InputParameters & parameters); | ||
|
||
virtual void act() override; | ||
}; |
Oops, something went wrong.