Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make flag to optionally print/suppress aux variable creation printing #29665

Merged
merged 5 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions framework/src/actions/CommonOutputAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ CommonOutputAction::validParams()
"A list of the variables and postprocessors that should be output to the Exodus file "
"(may include Variables, ScalarVariables, and Postprocessor names).");

params.addParam<bool>("print_automatic_aux_variable_creation",
true,
"Flag to print list of aux variables created for automatic output by "
"MaterialOutputAction.");

// Add the 'execute_on' input parameter
ExecFlagEnum exec_enum = Output::getDefaultExecFlagEnum();
exec_enum = {EXEC_INITIAL, EXEC_TIMESTEP_END};
Expand Down
10 changes: 9 additions & 1 deletion framework/src/actions/MaterialOutputAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "MooseEnum.h"
#include "MooseVariableConstMonomial.h"
#include "FunctorMaterial.h"
#include "CommonOutputAction.h"

#include "libmesh/utility.h"

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

bool print_aux_creation = true;
const auto common_actions = _app.actionWarehouse().getActions<CommonOutputAction>();
mooseAssert(common_actions.size() <= 1, "Should not be more than one CommonOutputAction");
const Action * common = common_actions.empty() ? nullptr : *common_actions.begin();
if (common && !common->getParam<bool>("print_automatic_aux_variable_creation"))
print_aux_creation = false;
if (material_names.size() > 0 && print_aux_creation)
GiudGiud marked this conversation as resolved.
Show resolved Hide resolved
_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
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 not show the field variable names for outputting material data added by materials."
prereq = show_added_aux_vars
[]
[]