27#include "libmesh/equation_systems.h"
28#include "libmesh/fe_interface.h"
36isElementalDataFEType(
const FEType & type,
const FEProblemBase & problem)
38 return EquationSystems::is_elemental_data_fe_type(type) &&
46 params.
addParam<std::vector<VariableName>>(
49 "A list of the variables and postprocessors that should NOT be output to the Exodus "
50 "file (may include Variables, ScalarVariables, and Postprocessor names).");
52 params.
addParam<std::vector<VariableName>>(
55 "A list of the variables and postprocessors that should be output to the Exodus file "
56 "(may include Variables, ScalarVariables, and Postprocessor names).");
60 "postprocessors_as_reporters",
false,
"Output Postprocessors values as Reporter values.");
61 params.
addParam<
bool>(
"vectorpostprocessors_as_reporters",
63 "Output VectorsPostprocessors vectors as Reporter values.");
70 "Conversions before output");
75 "Enable/disable the output of postprocessors",
76 "'execute_postprocessors_on' has replaced this parameter");
79 "Enable/disable the output of vector postprocessors",
80 "'execute_vector_postprocessors_on' has replaced this parameter");
83 "Enable/disable the output of the simulation information",
84 "'execute_system_information_on' has replaced this parameter");
87 "Enable/disable the output of elemental variables",
88 "'execute_elemental_on' has replaced this parameter");
91 "Enable/disable the output of nodal variables",
92 "'execute_nodal_on' has replaced this parameter");
95 "Enable/disable the output of aux scalar variables",
96 "'execute_scalars_on' has replaced this parameter");
99 "Enable/disable the output of input file information",
100 "'execute_input_on' has replaced this parameter");
109 addAdvancedOutputParams(params);
117 return MultiMooseEnum(
"nodal=0 elemental=1 scalar=2 postprocessor=3 vector_postprocessor=4 "
118 "input=5 system_information=6 reporter=7");
135 output_types = names;
145 _elemental_as_nodal(isParamValid(
"elemental_as_nodal") ? getParam<bool>(
"elemental_as_nodal")
147 _scalar_as_nodal(isParamValid(
"scalar_as_nodal") ? getParam<bool>(
"scalar_as_nodal") : false),
148 _reporter_data(_problem_ptr->getReporterData()),
149 _last_execute_time(declareRecoverableData<
std::map<
std::string, Real>>(
"last_execute_time")),
150 _postprocessors_as_reporters(getParam<bool>(
"postprocessors_as_reporters")),
151 _vectorpostprocessors_as_reporters(getParam<bool>(
"vectorpostprocessors_as_reporters"))
178 getParam<std::vector<VariableName>>(
"hide"));
187 nodal.
show.insert(elemental.
show.begin(), elemental.
show.end());
188 nodal.
hide.insert(elemental.
hide.begin(), elemental.
hide.end());
197 nodal.
show.insert(scalar.
show.begin(), scalar.
show.end());
198 nodal.
hide.insert(scalar.
hide.begin(), scalar.
hide.end());
212 mooseError(
"Individual output of nodal variables is not support for the output object named '",
221 "Individual output of elemental variables is not support for this output object named '",
229 mooseError(
"Individual output of postprocessors is not support for this output object named '",
238 "Individual output of VectorPostprocessors is not support for this output object named '",
247 "Individual output of scalars is not support for this output object named '",
name(),
"'");
254 "Output of system information is not support for this output object named '",
name(),
"'");
260 mooseError(
"Output of the input file information is not support for this output object named '",
269 "Output of the Reporter value(s) is not support for this output object named '",
name(),
"'");
360 bool execute_data_flag =
true;
365 execute_data_flag =
false;
369 execute_data_flag =
false;
425 initPostprocessorOrVectorPostprocessorLists<Postprocessor>(
"postprocessors");
432 initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>(
"vector_postprocessors");
438 for (
const auto & var_name : variables)
448 const auto & outputs = var.
getParam<std::vector<OutputName>>(
"outputs");
449 if (outputs.size() && std::find(outputs.begin(), outputs.end(),
name()) == outputs.end() &&
456 for (
unsigned int i = 0; i < var.
count(); ++i)
458 VariableName vname = var_name;
466 const auto geom_type = is_elemental_data ?
"elemental" :
"nodal";
504 std::string param_name =
"execute_";
505 param_name +=
name +
"_on";
509 input = getParam<ExecFlagEnum>(param_name);
522 const std::vector<VariableName> & hide)
526 std::set<std::string> unknown;
534 for (
const auto & var_name : show)
542 for (
unsigned int i = 0; i < var.
count(); ++i)
544 VariableName vname = var_name;
552 const auto geom_type = is_elemental_data ?
"elemental" :
"nodal";
579 _execute_data[
"vector_postprocessors"].show.insert(var_name);
580 else if ((var_name.find(
"/") != std::string::npos) &&
584 unknown.insert(var_name);
588 for (
const auto & var_name : hide)
596 for (
unsigned int i = 0; i < var.
count(); ++i)
598 VariableName vname = var_name;
606 const auto geom_type = is_elemental_data ?
"elemental" :
"nodal";
633 _execute_data[
"vector_postprocessors"].hide.insert(var_name);
634 else if ((var_name.find(
"/") != std::string::npos) &&
639 unknown.insert(var_name);
643 if (!unknown.empty())
645 std::ostringstream oss;
646 oss <<
"Output(s) do not exist (must be variable, scalar, postprocessor, or vector "
657 std::set<std::string> & hide = data.
hide;
658 std::set<std::string> & show = data.
show;
659 std::set<std::string> & avail = data.
available;
663 std::set<std::string> interface_hide_all_types;
667 std::set<std::string> interface_hide;
668 std::set_intersection(interface_hide_all_types.begin(),
669 interface_hide_all_types.end(),
672 std::inserter(interface_hide, interface_hide.begin()));
675 hide.insert(interface_hide.begin(), interface_hide.end());
687 std::set_difference(avail.begin(),
697 std::vector<std::string> tmp;
698 std::set_intersection(
699 hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
702 std::ostringstream oss;
703 oss <<
"Output(s) specified to be both shown and hidden: ";
723 "execute_nodal_on", empty_execute_on,
"Control the output of nodal variables");
731 "execute_elemental_on", empty_execute_on,
"Control the output of elemental variables");
735 params.
addParam<
bool>(
"output_material_properties",
737 "Flag indicating if material properties should be output");
738 params.
addParam<std::vector<std::string>>(
739 "show_material_properties",
740 "List of material properties that should be written to the output");
741 params.
addParamNamesToGroup(
"output_material_properties show_material_properties",
"Materials");
745 "output_extra_element_ids",
747 "Flag indicating if extra element ids defined on the mesh should be outputted");
748 params.
addParam<std::vector<std::string>>(
749 "extra_element_ids_to_output",
750 "List of extra element ids defined on the mesh that should be written to the output.");
758 "execute_scalars_on", empty_execute_on,
"Control the output of scalar variables");
765 params.
addParam<
bool>(
"scalar_as_nodal",
false,
"Output scalar variables as nodal");
773 "elemental_as_nodal",
false,
"Output elemental nonlinear variables as nodal");
781 "execute_postprocessors_on", empty_execute_on,
"Control of when postprocessors are output");
790 "Enable/disable the output of VectorPostprocessors");
792 "Selection/restriction of output");
799 "execute_reporters_on", empty_execute_on,
"Control of when Reporter values are output");
807 "execute_input_on", empty_execute_on,
"Enable/disable the output of the input file");
816 "Control when the output of the simulation information occurs");
817 params.
addParamNamesToGroup(
"execute_system_information_on",
"Selection/restriction of output");
834const std::set<std::string> &
846const std::set<std::string> &
858const std::set<std::string> &
870const std::set<std::string> &
882const std::set<std::string> &
894const std::set<std::string> &
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_FORCED
const ExecFlagType EXEC_FAILED
const ExecFlagType EXEC_FINAL
virtual bool hasOutput()
Returns true if any of the other has methods return true.
bool hasReporterOutput()
Returns true if there exists Reporter for output.
bool hasOutputHelper(const std::string &name)
Helper method for checking if output types exists.
virtual void outputScalarVariables()
Performs output of scalar variables The child class must define this method to output the scalar vari...
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
void initExecutionTypes(const std::string &name, ExecFlagEnum &input)
Initialize the possible execution types.
void initAvailableLists()
Initializes the available lists for each of the output types.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
virtual void initialSetup()
Call init() method on setup.
virtual void outputSystemInformation()
bool hasElementalVariableOutput()
Returns true if there exists elemental nonlinear variables for output.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
bool hasNodalVariableOutput()
Returns true if there exists nodal nonlinear variables for output.
const bool _postprocessors_as_reporters
Flags for outputting PP/VPP data as a reporter.
bool _elemental_as_nodal
Flags to control nodal output.
bool hasPostprocessorOutput()
Returns true if there exists postprocessors for output.
AdvancedOutput(const InputParameters ¶meters)
Class constructor.
std::map< std::string, Real > & _last_execute_time
Storage for the last output time for the various output types, this is used to avoid duplicate output...
const ReporterData & _reporter_data
Storage for Reporter values.
void clearLastExecuteTime()
Clears bookkeeping used to suppress duplicate EXEC_FINAL output at the same time.
const bool _vectorpostprocessors_as_reporters
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
static InputParameters validParams()
static MultiMooseEnum getOutputTypes()
Get the supported types of output (e.g., postprocessors, etc.)
bool hasScalarOutput()
Returns true if there exists scalar variables for output.
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
void initShowHideLists(const std::vector< VariableName > &show, const std::vector< VariableName > &hide)
Parses the user-supplied input for hiding and showing variables and postprocessors into a list for ea...
bool wantOutput(const std::string &name, const ExecFlagType &type)
Handles logic for determining if a step should be output.
virtual void outputElementalVariables()
Performs output of elemental nonlinear variables The child class must define this method to output th...
virtual ~AdvancedOutput()
Class destructor.
virtual void outputReporters()
Output Reporter values.
bool hasVectorPostprocessorOutput()
Returns true if there exists VectorPostprocessors for output.
virtual void outputPostprocessors()
Performs output of postprocessors The child class must define this method to output the postprocessor...
virtual void outputVectorPostprocessors()
Performs output of VectorPostprocessors The child class must define this method to output the VectorP...
const std::set< std::string > & getVectorPostprocessorOutput()
The list of VectorPostprocessor names that are set for output.
virtual void outputInput()
Performs the output of the input file By default this method does nothing and is not called,...
virtual void init()
Populates the various data structures needed to control the output.
OutputDataWarehouse _execute_data
Storage structures for the various output types.
virtual void outputNodalVariables()
Performs output of nodal nonlinear variables The child class must define this method to output the no...
void initOutputList(OutputData &data)
Initializes the list of items to be output using the available, show, and hide lists.
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
static void addValidParams(InputParameters ¶ms, const MultiMooseEnum &types)
Method for defining the available parameters based on the types of outputs.
const OutputOnWarehouse & advancedExecuteOn() const
Get the current advanced 'execute_on' selections for display.
A MultiMooseEnum object to hold "execute_on" flags.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual std::vector< VariableName > getVariableNames()
Returns a list of all the variables in the problem (both from the NL and Aux systems.
An outputter with filename support.
static InputParameters validParams()
bool checkFilename()
Checks the filename for output Checks the output against the 'output_if_base_contians' list.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
const InputParameters & _pars
The object's parameters.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
Class for containing MooseEnum item information.
MooseApp & _app
The MOOSE application this is associated with.
const libMesh::FEType & feType() const
Get the type of finite element object.
virtual bool isArray() const
const std::string & arrayVariableComponent(const unsigned int i) const
Returns the variable name of a component of an array variable.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
This class provides an interface for common operations on field variables of both FE and FV types wit...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
void clearSetValues()
Clear the MultiMooseEnum.
void reset()
Clear existing lists for re-initialization.
bool hasShowList()
False when the show lists for all variables is empty.
void setHasShowList(bool value)
Set the show list bool.
std::map< std::string, T >::iterator end()
bool contains(const std::string &name) const
A method for testing of a key exists.
std::map< std::string, T >::iterator find(const std::string &name)
A helper warehouse class for storing the "execute_on" settings for the various output types.
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
bool _is_advanced
Flag for advanced output testing.
ExecFlagType _current_execute_flag
Current execute on flag.
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Real & _time
The current time for output purposes.
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
bool hasReporterValueByName(const ReporterName &reporter_name) const
The Reporter system is comprised of objects that can contain any number of data values.
bool doingPRefinement() const
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
GCC9 currently hits a "no type named 'value_type'" error during build if this is removed and iterator...
const MeshBase & get_mesh() const
unsigned int spatial_dimension() const
ExecFlagEnum getDefaultExecFlagEnum()
A structure for storing the various lists that contain the names of the items to be exported.
std::set< std::string > show
User-supplied list of outputs to display.
std::set< std::string > available
A list of all possible outputs.
std::set< std::string > output
A list of the outputs to write.
std::set< std::string > hide
User-supplied list of outputs to hide.