https://mooseframework.inl.gov
AdvancedOutput.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Standard includes
11 #include <math.h>
12 
13 // MOOSE includes
14 #include "AdvancedOutput.h"
15 #include "DisplacedProblem.h"
16 #include "FEProblem.h"
17 #include "FileMesh.h"
18 #include "FileOutput.h"
19 #include "InfixIterator.h"
20 #include "MooseApp.h"
21 #include "MooseUtils.h"
22 #include "MooseVariableFE.h"
23 #include "Postprocessor.h"
24 #include "Restartable.h"
25 #include "VectorPostprocessor.h"
26 
27 #include "libmesh/fe_interface.h"
28 
29 using namespace libMesh;
30 
31 // A function, only available in this file, for adding the AdvancedOutput parameters. This is
32 // used to eliminate code duplication between the difference specializations of the validParams
33 // function.
34 namespace
35 {
36 void
37 addAdvancedOutputParams(InputParameters & params)
38 {
39  // Hide/show variable output options
40  params.addParam<std::vector<VariableName>>(
41  "hide",
42  {},
43  "A list of the variables and postprocessors that should NOT be output to the Exodus "
44  "file (may include Variables, ScalarVariables, and Postprocessor names).");
45 
46  params.addParam<std::vector<VariableName>>(
47  "show",
48  {},
49  "A list of the variables and postprocessors that should be output to the Exodus file "
50  "(may include Variables, ScalarVariables, and Postprocessor names).");
51 
52  // Enable output of PP/VPP to JSON
53  params.addParam<bool>(
54  "postprocessors_as_reporters", false, "Output Postprocessors values as Reporter values.");
55  params.addParam<bool>("vectorpostprocessors_as_reporters",
56  false,
57  "Output VectorsPostprocessors vectors as Reporter values.");
58 
59  // Group for selecting the output
60  params.addParamNamesToGroup("hide show", "Selection/restriction of output");
61 
62  // Group for converting outputs
63  params.addParamNamesToGroup("postprocessors_as_reporters vectorpostprocessors_as_reporters",
64  "Conversions before output");
65 
66  // **** DEPRECATED PARAMS ****
67  params.addDeprecatedParam<bool>("output_postprocessors",
68  true,
69  "Enable/disable the output of postprocessors",
70  "'execute_postprocessors_on' has replaced this parameter");
71  params.addDeprecatedParam<bool>("execute_vector_postprocessors",
72  true,
73  "Enable/disable the output of vector postprocessors",
74  "'execute_vector_postprocessors_on' has replaced this parameter");
75  params.addDeprecatedParam<bool>("execute_system_information",
76  true,
77  "Enable/disable the output of the simulation information",
78  "'execute_system_information_on' has replaced this parameter");
79  params.addDeprecatedParam<bool>("execute_elemental_variables",
80  true,
81  "Enable/disable the output of elemental variables",
82  "'execute_elemental_on' has replaced this parameter");
83  params.addDeprecatedParam<bool>("execute_nodal_variables",
84  true,
85  "Enable/disable the output of nodal variables",
86  "'execute_nodal_on' has replaced this parameter");
87  params.addDeprecatedParam<bool>("execute_scalar_variables",
88  true,
89  "Enable/disable the output of aux scalar variables",
90  "'execute_scalars_on' has replaced this parameter");
91  params.addDeprecatedParam<bool>("execute_input",
92  true,
93  "Enable/disable the output of input file information",
94  "'execute_input_on' has replaced this parameter");
95 }
96 }
97 
100 {
101  // Get the parameters from the parent object
103  addAdvancedOutputParams(params);
104  return params;
105 }
106 
107 // Defines the output types to enable for the AdvancedOutput object
110 {
111  return MultiMooseEnum("nodal=0 elemental=1 scalar=2 postprocessor=3 vector_postprocessor=4 "
112  "input=5 system_information=6 reporter=7");
113 }
114 
115 // Enables the output types (see getOutputTypes) for an AdvancedOutput object
117 AdvancedOutput::enableOutputTypes(const std::string & names)
118 {
119  // The parameters object that will be returned
121 
122  // Get the MultiEnum of output types
123  MultiMooseEnum output_types = getOutputTypes();
124 
125  // Update the enum of output types to append
126  if (names.empty())
127  output_types = output_types.getRawNames();
128  else
129  output_types = names;
130 
131  // Add the parameters and return them
132  addValidParams(params, output_types);
133  return params;
134 }
135 
136 // Constructor
138  : FileOutput(parameters),
139  _elemental_as_nodal(isParamValid("elemental_as_nodal") ? getParam<bool>("elemental_as_nodal")
140  : false),
141  _scalar_as_nodal(isParamValid("scalar_as_nodal") ? getParam<bool>("scalar_as_nodal") : false),
142  _reporter_data(_problem_ptr->getReporterData()),
143  _postprocessors_as_reporters(getParam<bool>("postprocessors_as_reporters")),
144  _vectorpostprocessors_as_reporters(getParam<bool>("vectorpostprocessors_as_reporters"))
145 {
146  _is_advanced = true;
148 }
149 
150 void
152 {
153  init();
154 }
155 
156 void
158 {
159  // Initialize the execution flags
160  for (auto & [name, input] : _advanced_execute_on)
161  initExecutionTypes(name, input);
162 
163  // Clear existing execute information lists
165 
166  // Initialize the available output
168 
169  // Separate the hide/show list into components
170  initShowHideLists(getParam<std::vector<VariableName>>("show"),
171  getParam<std::vector<VariableName>>("hide"));
172 
173  // If 'elemental_as_nodal = true' the elemental variable names must be appended to the
174  // nodal variable names. Thus, when libMesh::EquationSystem::build_solution_vector is called
175  // it will create the correct nodal variable from the elemental
177  {
178  OutputData & nodal = _execute_data["nodal"];
179  OutputData & elemental = _execute_data["elemental"];
180  nodal.show.insert(elemental.show.begin(), elemental.show.end());
181  nodal.hide.insert(elemental.hide.begin(), elemental.hide.end());
182  nodal.available.insert(elemental.available.begin(), elemental.available.end());
183  }
184 
185  // Similarly as above, if 'scalar_as_nodal = true' append the elemental variable lists
186  if (_scalar_as_nodal)
187  {
188  OutputData & nodal = _execute_data["nodal"];
189  OutputData & scalar = _execute_data["scalars"];
190  nodal.show.insert(scalar.show.begin(), scalar.show.end());
191  nodal.hide.insert(scalar.hide.begin(), scalar.hide.end());
192  nodal.available.insert(scalar.available.begin(), scalar.available.end());
193  }
194 
195  // Initialize the show/hide/output lists for each of the types of output
196  for (auto & it : _execute_data)
197  initOutputList(it.second);
198 }
199 
201 
202 void
204 {
205  mooseError("Individual output of nodal variables is not support for the output object named '",
206  name(),
207  "'");
208 }
209 
210 void
212 {
213  mooseError(
214  "Individual output of elemental variables is not support for this output object named '",
215  name(),
216  "'");
217 }
218 
219 void
221 {
222  mooseError("Individual output of postprocessors is not support for this output object named '",
223  name(),
224  "'");
225 }
226 
227 void
229 {
230  mooseError(
231  "Individual output of VectorPostprocessors is not support for this output object named '",
232  name(),
233  "'");
234 }
235 
236 void
238 {
239  mooseError(
240  "Individual output of scalars is not support for this output object named '", name(), "'");
241 }
242 
243 void
245 {
246  mooseError(
247  "Output of system information is not support for this output object named '", name(), "'");
248 }
249 
250 void
252 {
253  mooseError("Output of the input file information is not support for this output object named '",
254  name(),
255  "'");
256 }
257 
258 void
260 {
261  mooseError(
262  "Output of the Reporter value(s) is not support for this output object named '", name(), "'");
263 }
264 
265 bool
267 {
268  if (!checkFilename())
269  return false;
270 
272  return true;
273  else
274  return Output::shouldOutput();
275 }
276 
277 void
279 {
280  const auto & type = _current_execute_flag;
281 
282  // (re)initialize the list of available items for output
283  init();
284 
285  // Call the various output types, if data exists
286  if (wantOutput("nodal", type))
287  {
289  _last_execute_time["nodal"] = _time;
290  }
291 
292  if (wantOutput("elemental", type))
293  {
295  _last_execute_time["elemental"] = _time;
296  }
297 
298  if (wantOutput("postprocessors", type))
299  {
301  _last_execute_time["postprocessors"] = _time;
302  }
303 
304  if (wantOutput("vector_postprocessors", type))
305  {
307  _last_execute_time["vector_postprocessors"] = _time;
308  }
309 
310  if (wantOutput("scalars", type))
311  {
313  _last_execute_time["scalars"] = _time;
314  }
315 
316  if (wantOutput("system_information", type))
317  {
319  _last_execute_time["system_information"] = _time;
320  }
321 
322  if (wantOutput("input", type))
323  {
324  outputInput();
325  _last_execute_time["input"] = _time;
326  }
327 
328  if (wantOutput("reporters", type))
329  {
330  outputReporters();
331  _last_execute_time["reporters"] = _time;
332  }
333 }
334 
335 bool
336 AdvancedOutput::wantOutput(const std::string & name, const ExecFlagType & type)
337 {
338  // Ignore EXEC_FORCED for system information and input, there is no reason to force this
339  if (type == EXEC_FORCED && (name == "system_information" || name == "input"))
340  return false;
341 
342  // Do not output if the 'none' is contained by the execute_on
343  if (_advanced_execute_on.contains(name) && _advanced_execute_on[name].isValueSet("none"))
344  return false;
345 
346  // Data output flag, true if data exists to be output
347  bool execute_data_flag = true;
348 
349  // Set flag to false, if the OutputData exists and the output variable list is empty
350  std::map<std::string, OutputData>::const_iterator iter = _execute_data.find(name);
351  if (iter != _execute_data.end() && iter->second.output.empty())
352  execute_data_flag = false;
353 
354  // Set flag to false, if the OutputOnWarehouse DOES NOT contain an entry
356  execute_data_flag = false;
357 
358  // Force the output, if there is something to output and the time has not been output
359  if (type == EXEC_FORCED && execute_data_flag && _last_execute_time[name] != _time)
360  return true;
361 
362  // Return true (output should occur) if three criteria are satisfied, else do not output:
363  // (1) The execute_data_flag = true (i.e, there is data to output)
364  // (2) The current output type is contained in the list of output execution types
365  // (3) The current execution time is "final" or "forced" and the data has not already been
366  // output
367  if (execute_data_flag && _advanced_execute_on[name].isValueSet(type) &&
369  return true;
370  else
371  return false;
372 }
373 
374 bool
376 {
377  // If any of the component outputs are true, then there is some output to perform
378  for (const auto & it : _advanced_execute_on)
379  if (wantOutput(it.first, type))
380  return true;
381 
382  // There is nothing to output
383  return false;
384 }
385 
386 bool
388 {
389  // Test that variables exist for output AND that output execution flags are valid
390  for (const auto & it : _execute_data)
391  if (!(it.second).output.empty() && _advanced_execute_on.contains(it.first) &&
392  _advanced_execute_on[it.first].isValid())
393  return true;
394 
395  // Test execution flags for non-variable output
396  if (_advanced_execute_on.contains("system_information") &&
397  _advanced_execute_on["system_information"].isValid())
398  return true;
399  if (_advanced_execute_on.contains("input") && _advanced_execute_on["input"].isValid())
400  return true;
401 
402  return false;
403 }
404 
405 void
407 {
408  // Initialize Postprocessor list
409  // This flag is set to true if any postprocessor has the 'outputs' parameter set, it is then used
410  // to produce an warning if postprocessor output is disabled
412  initPostprocessorOrVectorPostprocessorLists<Postprocessor>("postprocessors");
413 
414  // Initialize vector postprocessor list
415  // This flag is set to true if any vector postprocessor has the 'outputs' parameter set, it is
416  // then used
417  // to produce an warning if vector postprocessor output is disabled
419  initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>("vector_postprocessors");
420 
421  // Get a list of the available variables
422  std::vector<VariableName> variables = _problem_ptr->getVariableNames();
423 
424  // Loop through the variables and store the names in the correct available lists
425  for (const auto & var_name : variables)
426  {
427  if (_problem_ptr->hasVariable(var_name))
428  {
431 
432  const FEType type = var.feType();
433  for (unsigned int i = 0; i < var.count(); ++i)
434  {
435  VariableName vname = var_name;
436  if (var.isArray())
437  vname = var.arrayVariableComponent(i);
438 
439  // A note that if we have p-refinement we assume "worst-case" scenario that our constant
440  // monomial/monomial-vec families have been refined and we can no longer write them as
441  // elemental
442  if (type.order == CONSTANT && !_problem_ptr->havePRefinement() &&
443  type.family != MONOMIAL_VEC)
444  _execute_data["elemental"].available.insert(vname);
445  else if (FEInterface::field_type(type) == TYPE_VECTOR)
446  {
447  const auto geom_type = ((type.family == MONOMIAL_VEC) && (type.order == CONSTANT) &&
449  ? "elemental"
450  : "nodal";
451  switch (_es_ptr->get_mesh().spatial_dimension())
452  {
453  case 0:
454  case 1:
455  _execute_data[geom_type].available.insert(vname);
456  break;
457  case 2:
458  _execute_data[geom_type].available.insert(vname + "_x");
459  _execute_data[geom_type].available.insert(vname + "_y");
460  break;
461  case 3:
462  _execute_data[geom_type].available.insert(vname + "_x");
463  _execute_data[geom_type].available.insert(vname + "_y");
464  _execute_data[geom_type].available.insert(vname + "_z");
465  break;
466  }
467  }
468  else
469  _execute_data["nodal"].available.insert(vname);
470  }
471  }
472 
473  else if (_problem_ptr->hasScalarVariable(var_name))
474  _execute_data["scalars"].available.insert(var_name);
475  }
476 
477  // Initialize Reporter name list
478  for (auto && r_name : _reporter_data.getReporterNames())
479  if ((_postprocessors_as_reporters || !r_name.isPostprocessor()) &&
480  (_vectorpostprocessors_as_reporters || !r_name.isVectorPostprocessor()))
481  _execute_data["reporters"].available.insert(r_name);
482 }
483 
484 void
485 AdvancedOutput::initExecutionTypes(const std::string & name, ExecFlagEnum & input)
486 {
487  // Build the input parameter name
488  std::string param_name = "execute_";
489  param_name += name + "_on";
490 
491  // The parameters exists and has been set by the user
492  if (_pars.have_parameter<ExecFlagEnum>(param_name) && isParamValid(param_name))
493  input = getParam<ExecFlagEnum>(param_name);
494 
495  // If the parameter does not exists; set it to a state where no valid entries exists so nothing
496  // gets executed
497  else if (!_pars.have_parameter<ExecFlagEnum>(param_name))
498  {
499  input = _execute_on;
500  input.clearSetValues();
501  }
502 }
503 
504 void
505 AdvancedOutput::initShowHideLists(const std::vector<VariableName> & show,
506  const std::vector<VariableName> & hide)
507 {
508 
509  // Storage for user-supplied input that is unknown as a variable or postprocessor
510  std::set<std::string> unknown;
511 
512  // If a show hide/list exists, let the data warehouse know about it. This allows for the proper
513  // handling of output lists (see initOutputList)
514  if (show.size() > 0)
516 
517  // Populate the show lists
518  for (const auto & var_name : show)
519  {
520  if (_problem_ptr->hasVariable(var_name))
521  {
524  const FEType type = var.feType();
525  for (unsigned int i = 0; i < var.count(); ++i)
526  {
527  VariableName vname = var_name;
528  if (var.isArray())
529  vname = var.arrayVariableComponent(i);
530 
531  if (type.order == CONSTANT)
532  _execute_data["elemental"].show.insert(vname);
533  else if (FEInterface::field_type(type) == TYPE_VECTOR)
534  {
535  const auto geom_type =
536  ((type.family == MONOMIAL_VEC) && (type.order == CONSTANT)) ? "elemental" : "nodal";
537  switch (_es_ptr->get_mesh().spatial_dimension())
538  {
539  case 0:
540  case 1:
541  _execute_data[geom_type].show.insert(vname);
542  break;
543  case 2:
544  _execute_data[geom_type].show.insert(vname + "_x");
545  _execute_data[geom_type].show.insert(vname + "_y");
546  break;
547  case 3:
548  _execute_data[geom_type].show.insert(vname + "_x");
549  _execute_data[geom_type].show.insert(vname + "_y");
550  _execute_data[geom_type].show.insert(vname + "_z");
551  break;
552  }
553  }
554  else
555  _execute_data["nodal"].show.insert(vname);
556  }
557  }
558  else if (_problem_ptr->hasScalarVariable(var_name))
559  _execute_data["scalars"].show.insert(var_name);
560  else if (hasPostprocessorByName(var_name))
561  _execute_data["postprocessors"].show.insert(var_name);
562  else if (hasVectorPostprocessorByName(var_name))
563  _execute_data["vector_postprocessors"].show.insert(var_name);
564  else if ((var_name.find("/") != std::string::npos) &&
566  _execute_data["reporters"].show.insert(var_name);
567  else
568  unknown.insert(var_name);
569  }
570 
571  // Populate the hide lists
572  for (const auto & var_name : hide)
573  {
574  if (_problem_ptr->hasVariable(var_name))
575  {
578  const FEType type = var.feType();
579  for (unsigned int i = 0; i < var.count(); ++i)
580  {
581  VariableName vname = var_name;
582  if (var.isArray())
583  vname = var.arrayVariableComponent(i);
584 
585  if (type.order == CONSTANT)
586  _execute_data["elemental"].hide.insert(vname);
587  else if (FEInterface::field_type(type) == TYPE_VECTOR)
588  {
589  switch (_es_ptr->get_mesh().spatial_dimension())
590  {
591  case 0:
592  case 1:
593  _execute_data["nodal"].hide.insert(vname);
594  break;
595  case 2:
596  _execute_data["nodal"].hide.insert(vname + "_x");
597  _execute_data["nodal"].hide.insert(vname + "_y");
598  break;
599  case 3:
600  _execute_data["nodal"].hide.insert(vname + "_x");
601  _execute_data["nodal"].hide.insert(vname + "_y");
602  _execute_data["nodal"].hide.insert(vname + "_z");
603  break;
604  }
605  }
606  else
607  _execute_data["nodal"].hide.insert(vname);
608  }
609  }
610  else if (_problem_ptr->hasScalarVariable(var_name))
611  _execute_data["scalars"].hide.insert(var_name);
612  else if (hasPostprocessorByName(var_name))
613  _execute_data["postprocessors"].hide.insert(var_name);
614  else if (hasVectorPostprocessorByName(var_name))
615  _execute_data["vector_postprocessors"].hide.insert(var_name);
616  else if ((var_name.find("/") != std::string::npos) &&
618  _execute_data["reporters"].hide.insert(var_name);
619 
620  else
621  unknown.insert(var_name);
622  }
623 
624  // Error if an unknown variable or postprocessor is found
625  if (!unknown.empty())
626  {
627  std::ostringstream oss;
628  oss << "Output(s) do not exist (must be variable, scalar, postprocessor, or vector "
629  "postprocessor): ";
630  std::copy(unknown.begin(), unknown.end(), infix_ostream_iterator<std::string>(oss, " "));
631  mooseError(oss.str());
632  }
633 }
634 
635 void
637 {
638  // References to the vectors of variable names
639  std::set<std::string> & hide = data.hide;
640  std::set<std::string> & show = data.show;
641  std::set<std::string> & avail = data.available;
642  std::set<std::string> & output = data.output;
643 
644  // Append to the hide list from OutputInterface objects
645  std::set<std::string> interface_hide;
647  hide.insert(interface_hide.begin(), interface_hide.end());
648 
649  // Both show and hide are empty and no show/hide settings were provided (show all available)
650  if (show.empty() && hide.empty() && !_execute_data.hasShowList())
651  output = avail;
652 
653  // Only hide is empty (show all the variables listed)
654  else if (!show.empty() && hide.empty())
655  output = show;
656 
657  // Only show is empty (show all except those hidden)
658  else if (show.empty() && !hide.empty())
659  std::set_difference(avail.begin(),
660  avail.end(),
661  hide.begin(),
662  hide.end(),
663  std::inserter(output, output.begin()));
664 
665  // Both hide and show are present (show all those listed)
666  else
667  {
668  // Check if variables are in both, which is invalid
669  std::vector<std::string> tmp;
670  std::set_intersection(
671  hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
672  if (!tmp.empty())
673  {
674  std::ostringstream oss;
675  oss << "Output(s) specified to be both shown and hidden: ";
676  std::copy(tmp.begin(), tmp.end(), infix_ostream_iterator<std::string>(oss, " "));
677  mooseError(oss.str());
678  }
679 
680  // Define the output variable list
681  output = show;
682  }
683 }
684 
685 void
687 {
689  empty_execute_on.addAvailableFlags(EXEC_FAILED);
690 
691  // Nodal output
692  if (types.isValueSet("nodal"))
693  {
694  params.addParam<ExecFlagEnum>(
695  "execute_nodal_on", empty_execute_on, "Control the output of nodal variables");
696  params.addParamNamesToGroup("execute_nodal_on", "Selection/restriction of output");
697  }
698 
699  // Elemental output
700  if (types.isValueSet("elemental"))
701  {
702  params.addParam<ExecFlagEnum>(
703  "execute_elemental_on", empty_execute_on, "Control the output of elemental variables");
704  params.addParamNamesToGroup("execute_elemental_on", "Selection/restriction of output");
705 
706  // Add material output control, which are output via elemental variables
707  params.addParam<bool>("output_material_properties",
708  false,
709  "Flag indicating if material properties should be output");
710  params.addParam<std::vector<std::string>>(
711  "show_material_properties",
712  "List of material properties that should be written to the output");
713  params.addParamNamesToGroup("output_material_properties show_material_properties", "Materials");
714 
715  // Add mesh extra element id control, which are output via elemental variables
716  params.addParam<bool>(
717  "output_extra_element_ids",
718  false,
719  "Flag indicating if extra element ids defined on the mesh should be outputted");
720  params.addParam<std::vector<std::string>>(
721  "extra_element_ids_to_output",
722  "List of extra element ids defined on the mesh that should be written to the output.");
723  params.addParamNamesToGroup("output_extra_element_ids extra_element_ids_to_output", "Mesh");
724  }
725 
726  // Scalar variable output
727  if (types.isValueSet("scalar"))
728  {
729  params.addParam<ExecFlagEnum>(
730  "execute_scalars_on", empty_execute_on, "Control the output of scalar variables");
731  params.addParamNamesToGroup("execute_scalars_on", "Selection/restriction of output");
732  }
733 
734  // Nodal and scalar output
735  if (types.isValueSet("nodal") && types.isValueSet("scalar"))
736  {
737  params.addParam<bool>("scalar_as_nodal", false, "Output scalar variables as nodal");
738  params.addParamNamesToGroup("scalar_as_nodal", "Conversions before output");
739  }
740 
741  // Elemental and nodal
742  if (types.isValueSet("elemental") && types.isValueSet("nodal"))
743  {
744  params.addParam<bool>(
745  "elemental_as_nodal", false, "Output elemental nonlinear variables as nodal");
746  params.addParamNamesToGroup("elemental_as_nodal", "Conversions before output");
747  }
748 
749  // Postprocessors
750  if (types.isValueSet("postprocessor"))
751  {
752  params.addParam<ExecFlagEnum>(
753  "execute_postprocessors_on", empty_execute_on, "Control of when postprocessors are output");
754  params.addParamNamesToGroup("execute_postprocessors_on", "Selection/restriction of output");
755  }
756 
757  // Vector Postprocessors
758  if (types.isValueSet("vector_postprocessor"))
759  {
760  params.addParam<ExecFlagEnum>("execute_vector_postprocessors_on",
761  empty_execute_on,
762  "Enable/disable the output of VectorPostprocessors");
763  params.addParamNamesToGroup("execute_vector_postprocessors_on",
764  "Selection/restriction of output");
765  }
766 
767  // Reporters
768  if (types.isValueSet("reporter"))
769  {
770  params.addParam<ExecFlagEnum>(
771  "execute_reporters_on", empty_execute_on, "Control of when Reporter values are output");
772  params.addParamNamesToGroup("execute_reporters_on", "Selection/restriction of output");
773  }
774 
775  // Input file
776  if (types.isValueSet("input"))
777  {
778  params.addParam<ExecFlagEnum>(
779  "execute_input_on", empty_execute_on, "Enable/disable the output of the input file");
780  params.addParamNamesToGroup("execute_input_on", "Selection/restriction of output");
781  }
782 
783  // System Information
784  if (types.isValueSet("system_information"))
785  {
786  params.addParam<ExecFlagEnum>("execute_system_information_on",
787  empty_execute_on,
788  "Control when the output of the simulation information occurs");
789  params.addParamNamesToGroup("execute_system_information_on", "Selection/restriction of output");
790  }
791 }
792 
793 bool
794 AdvancedOutput::hasOutputHelper(const std::string & name)
795 {
796  return !_execute_data[name].output.empty() && _advanced_execute_on.contains(name) &&
797  _advanced_execute_on[name].isValid() && !_advanced_execute_on[name].isValueSet("none");
798 }
799 
800 bool
802 {
803  return hasOutputHelper("nodal");
804 }
805 
806 const std::set<std::string> &
808 {
809  return _execute_data["nodal"].output;
810 }
811 
812 bool
814 {
815  return hasOutputHelper("elemental");
816 }
817 
818 const std::set<std::string> &
820 {
821  return _execute_data["elemental"].output;
822 }
823 
824 bool
826 {
827  return hasOutputHelper("scalars");
828 }
829 
830 const std::set<std::string> &
832 {
833  return _execute_data["scalars"].output;
834 }
835 
836 bool
838 {
839  return hasOutputHelper("postprocessors");
840 }
841 
842 const std::set<std::string> &
844 {
845  return _execute_data["postprocessors"].output;
846 }
847 
848 bool
850 {
851  return hasOutputHelper("vector_postprocessors");
852 }
853 
854 const std::set<std::string> &
856 {
857  return _execute_data["vector_postprocessors"].output;
858 }
859 
860 bool
862 {
863  return hasOutputHelper("reporters");
864 }
865 
866 const std::set<std::string> &
868 {
869  return _execute_data["reporters"].output;
870 }
871 
872 const OutputOnWarehouse &
874 {
875  return _advanced_execute_on;
876 }
virtual void outputVectorPostprocessors()
Performs output of VectorPostprocessors The child class must define this method to output the VectorP...
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual void outputSystemInformation()
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
std::set< std::string > output
A list of the outputs to write.
const ExecFlagType EXEC_FAILED
Definition: Moose.C:44
bool hasPostprocessorOutput()
Returns true if there exists postprocessors for output.
virtual bool hasOutput()
Returns true if any of the other has methods return true.
const libMesh::FEType & feType() const
Get the type of finite element object.
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
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...
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
Definition: Output.h:203
bool hasVectorPostprocessorOutput()
Returns true if there exists VectorPostprocessors for output.
const bool _postprocessors_as_reporters
Flags for outputting PP/VPP data as a reporter.
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
const ExecFlagType EXEC_FORCED
Definition: Moose.C:43
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
Definition: Output.h:280
AdvancedOutput(const InputParameters &parameters)
Class constructor.
virtual void outputElementalVariables()
Performs output of elemental nonlinear variables The child class must define this method to output th...
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one...
bool hasOutputHelper(const std::string &name)
Helper method for checking if output types exists.
bool _elemental_as_nodal
Flags to control nodal 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...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
OutputDataWarehouse _execute_data
Storage structures for the various output types.
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 bool shouldOutput()
Handles logic for determining if a step should be output.
virtual ~AdvancedOutput()
Class destructor.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:82
This class provides an interface for common operations on field variables of both FE and FV types wit...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const std::set< std::string > & getVectorPostprocessorOutput()
The list of VectorPostprocessor names that are set for output.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
A structure for storing the various lists that contain the names of the items to be exported...
void initOutputList(OutputData &data)
Initializes the list of items to be output using the available, show, and hide lists.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
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...
InputParameters emptyInputParameters()
MONOMIAL_VEC
virtual void outputScalarVariables()
Performs output of scalar variables The child class must define this method to output the scalar vari...
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
Definition: MooseUtils.C:1067
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
Definition: Output.C:277
const OutputOnWarehouse & advancedExecuteOn() const
Get the current advanced &#39;execute_on&#39; selections for display.
void initAvailableLists()
Initializes the available lists for each of the output types.
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
bool hasShowList()
False when the show lists for all variables is empty.
CONSTANT
virtual std::vector< VariableName > getVariableNames()
Returns a list of all the variables in the problem (both from the NL and Aux systems.
bool hasNodalVariableOutput()
Returns true if there exists nodal nonlinear variables for output.
virtual void outputNodalVariables()
Performs output of nodal nonlinear variables The child class must define this method to output the no...
bool havePRefinement() const
Query whether p-refinement has been requested at any point during the simulation. ...
Definition: SubProblem.h:1009
void reset()
Clear existing lists for re-initialization.
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
std::set< std::string > available
A list of all possible outputs.
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
virtual void outputInput()
Performs the output of the input file By default this method does nothing and is not called...
ExecFlagType _current_execute_flag
Current execute on flag.
Definition: Output.h:211
bool contains(const std::string &name) const
A method for testing of a key exists.
const bool _vectorpostprocessors_as_reporters
static void addValidParams(InputParameters &params, const MultiMooseEnum &types)
Method for defining the available parameters based on the types of outputs.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition: Output.h:185
static InputParameters validParams()
Definition: FileOutput.C:24
virtual bool isArray() const
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
A helper warehouse class for storing the "execute_on" settings for the various output types...
bool hasScalarOutput()
Returns true if there exists scalar variables for output.
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
bool hasElementalVariableOutput()
Returns true if there exists elemental nonlinear variables for output.
std::set< std::string > hide
User-supplied list of outputs to hide.
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
Definition: ReporterData.C:62
std::map< std::string, T >::iterator end()
const ReporterData & _reporter_data
Storage for Reporter values.
bool _is_advanced
Flag for advanced output testing.
Definition: Output.h:274
bool wantOutput(const std::string &name, const ExecFlagType &type)
Handles logic for determining if a step should be output.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
virtual void outputReporters()
Output Reporter values.
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
virtual void initialSetup()
Call init() method on setup.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
virtual void outputPostprocessors()
Performs output of postprocessors The child class must define this method to output the postprocessor...
unsigned int spatial_dimension() const
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:194
const std::string & arrayVariableComponent(const unsigned int i) const
Returns the variable name of a component of an array variable.
const MeshBase & get_mesh() const
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.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
static MultiMooseEnum getOutputTypes()
Get the supported types of output (e.g., postprocessors, etc.)
const InputParameters & parameters() const
Get the parameters of the object.
std::set< std::string > show
User-supplied list of outputs to display.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
bool hasReporterOutput()
Returns true if there exists Reporter for output.
static InputParameters validParams()
An outputter with filename support.
Definition: FileOutput.h:20
bool checkFilename()
Checks the filename for output Checks the output against the &#39;output_if_base_contians&#39; list...
Definition: FileOutput.C:88
void initExecutionTypes(const std::string &name, ExecFlagEnum &input)
Initialize the possible execution types.
TYPE_VECTOR
std::map< std::string, T >::iterator find(const std::string &name)
const ExecFlagType EXEC_FINAL
Definition: Moose.C:42
Real & _time
The current time for output purposes.
Definition: Output.h:214
void clearSetValues()
Clear the MultiMooseEnum.
bool hasReporterValueByName(const ReporterName &reporter_name) const
The Reporter system is comprised of objects that can contain any number of data values.
Definition: ReporterName.h:30
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:2381
virtual void init()
Populates the various data structures needed to control the output.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
void setHasShowList(bool value)
Set the show list bool.