Skip to content

Commit c0687ed

Browse files
committed
Forward controllable status through the pressure action
refs idaholab#29602
1 parent dc0e9c8 commit c0687ed

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

modules/solid_mechanics/doc/content/source/actions/PressureAction.md

+5
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
## Description
44

55
The `Pressure` Action is used to create a set of pressure boundary conditions for a string of displacement variables; the typical use case for this action is the application of hydrostatic pressure. See the description, example use, and parameters on the [Pressure](/Pressure/index.md) action system page.
6+
7+
!alert warning
8+
When using the [Controls system](syntax/Controls/index.md) to control the active status of Pressure boundary conditions,
9+
the [Pressure.md] boundary conditions created by the `Pressure Action` cannot be controlled individually,
10+
they will all follow the same enabled/disabled status.

modules/solid_mechanics/src/actions/PressureAction.C

+27-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ PressureAction::validParams()
2727
"displacements",
2828
"The displacements appropriate for the simulation geometry and coordinate system");
2929

30-
params.addParam<std::vector<AuxVariableName>>(
31-
"save_in_disp_x", {}, "The save_in variables for x displacement");
32-
params.addParam<std::vector<AuxVariableName>>(
33-
"save_in_disp_y", {}, "The save_in variables for y displacement");
34-
params.addParam<std::vector<AuxVariableName>>(
35-
"save_in_disp_z", {}, "The save_in variables for z displacement");
36-
3730
params.addParam<Real>("factor", 1.0, "The factor to use in computing the pressure");
3831
params.addParam<bool>("use_displaced_mesh", true, "Whether to use the displaced mesh.");
3932
params.addParam<Real>("hht_alpha",
@@ -46,12 +39,31 @@ PressureAction::validParams()
4639
params.addParam<bool>("use_automatic_differentiation",
4740
false,
4841
"Flag to use automatic differentiation (AD) objects when possible");
42+
43+
// To make controlling the Pressure BCs easier
44+
params.addParam<bool>(
45+
"enable",
46+
true,
47+
"Set the enabled status of the BCs created by the Pressure action (defaults to true).");
48+
params.declareControllable("enable");
49+
50+
// Residual output
51+
params.addParam<std::vector<AuxVariableName>>(
52+
"save_in_disp_x", {}, "The save_in variables for x displacement");
53+
params.addParam<std::vector<AuxVariableName>>(
54+
"save_in_disp_y", {}, "The save_in variables for y displacement");
55+
params.addParam<std::vector<AuxVariableName>>(
56+
"save_in_disp_z", {}, "The save_in variables for z displacement");
4957
params.addParam<std::vector<TagName>>("extra_vector_tags",
5058
"The extra tags for the vectors this Kernel should fill");
5159
params.addParam<std::vector<TagName>>(
5260
"absolute_value_vector_tags",
5361
"The tags for the vectors this residual object should fill with the "
5462
"absolute value of the residual contribution");
63+
64+
params.addParamNamesToGroup(
65+
"save_in_disp_x save_in_disp_y save_in_disp_z extra_vector_tags absolute_value_vector_tags",
66+
"Residual output");
5567
return params;
5668
}
5769

@@ -90,6 +102,14 @@ PressureAction::act()
90102
params.set<Real>("alpha") =
91103
isParamValid("alpha") ? getParam<Real>("alpha") : getParam<Real>("hht_alpha");
92104

105+
// Forward control parameters
106+
if (isParamValid("control_tags"))
107+
params.set<std::vector<std::string>>("control_tags") =
108+
getParam<std::vector<std::string>>("control_tags");
109+
// Setting a reference like this in three BCs is dangerous (the three BCs can no longer
110+
// be controlled independently). So we only do this if "enable" is set explicitly
111+
params.set<bool>("enable") = getParam<bool>("enable");
112+
93113
params.set<NonlinearVariableName>("variable") = displacements[i];
94114

95115
if (_has_save_in_vars[i])

modules/solid_mechanics/test/tests/pressure/tests

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
design = 'syntax/BCs/Pressure/index.md'
1818
requirement = 'The Pressure boundary condition action shall create the objects needed to apply pressure boundary conditions on a 3D model as demonstrated by correctly computing the response of an elastic small-strain isotropic unit cube with pressure applied on three faces to create a hydrostatic pressure using the volumetric locking correction b-bar formulation.'
1919
[]
20+
[controls]
21+
type = Exodiff
22+
input = 'pressure_control_test.i'
23+
exodiff = 'pressure_control_test_out.e'
24+
issues = '#29602'
25+
design = 'syntax/BCs/Pressure/index.md'
26+
requirement = 'The system shall be able to forward control parameters from the Pressure action to the pressure boundary conditions.'
27+
[]
2028
[jacobian_3D_hex8]
2129
type = 'PetscJacobianTester'
2230
input = 'cantilever.i'

0 commit comments

Comments
 (0)