Skip to content

Commit

Permalink
Merge pull request #29665 from tophmatthews/mat_aux_output_29664
Browse files Browse the repository at this point in the history
make flag to optionally print/suppress aux variable creation printing
  • Loading branch information
GiudGiud authored Jan 25, 2025
2 parents 7187913 + 09a6922 commit 2f3ad4f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions framework/doc/content/source/actions/MaterialOutputAction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MaterialOutputAction

!syntax description /Outputs/MaterialOutputAction

This [Action.md] is used to output the material properties computed by a [Material](syntax/Materials/index.md)
or a [FunctorMaterial](syntax/FunctorMaterials/index.md) to an auxiliary variable.
Vector, tensor, and array-valued properties can be output to variables prefixed with the component or index.

!syntax parameters /Outputs/MaterialOutputAction
9 changes: 8 additions & 1 deletion framework/src/actions/MaterialOutputAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ InputParameters
MaterialOutputAction::validParams()
{
InputParameters params = Action::validParams();
params.addClassDescription("Outputs material properties to various Outputs objects, based on the "
"parameters set in each Material");
/// A flag to tell this action whether or not to print the unsupported properties
/// Note: A derived class can set this to false, override materialOutput and output
/// a particular property that is not supported by this class.
params.addPrivateParam("print_unsupported_prop_names", true);
params.addParam<bool>("print_automatic_aux_variable_creation",
true,
"Flag to print list of aux variables created for automatic output by "
"MaterialOutputAction.");
return params;
}

Expand Down Expand Up @@ -189,7 +195,8 @@ MaterialOutputAction::act()
" to restrict the material properties to output");
_problem->addAuxVariable("MooseVariableConstMonomial", var_name, params);
}
if (material_names.size() > 0)

if (material_names.size() > 0 && getParam<bool>("print_automatic_aux_variable_creation"))
_console << COLOR_CYAN << "The following total " << material_names.size()
<< " aux variables:" << oss.str() << "\nare added for automatic output by " << type()
<< "." << COLOR_DEFAULT << std::endl;
Expand Down
1 change: 1 addition & 0 deletions framework/src/base/Moose.C
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ associateSyntaxInner(Syntax & syntax, ActionFactory & /*action_factory*/)

registerSyntax("AddOutputAction", "Outputs/*");
registerSyntax("CommonOutputAction", "Outputs");
registerSyntax("MaterialOutputAction", "Outputs");
registerSyntax("AutoCheckpointAction", "Outputs");
syntax.registerSyntaxType("Outputs/*", "OutputName");

Expand Down
9 changes: 9 additions & 0 deletions test/tests/materials/output/tests
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,13 @@
requirement = "The system shall show the field variable names for outputting material data added by materials."
prereq = warn_unsupported_types
[]
[dont_show_added_aux_vars]
type = RunApp
input = output_warning.i
cli_args = Outputs/print_automatic_aux_variable_creation=false
allow_warnings = true
absent_out = "The following total 145 aux variables:"
requirement = "The system shall be able to not show the field variable names for outputting material data added by materials."
prereq = show_added_aux_vars
[]
[]

0 comments on commit 2f3ad4f

Please sign in to comment.