23 #include <sys/types.h> 34 params.
addClassDescription(
"Adds short-cut syntax and common parameters to the Outputs block.");
38 "exodus",
false,
"Output the results using the default settings for Exodus output.");
40 "nemesis",
false,
"Output the results using the default settings for Nemesis output");
42 "console",
true,
"Output the results using the default settings for Console output");
45 "Output the scalar variable and postprocessors to a *.csv " 46 "file using the default CSV output.");
49 "Output the vector postprocessors to a *.xml " 50 "file using the default XML output.");
53 "Output Reporter values to a *.json " 54 "file using the default JSON output.");
56 "vtk",
false,
"Output the results using the default settings for VTKOutput output");
58 "xda",
false,
"Output the results using the default settings for XDA/XDR output (ascii)");
60 "xdr",
false,
"Output the results using the default settings for XDA/XDR output (binary)");
61 params.
addParam<
bool>(
"checkpoint",
false,
"Create checkpoint files using the default options.");
63 "gmv",
false,
"Output the results using the default settings for GMV output");
65 "tecplot",
false,
"Output the results using the default settings for Tecplot output");
69 "Output the scalar and postprocessor results using the default settings for GNUPlot output");
71 "solution_history",
false,
"Print a solution history file (.slh) using the default settings");
72 params.
addParam<
bool>(
"progress",
false,
"Print a progress bar");
73 params.
addParam<
bool>(
"dofmap",
false,
"Create the dof map .json output file");
74 params.
addParam<
bool>(
"controls",
false,
"Enable the screen output of Control systems.");
79 params.
addParam<
bool>(
"color",
true,
"Set to false to turn off all coloring in all outputs");
80 params.
addParam<std::string>(
"file_base",
81 "Common file base name to be utilized with all output objects");
82 params.
addParam<std::vector<std::string>>(
"output_if_base_contains",
83 "If this is supplied then output will only be done in " 84 "the case that the output base contains one of these " 85 "strings. This is helpful in outputting only a subset " 86 "of outputs when using MultiApps.");
88 "time_step_interval", 1,
"The interval (number of time steps) at which output occurs");
91 "The interval (number of time steps) at which output occurs",
92 "Deprecated, use time_step_interval");
93 params.
deprecateParam(
"interval",
"time_step_interval",
"02/01/2025");
94 params.
addParam<std::vector<Real>>(
"sync_times",
96 "Times at which the output and solution is forced to occur");
98 "minimum_time_interval", 0.0,
"The minimum simulation time between output steps");
100 "append_date",
false,
"When true the date and time are appended to the output filename.");
101 params.
addParam<std::string>(
"append_date_format",
102 "The format of the date/time to append (see " 103 "http://www.cplusplus.com/reference/ctime/" 106 params.
addParam<std::vector<VariableName>>(
109 "A list of the variables and postprocessors that should NOT be output to the Exodus " 110 "file (may include Variables, ScalarVariables, and Postprocessor names).");
111 params.
addParam<std::vector<VariableName>>(
114 "A list of the variables and postprocessors that should be output to the Exodus file " 115 "(may include Variables, ScalarVariables, and Postprocessor names).");
124 "print_perf_log",
false,
"Use perf_graph instead!",
"Use perf_graph instead!");
127 "perf_graph",
false,
"Enable printing of the performance graph to the screen (Console)");
129 params.
addParam<
bool>(
"perf_graph_live",
true,
"Enables printing of live progress messages");
131 "perf_graph_live_time_limit", 5.0,
"Time (in seconds) to wait before printing a message.");
133 "perf_graph_live_mem_limit", 100,
"Memory (in MB) to cause a message to be printed.");
135 params.
addParam<
bool>(
"print_mesh_changed_info",
137 "When true, each time the mesh is changed the mesh information is printed");
138 params.
addParam<
bool>(
"print_linear_residuals",
140 "Enable printing of linear residuals to the screen (Console)");
141 params.
addParam<
bool>(
"print_nonlinear_residuals",
143 "Enable printing of nonlinear residuals to the screen (Console)");
144 params.
addParam<
bool>(
"print_nonlinear_converged_reason",
146 "Enable/disable printing of the nonlinear solver convergence reason to the " 147 "screen. This parameter only affects the output of the third-party solver " 148 "(e.g. PETSc), not MOOSE itself.");
149 params.
addParam<
bool>(
"print_linear_converged_reason",
151 "Enable/disable printing of the linear solver convergence reason to the " 152 "screen. This parameter only affects the output of the third-party solver " 153 "(e.g. PETSc), not MOOSE itself.");
160 :
Action(params), _action_params(_action_factory.getValidParams(
"AddOutputAction"))
173 #ifdef LIBMESH_HAVE_EXODUS_API 174 if (getParam<bool>(
"exodus"))
175 create(
"Exodus",
"exodus");
177 if (getParam<bool>(
"exodus"))
178 mooseWarning(
"Exodus output requested but not enabled through libMesh");
181 #ifdef LIBMESH_HAVE_NEMESIS_API 182 if (getParam<bool>(
"nemesis"))
183 create(
"Nemesis",
"nemesis");
185 if (getParam<bool>(
"nemesis"))
186 mooseWarning(
"Nemesis output requested but not enabled through libMesh");
190 if (getParam<bool>(
"console") && !
hasConsole())
191 create(
"Console",
"console");
193 if (getParam<bool>(
"csv"))
196 if (getParam<bool>(
"xml"))
197 create(
"XMLOutput",
"xml");
199 if (getParam<bool>(
"json"))
202 #ifdef LIBMESH_HAVE_VTK 203 if (getParam<bool>(
"vtk"))
206 if (getParam<bool>(
"vtk"))
207 mooseWarning(
"VTK output requested but not enabled through libMesh");
210 if (getParam<bool>(
"xda"))
213 if (getParam<bool>(
"xdr"))
216 if (getParam<bool>(
"checkpoint"))
217 create(
"Checkpoint",
"checkpoint");
219 if (getParam<bool>(
"gmv"))
222 if (getParam<bool>(
"tecplot"))
223 create(
"Tecplot",
"tecplot");
225 if (getParam<bool>(
"gnuplot"))
226 create(
"Gnuplot",
"gnuplot");
228 if (getParam<bool>(
"solution_history"))
229 create(
"SolutionHistory",
"solution_history");
231 if (getParam<bool>(
"progress"))
232 create(
"Progress",
"progress");
234 if (getParam<bool>(
"dofmap"))
235 create(
"DOFMap",
"dofmap");
238 std::optional<std::string> from_param_name;
240 if (getParam<bool>(
"controls"))
242 from_param_name =
"controls";
247 from_param_name =
"show_controls";
251 create(
"ControlOutput", *from_param_name, from_params);
256 std::optional<std::string> from_param_name;
258 if (getParam<bool>(
"perf_graph"))
260 from_param_name =
"perf_graph";
263 else if (getParam<bool>(
"print_perf_log"))
265 from_param_name =
"print_perf_log";
270 from_param_name =
"show_controls";
274 create(
"PerfGraphOutput", *from_param_name, from_params);
277 if (!
_app.
getParam<
bool>(
"no_timing") && getParam<bool>(
"perf_graph_live"))
285 if (!getParam<bool>(
"color"))
293 if (!getParam<bool>(
"console") || (
isParamValid(
"print_nonlinear_converged_reason") &&
294 !getParam<bool>(
"print_nonlinear_converged_reason")))
297 if (!getParam<bool>(
"console") || (
isParamValid(
"print_linear_converged_reason") &&
298 !getParam<bool>(
"print_linear_converged_reason")))
307 const std::optional<std::string> & param_name,
322 params.set<std::string>(
"type") = object_type;
325 std::transform(object_type.begin(), object_type.end(), object_type.begin(), ::tolower);
328 std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<
MooseObjectAction>(
353 if (
type.compare(
"Console") == 0 && params.
get<
bool>(
"output_screen"))
InputParameters _action_params
Parameters from the action being created (AddOutputAction)
A MultiMooseEnum object to hold "execute_on" flags.
void create(std::string object_type, const std::optional< std::string > ¶m_name, const InputParameters *const from_params=nullptr)
Helper method for creating the short-cut actions.
std::list< Action * >::iterator ActionIterator
alias to hide implementation details
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
bool hasConsole()
Check if a Console object that outputs to the screen has been defined.
InputParameters & parameters()
Get the parameters of the object.
static ExecFlagEnum getDefaultExecFlagEnum()
Return an ExecFlagEnum object with the available execution flags for Output objects.
CommonOutputAction(const InputParameters ¶ms)
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
const ExecFlagType EXEC_TIMESTEP_END
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters ¶meters)
static InputParameters validParams()
Class constructor.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
static InputParameters validParams()
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
void setLiveMemoryLimit(unsigned int mem_limit)
Sert the memory limit before a message prints.
void disableNonlinearConvergedReason(FEProblemBase &fe_problem)
disable printing of the nonlinear convergence reason
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
const std::string & type() const
Get the type of this class.
const std::string & _current_task
The current action (even though we have separate instances for each action)
std::string getDocString() const
Generate a documentation string for the "execute_on" parameter.
MooseApp & _app
The MOOSE application this is associated with.
ActionFactory & _action_factory
Builds Actions.
const std::string & getMooseObjectType() const
Return the object type to be created.
const T & getParam(const std::string &name)
Retrieve a parameter for the object.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseAction("MooseApp", CommonOutputAction, "common_output")
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout.
PerfGraph & perfGraph()
Get the PerfGraph.
void associateWithParameter(const std::string ¶m_name, InputParameters ¶ms) const
Associates the object's parameters params with the input location from this Action's parameter with t...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
void setCommonParameters(const InputParameters *params_ptr)
Stores the common InputParameters object.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
const InputParameters & parameters() const
Get the parameters of the object.
ActionIterator actionBlocksWithActionEnd(const std::string &task)
void setLiveTimeLimit(Real time_limit)
Set the time limit before a message prints.
ActionIterator actionBlocksWithActionBegin(const std::string &task)
Iterators to the Actions in the warehouse.
Meta-action for creating common output object parameters This action serves two purpose, first it adds common output object parameters.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
void setLivePrintActive(bool active)
Turn on or off live printing (if timing is off then live printing will be off too) ...
void disableLinearConvergedReason(FEProblemBase &fe_problem)
disable printing of the linear convergence reason
const ExecFlagType EXEC_INITIAL