diff --git a/modules/solid_mechanics/doc/content/source/actions/PressureAction.md b/modules/solid_mechanics/doc/content/source/actions/PressureAction.md index 92ff9f5875b7..eddcb384d16d 100644 --- a/modules/solid_mechanics/doc/content/source/actions/PressureAction.md +++ b/modules/solid_mechanics/doc/content/source/actions/PressureAction.md @@ -3,3 +3,8 @@ ## Description 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. + +!alert warning +When using the [Controls system](syntax/Controls/index.md) to control the active status of the Pressure boundary conditions, +the [!param](/BCs/Pressure/enable) must be set explicitly in the input file AND the [Pressure.md] boundary conditions can no longer +be controlled individually, they will all follow the same enabled/disabled status. \ No newline at end of file diff --git a/modules/solid_mechanics/src/actions/PressureAction.C b/modules/solid_mechanics/src/actions/PressureAction.C index 9c01cfd892ad..9e3db597ff62 100644 --- a/modules/solid_mechanics/src/actions/PressureAction.C +++ b/modules/solid_mechanics/src/actions/PressureAction.C @@ -27,13 +27,6 @@ PressureAction::validParams() "displacements", "The displacements appropriate for the simulation geometry and coordinate system"); - params.addParam>( - "save_in_disp_x", {}, "The save_in variables for x displacement"); - params.addParam>( - "save_in_disp_y", {}, "The save_in variables for y displacement"); - params.addParam>( - "save_in_disp_z", {}, "The save_in variables for z displacement"); - params.addParam("factor", 1.0, "The factor to use in computing the pressure"); params.addParam("use_displaced_mesh", true, "Whether to use the displaced mesh."); params.addParam("hht_alpha", @@ -46,12 +39,30 @@ PressureAction::validParams() params.addParam("use_automatic_differentiation", false, "Flag to use automatic differentiation (AD) objects when possible"); + + // To make controlling the Pressure BCs easier + params.addParam( + "enable", + "Set the enabled status of the BCs created by the Pressure action (defaults to true)."); + params.declareControllable("enable"); + + // Residual output + params.addParam>( + "save_in_disp_x", {}, "The save_in variables for x displacement"); + params.addParam>( + "save_in_disp_y", {}, "The save_in variables for y displacement"); + params.addParam>( + "save_in_disp_z", {}, "The save_in variables for z displacement"); params.addParam>("extra_vector_tags", "The extra tags for the vectors this Kernel should fill"); params.addParam>( "absolute_value_vector_tags", "The tags for the vectors this residual object should fill with the " "absolute value of the residual contribution"); + + params.addParamNamesToGroup( + "save_in_disp_x save_in_disp_y save_in_disp_z extra_vector_tags absolute_value_vector_tags", + "Residual output"); return params; } @@ -90,6 +101,15 @@ PressureAction::act() params.set("alpha") = isParamValid("alpha") ? getParam("alpha") : getParam("hht_alpha"); + // Forward control parameters + if (isParamValid("control_tags")) + params.set>("control_tags") = + getParam>("control_tags"); + // Setting a reference like this in three BCs is dangerous (the three BCs can no longer + // be controlled independently). So we only do this if "enable" is set explicitly + if (isParamValid("enable")) + params.set("enable") = getParam("enable"); + params.set("variable") = displacements[i]; if (_has_save_in_vars[i]) diff --git a/modules/solid_mechanics/test/tests/pressure/tests b/modules/solid_mechanics/test/tests/pressure/tests index 016dfbb8a476..b16017eed107 100644 --- a/modules/solid_mechanics/test/tests/pressure/tests +++ b/modules/solid_mechanics/test/tests/pressure/tests @@ -17,6 +17,14 @@ design = 'syntax/BCs/Pressure/index.md' 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.' [] + [controls] + type = Exodiff + input = 'pressure_control_test.i' + exodiff = 'pressure_control_test_out.e' + issues = '#29602' + design = 'syntax/BCs/Pressure/index.md' + requirement = 'The system shall be able to forward control parameters from the Pressure action to the pressure boundary conditions.' + [] [jacobian_3D_hex8] type = 'PetscJacobianTester' input = 'cantilever.i'