Skip to content

Commit

Permalink
address Joshua Hansel's review comments idaholab#22068
Browse files Browse the repository at this point in the history
  • Loading branch information
YaqiWang committed Sep 15, 2022
1 parent 48f4396 commit 10a5af0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 18 deletions.
80 changes: 75 additions & 5 deletions framework/doc/content/syntax/Controls/index.md
Expand Up @@ -83,18 +83,88 @@ the syntax for a parameter name is specified as: `block/object/name`.
As shown in [controls_example] an asterisk ("*") can be substituted for any one of these three
"names", doing so allows multiple parameters to match and be controlled simultaneously.

In similar fashion, object names can be defined (e.g., as in the
[`TimePeriod`](/TimePeriod.md)) object. In this case, the general name scheme is the same
In similar fashion, object names can be requested by controls (e.g., as in the
[`TimePeriod`](/TimePeriod.md)). In this case, the general name scheme is the same
as above but the parameter name is not included.

In both cases there is an alternative form for defining an object and parameter names:
`base::object/name`. In this case "base" is the MOOSE base system that the object is derived from.
For example, `Kernel::diff/coef`.
For example, `Kernel::diff/coef`. All MOOSE "bases" are listed bellow:

- ArrayAuxKernel,
- ArrayKernel,
- AuxKernel,
- AuxScalarKernel,
- BoundaryCondition,
- Constraint,
- Damper,
- DGKernel,
- DiracKernel,
- Distribution,
- EigenKernel,
- Executioner,
- Executor,
- Function,
- FVBoundaryCondition,
- FVInterfaceKernel,
- FVKernel,
- Indicator,
- InitialCondition,
- InterfaceKernel,
- Kernel,
- LineSearch,
- Marker,
- MaterialBase,
- MeshGenerator,
- MooseMesh,
- MoosePartitioner,
- MoosePreconditioner,
- MooseVariableBase,
- MultiApp,
- NodalKernel,
- Output,
- Postprocessor,
- Predictor,
- Problem,
- RelationshipManager.,
- Reporter,
- Sampler,
- ScalarInitialCondition,
- ScalarKernel,
- Split,
- TimeIntegrator,
- TimeStepper,
- Transfer,
- UserObject,
- VectorAuxKernel,
- VectorInterfaceKernel,
- VectorKernel,
- VectorPostprocessor,

MOOSE allows objects to define a `tag` name to access its controllable parameters with their `control_tags` parameter.

!listing test/tests/controls/tag_based_naming_access/param.i
block=Postprocessors
id=controls_tags
caption=Example of the parameter control_tags.

The two postprocessors in [controls_tags] declare the same control tag `tag`.
Thus their controllable parameter `point` can be set by controls simultaneously with `tag/*/point` as in [controls_tags_use].

!listing test/tests/controls/tag_based_naming_access/param.i
block=Postprocessors
id=controls_tags_use
caption=Example of usinging the tagged controllable parameters.

!alert note
The tag name does not include the object name although the tag name is added by an object.
To access a controllable parameter, the sytax is `tag/object/name`.
Internally, MOOSE adds the input block name as a special tag name.

## Controllable Parameters Added by Actions

MOOSE also allows parameters in [Action](Action.md) to be controllable.
The procedure for making a parameter in an [Action](Action.md) controllable is the same as documented in [Creating a Controllable Parameter](syntax/Controls/index.md#sec:control-param).
MOOSE also allows parameters in [Actions](Action.md) to be controllable.
The procedure for making a parameter in an [Action](Action.md) controllable is the same as documented in [syntax/Controls/index.md#sec:control-param].
It is important that this controllable parameter must be directly connected with the parameters of MOOSE objects, such as kernels, materials, etc., using this parameter.

!listing test/src/actions/AddLotsOfDiffusion.C
Expand Down
12 changes: 1 addition & 11 deletions framework/include/actions/Action.h
Expand Up @@ -219,17 +219,7 @@ class Action : public ConsoleStreamInterface,
* Connect controllable parameter of this action with the controllable parameters of the
* objects added by this action.
* @param parameter Name of the controllable parameter of this action
* @param object_type Type of the object added by this action. Acceptable types include
* LineSearch, MooseMesh, AuxScalarKernel, AuxKernel, VectorAuxKernel,
* ArrayAuxKernel, ScalarKernel, Kernel, VectorKernel, ArrayKernel,
* EigenKernel, Executioner, FVKernel, MaterialBase, BoundaryCondition,
* MeshGenerator, Constraint, Marker, VectorPostprocessor, MoosePartitioner,
* Indicator, Postprocessor, Predictor, Problem, Transfer, DiracKernel,
* Damper, DGKernel, MultiApp, InterfaceKernel, VectorInterfaceKernel,
* UserObject, Executor, MoosePreconditioner, MooseVariableBase, Sampler,
* TimeStepper, Function, FVBoundaryCondition, Reporter, Output,
* FVInterfaceKernel, InitialCondition, ScalarInitialCondition, Distribution,
* TimeIntegrator, NodalKernel, Split, RelationshipManager.
* @param object_type Type of the object added by this action.
* @param object_name Name of the object added by this action.
* @param object_parameter Name of the parameter of the object.
*/
Expand Down
3 changes: 2 additions & 1 deletion framework/src/actions/Action.C
Expand Up @@ -186,7 +186,8 @@ Action::connectControllableParams(const std::string & parameter,
const std::string & object_parameter) const
{
MooseObjectParameterName primary_name(uniqueActionName(), parameter);
MooseObjectParameterName secondary_name(object_type, object_name, object_parameter);
auto base_type = _factory.getValidParams(object_type).get<std::string>("_moose_base");
MooseObjectParameterName secondary_name(base_type, object_name, object_parameter);
_app.getInputParameterWarehouse().addControllableParameterConnection(primary_name,
secondary_name);

Expand Down
3 changes: 2 additions & 1 deletion test/src/actions/AddLotsOfDiffusion.C
Expand Up @@ -149,7 +149,8 @@ AddLotsOfDiffusion::act()
_problem->addMaterial("GenericConstantArray", "dc", params);

// pass the control to the material by connecting them
connectControllableParams("diffusion_coefficients", "MaterialBase", "dc", "prop_value");
connectControllableParams(
"diffusion_coefficients", "GenericConstantArray", "dc", "prop_value");
}

if (getParam<bool>("add_reaction"))
Expand Down

0 comments on commit 10a5af0

Please sign in to comment.