www.mooseframework.org
AdvancedOutput.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 // A function, only available in this file, for adding the AdvancedOutput parameters. This is
28 // used to eliminate code duplication between the difference specializations of the validParams
29 // function.
30 namespace
31 {
32 void
33 addAdvancedOutputParams(InputParameters & params)
34 {
35  // Hide/show variable output options
36  params.addParam<std::vector<VariableName>>(
37  "hide",
38  {},
39  "A list of the variables and postprocessors that should NOT be output to the Exodus "
40  "file (may include Variables, ScalarVariables, and Postprocessor names).");
41 
42  params.addParam<std::vector<VariableName>>(
43  "show",
44  {},
45  "A list of the variables and postprocessors that should be output to the Exodus file "
46  "(may include Variables, ScalarVariables, and Postprocessor names).");
47 
48  // Enable output of PP/VPP to JSON
49  params.addParam<bool>(
50  "postprocessors_as_reporters", false, "Output Postprocessors values as Reporter values.");
51  params.addParam<bool>("vectorpostprocessors_as_reporters",
52  false,
53  "Output VectorsPostprocessors vectors as Reporter values.");
54 
55  // Group for selecting the output
56  params.addParamNamesToGroup("hide show", "Selection/restriction of output");
57 
58  // Group for converting outputs
59  params.addParamNamesToGroup("postprocessors_as_reporters vectorpostprocessors_as_reporters",
60  "Conversions before output");
61 
62  // **** DEPRECATED PARAMS ****
63  params.addDeprecatedParam<bool>("output_postprocessors",
64  true,
65  "Enable/disable the output of postprocessors",
66  "'execute_postprocessors_on' has replaced this parameter");
67  params.addDeprecatedParam<bool>("execute_vector_postprocessors",
68  true,
69  "Enable/disable the output of vector postprocessors",
70  "'execute_vector_postprocessors_on' has replaced this parameter");
71  params.addDeprecatedParam<bool>("execute_system_information",
72  true,
73  "Enable/disable the output of the simulation information",
74  "'execute_system_information_on' has replaced this parameter");
75  params.addDeprecatedParam<bool>("execute_elemental_variables",
76  true,
77  "Enable/disable the output of elemental variables",
78  "'execute_elemental_on' has replaced this parameter");
79  params.addDeprecatedParam<bool>("execute_nodal_variables",
80  true,
81  "Enable/disable the output of nodal variables",
82  "'execute_nodal_on' has replaced this parameter");
83  params.addDeprecatedParam<bool>("execute_scalar_variables",
84  true,
85  "Enable/disable the output of aux scalar variables",
86  "'execute_scalars_on' has replaced this parameter");
87  params.addDeprecatedParam<bool>("execute_input",
88  true,
89  "Enable/disable the output of input file information",
90  "'execute_input_on' has replaced this parameter");
91 }
92 }
93 
96 {
97  // Get the parameters from the parent object
99  addAdvancedOutputParams(params);
100  return params;
101 }
102 
103 // Defines the output types to enable for the AdvancedOutput object
106 {
107  return MultiMooseEnum("nodal=0 elemental=1 scalar=2 postprocessor=3 vector_postprocessor=4 "
108  "input=5 system_information=6 reporter=7");
109 }
110 
111 // Enables the output types (see getOutputTypes) for an AdvancedOutput object
113 AdvancedOutput::enableOutputTypes(const std::string & names)
114 {
115  // The parameters object that will be returned
117 
118  // Get the MultiEnum of output types
119  MultiMooseEnum output_types = getOutputTypes();
120 
121  // Update the enum of output types to append
122  if (names.empty())
123  output_types = output_types.getRawNames();
124  else
125  output_types = names;
126 
127  // Add the parameters and return them
128  addValidParams(params, output_types);
129  return params;
130 }
131 
132 // Constructor
134  : FileOutput(parameters),
135  _elemental_as_nodal(isParamValid("elemental_as_nodal") ? getParam<bool>("elemental_as_nodal")
136  : false),
137  _scalar_as_nodal(isParamValid("scalar_as_nodal") ? getParam<bool>("scalar_as_nodal") : false),
138  _reporter_data(_problem_ptr->getReporterData()),
139  _postprocessors_as_reporters(getParam<bool>("postprocessors_as_reporters")),
140  _vectorpostprocessors_as_reporters(getParam<bool>("vectorpostprocessors_as_reporters"))
141 {
142  _is_advanced = true;
144 }
145 
146 void
148 {
149  init();
150 }
151 
152 void
154 {
155  // Initialize the execution flags
156  for (auto & [name, input] : _advanced_execute_on)
157  initExecutionTypes(name, input);
158 
159  // Clear existing execute information lists
161 
162  // Initialize the available output
164 
165  // Separate the hide/show list into components
166  initShowHideLists(getParam<std::vector<VariableName>>("show"),
167  getParam<std::vector<VariableName>>("hide"));
168 
169  // If 'elemental_as_nodal = true' the elemental variable names must be appended to the
170  // nodal variable names. Thus, when libMesh::EquationSystem::build_solution_vector is called
171  // it will create the correct nodal variable from the elemental
173  {
174  OutputData & nodal = _execute_data["nodal"];
175  OutputData & elemental = _execute_data["elemental"];
176  nodal.show.insert(elemental.show.begin(), elemental.show.end());
177  nodal.hide.insert(elemental.hide.begin(), elemental.hide.end());
178  nodal.available.insert(elemental.available.begin(), elemental.available.end());
179  }
180 
181  // Similarly as above, if 'scalar_as_nodal = true' append the elemental variable lists
182  if (_scalar_as_nodal)
183  {
184  OutputData & nodal = _execute_data["nodal"];
185  OutputData & scalar = _execute_data["scalars"];
186  nodal.show.insert(scalar.show.begin(), scalar.show.end());
187  nodal.hide.insert(scalar.hide.begin(), scalar.hide.end());
188  nodal.available.insert(scalar.available.begin(), scalar.available.end());
189  }
190 
191  // Initialize the show/hide/output lists for each of the types of output
192  for (auto & it : _execute_data)
193  initOutputList(it.second);
194 }
195 
197 
198 void
200 {
201  mooseError("Individual output of nodal variables is not support for the output object named '",
202  name(),
203  "'");
204 }
205 
206 void
208 {
209  mooseError(
210  "Individual output of elemental variables is not support for this output object named '",
211  name(),
212  "'");
213 }
214 
215 void
217 {
218  mooseError("Individual output of postprocessors is not support for this output object named '",
219  name(),
220  "'");
221 }
222 
223 void
225 {
226  mooseError(
227  "Individual output of VectorPostprocessors is not support for this output object named '",
228  name(),
229  "'");
230 }
231 
232 void
234 {
235  mooseError(
236  "Individual output of scalars is not support for this output object named '", name(), "'");
237 }
238 
239 void
241 {
242  mooseError(
243  "Output of system information is not support for this output object named '", name(), "'");
244 }
245 
246 void
248 {
249  mooseError("Output of the input file information is not support for this output object named '",
250  name(),
251  "'");
252 }
253 
254 void
256 {
257  mooseError(
258  "Output of the Reporter value(s) is not support for this output object named '", name(), "'");
259 }
260 
261 bool
263 {
264  if (!checkFilename())
265  return false;
266 
268  return true;
269  else
270  return Output::shouldOutput();
271 }
272 
273 void
275 {
276  const auto & type = _current_execute_flag;
277 
278  // (re)initialize the list of available items for output
279  init();
280 
281  // Call the various output types, if data exists
282  if (wantOutput("nodal", type))
283  {
285  _last_execute_time["nodal"] = _time;
286  }
287 
288  if (wantOutput("elemental", type))
289  {
291  _last_execute_time["elemental"] = _time;
292  }
293 
294  if (wantOutput("postprocessors", type))
295  {
297  _last_execute_time["postprocessors"] = _time;
298  }
299 
300  if (wantOutput("vector_postprocessors", type))
301  {
303  _last_execute_time["vector_postprocessors"] = _time;
304  }
305 
306  if (wantOutput("scalars", type))
307  {
309  _last_execute_time["scalars"] = _time;
310  }
311 
312  if (wantOutput("system_information", type))
313  {
315  _last_execute_time["system_information"] = _time;
316  }
317 
318  if (wantOutput("input", type))
319  {
320  outputInput();
321  _last_execute_time["input"] = _time;
322  }
323 
324  if (wantOutput("reporters", type))
325  {
326  outputReporters();
327  _last_execute_time["reporters"] = _time;
328  }
329 }
330 
331 bool
332 AdvancedOutput::wantOutput(const std::string & name, const ExecFlagType & type)
333 {
334  // Ignore EXEC_FORCED for system information and input, there is no reason to force this
335  if (type == EXEC_FORCED && (name == "system_information" || name == "input"))
336  return false;
337 
338  // Do not output if the 'none' is contained by the execute_on
340  return false;
341 
342  // Data output flag, true if data exists to be output
343  bool execute_data_flag = true;
344 
345  // Set flag to false, if the OutputData exists and the output variable list is empty
346  std::map<std::string, OutputData>::const_iterator iter = _execute_data.find(name);
347  if (iter != _execute_data.end() && iter->second.output.empty())
348  execute_data_flag = false;
349 
350  // Set flag to false, if the OutputOnWarehouse DOES NOT contain an entry
352  execute_data_flag = false;
353 
354  // Force the output, if there is something to output and the time has not been output
355  if (type == EXEC_FORCED && execute_data_flag && _last_execute_time[name] != _time)
356  return true;
357 
358  // Return true (output should occur) if three criteria are satisfied, else do not output:
359  // (1) The execute_data_flag = true (i.e, there is data to output)
360  // (2) The current output type is contained in the list of output execution types
361  // (3) The current execution time is "final" or "forced" and the data has not already been
362  // output
363  if (execute_data_flag && _advanced_execute_on[name].contains(type) &&
365  return true;
366  else
367  return false;
368 }
369 
370 bool
372 {
373  // If any of the component outputs are true, then there is some output to perform
374  for (const auto & it : _advanced_execute_on)
375  if (wantOutput(it.first, type))
376  return true;
377 
378  // There is nothing to output
379  return false;
380 }
381 
382 bool
384 {
385  // Test that variables exist for output AND that output execution flags are valid
386  for (const auto & it : _execute_data)
387  if (!(it.second).output.empty() && _advanced_execute_on.contains(it.first) &&
388  _advanced_execute_on[it.first].isValid())
389  return true;
390 
391  // Test execution flags for non-variable output
392  if (_advanced_execute_on.contains("system_information") &&
393  _advanced_execute_on["system_information"].isValid())
394  return true;
395  if (_advanced_execute_on.contains("input") && _advanced_execute_on["input"].isValid())
396  return true;
397 
398  return false;
399 }
400 
401 void
403 {
404  // Initialize Postprocessor list
405  // This flag is set to true if any postprocessor has the 'outputs' parameter set, it is then used
406  // to produce an warning if postprocessor output is disabled
408  initPostprocessorOrVectorPostprocessorLists<Postprocessor>("postprocessors");
409 
410  // Initialize vector postprocessor list
411  // This flag is set to true if any vector postprocessor has the 'outputs' parameter set, it is
412  // then used
413  // to produce an warning if vector postprocessor output is disabled
415  initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>("vector_postprocessors");
416 
417  // Get a list of the available variables
418  std::vector<VariableName> variables = _problem_ptr->getVariableNames();
419 
420  // Loop through the variables and store the names in the correct available lists
421  for (const auto & var_name : variables)
422  {
423  if (_problem_ptr->hasVariable(var_name))
424  {
427 
428  const FEType type = var.feType();
429  for (unsigned int i = 0; i < var.count(); ++i)
430  {
431  VariableName vname = var_name;
432  if (var.isArray())
433  vname = SubProblem::arrayVariableComponent(var_name, i);
434 
435  // A note that if we have p-refinement we assume "worst-case" scenario that our constant
436  // monomial/monomial-vec families have been refined and we can no longer write them as
437  // elemental
438  if (type.order == CONSTANT && !_problem_ptr->havePRefinement() &&
439  type.family != MONOMIAL_VEC)
440  _execute_data["elemental"].available.insert(vname);
441  else if (type.family == NEDELEC_ONE || type.family == LAGRANGE_VEC ||
442  type.family == MONOMIAL_VEC || type.family == RAVIART_THOMAS)
443  {
444  const auto geom_type = ((type.family == MONOMIAL_VEC) && (type.order == CONSTANT) &&
446  ? "elemental"
447  : "nodal";
448  switch (_es_ptr->get_mesh().spatial_dimension())
449  {
450  case 0:
451  case 1:
452  _execute_data[geom_type].available.insert(vname);
453  break;
454  case 2:
455  _execute_data[geom_type].available.insert(vname + "_x");
456  _execute_data[geom_type].available.insert(vname + "_y");
457  break;
458  case 3:
459  _execute_data[geom_type].available.insert(vname + "_x");
460  _execute_data[geom_type].available.insert(vname + "_y");
461  _execute_data[geom_type].available.insert(vname + "_z");
462  break;
463  }
464  }
465  else
466  _execute_data["nodal"].available.insert(vname);
467  }
468  }
469 
470  else if (_problem_ptr->hasScalarVariable(var_name))
471  _execute_data["scalars"].available.insert(var_name);
472  }
473 
474  // Initialize Reporter name list
475  for (auto && r_name : _reporter_data.getReporterNames())
476  if ((_postprocessors_as_reporters || !r_name.isPostprocessor()) &&
477  (_vectorpostprocessors_as_reporters || !r_name.isVectorPostprocessor()))
478  _execute_data["reporters"].available.insert(r_name);
479 }
480 
481 void
482 AdvancedOutput::initExecutionTypes(const std::string & name, ExecFlagEnum & input)
483 {
484  // Build the input paramemter name
485  std::string param_name = "execute_";
486  param_name += name + "_on";
487 
488  // The parameters exists and has been set by the user
489  if (_pars.have_parameter<ExecFlagEnum>(param_name) && isParamValid(param_name))
490  input = getParam<ExecFlagEnum>(param_name);
491 
492  // If the parameter does not exists; set it to a state where no valid entries exists so nothing
493  // gets executed
494  else if (!_pars.have_parameter<ExecFlagEnum>(param_name))
495  {
496  input = _execute_on;
497  input.clear();
498  }
499 }
500 
501 void
502 AdvancedOutput::initShowHideLists(const std::vector<VariableName> & show,
503  const std::vector<VariableName> & hide)
504 {
505 
506  // Storage for user-supplied input that is unknown as a variable or postprocessor
507  std::set<std::string> unknown;
508 
509  // If a show hide/list exists, let the data warehouse know about it. This allows for the proper
510  // handling of output lists (see initOutputList)
511  if (show.size() > 0)
513 
514  // Populate the show lists
515  for (const auto & var_name : show)
516  {
517  if (_problem_ptr->hasVariable(var_name))
518  {
521  const FEType type = var.feType();
522  for (unsigned int i = 0; i < var.count(); ++i)
523  {
524  VariableName vname = var_name;
525  if (var.isArray())
526  vname = SubProblem::arrayVariableComponent(var_name, i);
527 
528  if (type.order == CONSTANT)
529  _execute_data["elemental"].show.insert(vname);
530  else if (type.family == NEDELEC_ONE || type.family == LAGRANGE_VEC ||
531  type.family == MONOMIAL_VEC || type.family == RAVIART_THOMAS)
532  {
533  const auto geom_type =
534  ((type.family == MONOMIAL_VEC) && (type.order == CONSTANT)) ? "elemental" : "nodal";
535  switch (_es_ptr->get_mesh().spatial_dimension())
536  {
537  case 0:
538  case 1:
539  _execute_data[geom_type].show.insert(vname);
540  break;
541  case 2:
542  _execute_data[geom_type].show.insert(vname + "_x");
543  _execute_data[geom_type].show.insert(vname + "_y");
544  break;
545  case 3:
546  _execute_data[geom_type].show.insert(vname + "_x");
547  _execute_data[geom_type].show.insert(vname + "_y");
548  _execute_data[geom_type].show.insert(vname + "_z");
549  break;
550  }
551  }
552  else
553  _execute_data["nodal"].show.insert(vname);
554  }
555  }
556  else if (_problem_ptr->hasScalarVariable(var_name))
557  _execute_data["scalars"].show.insert(var_name);
558  else if (hasPostprocessorByName(var_name))
559  _execute_data["postprocessors"].show.insert(var_name);
560  else if (hasVectorPostprocessorByName(var_name))
561  _execute_data["vector_postprocessors"].show.insert(var_name);
562  else if ((var_name.find("/") != std::string::npos) &&
564  _execute_data["reporters"].show.insert(var_name);
565  else
566  unknown.insert(var_name);
567  }
568 
569  // Populate the hide lists
570  for (const auto & var_name : hide)
571  {
572  if (_problem_ptr->hasVariable(var_name))
573  {
576  const FEType type = var.feType();
577  for (unsigned int i = 0; i < var.count(); ++i)
578  {
579  VariableName vname = var_name;
580  if (var.isArray())
581  vname = SubProblem::arrayVariableComponent(var_name, i);
582 
583  if (type.order == CONSTANT)
584  _execute_data["elemental"].hide.insert(vname);
585  else if (type.family == NEDELEC_ONE || type.family == LAGRANGE_VEC ||
586  type.family == MONOMIAL_VEC || type.family == RAVIART_THOMAS)
587  {
588  switch (_es_ptr->get_mesh().spatial_dimension())
589  {
590  case 0:
591  case 1:
592  _execute_data["nodal"].hide.insert(vname);
593  break;
594  case 2:
595  _execute_data["nodal"].hide.insert(vname + "_x");
596  _execute_data["nodal"].hide.insert(vname + "_y");
597  break;
598  case 3:
599  _execute_data["nodal"].hide.insert(vname + "_x");
600  _execute_data["nodal"].hide.insert(vname + "_y");
601  _execute_data["nodal"].hide.insert(vname + "_z");
602  break;
603  }
604  }
605  else
606  _execute_data["nodal"].hide.insert(vname);
607  }
608  }
609  else if (_problem_ptr->hasScalarVariable(var_name))
610  _execute_data["scalars"].hide.insert(var_name);
611  else if (hasPostprocessorByName(var_name))
612  _execute_data["postprocessors"].hide.insert(var_name);
613  else if (hasVectorPostprocessorByName(var_name))
614  _execute_data["vector_postprocessors"].hide.insert(var_name);
615  else if ((var_name.find("/") != std::string::npos) &&
617  _execute_data["reporters"].hide.insert(var_name);
618 
619  else
620  unknown.insert(var_name);
621  }
622 
623  // Error if an unknown variable or postprocessor is found
624  if (!unknown.empty())
625  {
626  std::ostringstream oss;
627  oss << "Output(s) do not exist (must be variable, scalar, postprocessor, or vector "
628  "postprocessor): ";
629  std::copy(unknown.begin(), unknown.end(), infix_ostream_iterator<std::string>(oss, " "));
630  mooseError(oss.str());
631  }
632 }
633 
634 void
636 {
637  // References to the vectors of variable names
638  std::set<std::string> & hide = data.hide;
639  std::set<std::string> & show = data.show;
640  std::set<std::string> & avail = data.available;
641  std::set<std::string> & output = data.output;
642 
643  // Append to the hide list from OutputInterface objects
644  std::set<std::string> interface_hide;
646  hide.insert(interface_hide.begin(), interface_hide.end());
647 
648  // Both show and hide are empty and no show/hide settings were provided (show all available)
649  if (show.empty() && hide.empty() && !_execute_data.hasShowList())
650  output = avail;
651 
652  // Only hide is empty (show all the variables listed)
653  else if (!show.empty() && hide.empty())
654  output = show;
655 
656  // Only show is empty (show all except those hidden)
657  else if (show.empty() && !hide.empty())
658  std::set_difference(avail.begin(),
659  avail.end(),
660  hide.begin(),
661  hide.end(),
662  std::inserter(output, output.begin()));
663 
664  // Both hide and show are present (show all those listed)
665  else
666  {
667  // Check if variables are in both, which is invalid
668  std::vector<std::string> tmp;
669  std::set_intersection(
670  hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
671  if (!tmp.empty())
672  {
673  std::ostringstream oss;
674  oss << "Output(s) specified to be both shown and hidden: ";
675  std::copy(tmp.begin(), tmp.end(), infix_ostream_iterator<std::string>(oss, " "));
676  mooseError(oss.str());
677  }
678 
679  // Define the output variable list
680  output = show;
681  }
682 }
683 
684 void
686 {
688  empty_execute_on.addAvailableFlags(EXEC_FAILED);
689 
690  // Nodal output
691  if (types.contains("nodal"))
692  {
693  params.addParam<ExecFlagEnum>(
694  "execute_nodal_on", empty_execute_on, "Control the output of nodal variables");
695  params.addParamNamesToGroup("execute_nodal_on", "Selection/restriction of output");
696  }
697 
698  // Elemental output
699  if (types.contains("elemental"))
700  {
701  params.addParam<ExecFlagEnum>(
702  "execute_elemental_on", empty_execute_on, "Control the output of elemental variables");
703  params.addParamNamesToGroup("execute_elemental_on", "Selection/restriction of output");
704 
705  // Add material output control, which are output via elemental variables
706  params.addParam<bool>("output_material_properties",
707  false,
708  "Flag indicating if material properties should be output");
709  params.addParam<std::vector<std::string>>(
710  "show_material_properties",
711  "List of material properties that should be written to the output");
712  params.addParamNamesToGroup("output_material_properties show_material_properties", "Materials");
713 
714  // Add mesh extra element id control, which are output via elemental variables
715  params.addParam<bool>(
716  "output_extra_element_ids",
717  false,
718  "Flag indicating if extra element ids defined on the mesh should be outputted");
719  params.addParam<std::vector<std::string>>(
720  "extra_element_ids_to_output",
721  "List of extra element ids defined on the mesh that should be written to the output.");
722  params.addParamNamesToGroup("output_extra_element_ids extra_element_ids_to_output", "Mesh");
723  }
724 
725  // Scalar variable output
726  if (types.contains("scalar"))
727  {
728  params.addParam<ExecFlagEnum>(
729  "execute_scalars_on", empty_execute_on, "Control the output of scalar variables");
730  params.addParamNamesToGroup("execute_scalars_on", "Selection/restriction of output");
731  }
732 
733  // Nodal and scalar output
734  if (types.contains("nodal") && types.contains("scalar"))
735  {
736  params.addParam<bool>("scalar_as_nodal", false, "Output scalar variables as nodal");
737  params.addParamNamesToGroup("scalar_as_nodal", "Conversions before output");
738  }
739 
740  // Elemental and nodal
741  if (types.contains("elemental") && types.contains("nodal"))
742  {
743  params.addParam<bool>(
744  "elemental_as_nodal", false, "Output elemental nonlinear variables as nodal");
745  params.addParamNamesToGroup("elemental_as_nodal", "Conversions before output");
746  }
747 
748  // Postprocessors
749  if (types.contains("postprocessor"))
750  {
751  params.addParam<ExecFlagEnum>(
752  "execute_postprocessors_on", empty_execute_on, "Control of when postprocessors are output");
753  params.addParamNamesToGroup("execute_postprocessors_on", "Selection/restriction of output");
754  }
755 
756  // Vector Postprocessors
757  if (types.contains("vector_postprocessor"))
758  {
759  params.addParam<ExecFlagEnum>("execute_vector_postprocessors_on",
760  empty_execute_on,
761  "Enable/disable the output of VectorPostprocessors");
762  params.addParamNamesToGroup("execute_vector_postprocessors_on",
763  "Selection/restriction of output");
764  }
765 
766  // Reporters
767  if (types.contains("reporter"))
768  {
769  params.addParam<ExecFlagEnum>(
770  "execute_reporters_on", empty_execute_on, "Control of when Reporter values are output");
771  params.addParamNamesToGroup("execute_reporters_on", "Selection/restriction of output");
772  }
773 
774  // Input file
775  if (types.contains("input"))
776  {
777  params.addParam<ExecFlagEnum>(
778  "execute_input_on", empty_execute_on, "Enable/disable the output of the input file");
779  params.addParamNamesToGroup("execute_input_on", "Selection/restriction of output");
780  }
781 
782  // System Information
783  if (types.contains("system_information"))
784  {
785  params.addParam<ExecFlagEnum>("execute_system_information_on",
786  empty_execute_on,
787  "Control when the output of the simulation information occurs");
788  params.addParamNamesToGroup("execute_system_information_on", "Selection/restriction of output");
789  }
790 }
791 
792 bool
793 AdvancedOutput::hasOutputHelper(const std::string & name)
794 {
795  return !_execute_data[name].output.empty() && _advanced_execute_on.contains(name) &&
797 }
798 
799 bool
801 {
802  return hasOutputHelper("nodal");
803 }
804 
805 const std::set<std::string> &
807 {
808  return _execute_data["nodal"].output;
809 }
810 
811 bool
813 {
814  return hasOutputHelper("elemental");
815 }
816 
817 const std::set<std::string> &
819 {
820  return _execute_data["elemental"].output;
821 }
822 
823 bool
825 {
826  return hasOutputHelper("scalars");
827 }
828 
829 const std::set<std::string> &
831 {
832  return _execute_data["scalars"].output;
833 }
834 
835 bool
837 {
838  return hasOutputHelper("postprocessors");
839 }
840 
841 const std::set<std::string> &
843 {
844  return _execute_data["postprocessors"].output;
845 }
846 
847 bool
849 {
850  return hasOutputHelper("vector_postprocessors");
851 }
852 
853 const std::set<std::string> &
855 {
856  return _execute_data["vector_postprocessors"].output;
857 }
858 
859 bool
861 {
862  return hasOutputHelper("reporters");
863 }
864 
865 const std::set<std::string> &
867 {
868  return _execute_data["reporters"].output;
869 }
870 
871 const OutputOnWarehouse &
873 {
874  return _advanced_execute_on;
875 }
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:40
bool hasPostprocessorOutput()
Returns true if there exists postprocessors for output.
virtual bool hasOutput()
Returns true if any of the other has methods return true.
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:197
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)
LAGRANGE_VEC
const ExecFlagType EXEC_FORCED
Definition: Moose.C:39
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
Definition: Output.h:274
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...
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
const FEType & feType() const
Get the type of finite element object.
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...
virtual bool isArray() const =0
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
Definition: MooseUtils.C:1056
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:278
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 contains(const std::string &value) const
Contains methods for seeing if a value is in the MultiMooseEnum.
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:980
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.
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:188
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:205
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:179
static InputParameters validParams()
Definition: FileOutput.C:24
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
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.
void clear()
Clear the MultiMooseEnum.
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
Definition: ReporterData.C:37
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:268
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.
static std::string arrayVariableComponent(const std::string &var_name, unsigned int i)
Returns the variable name of a component of an array variable.
Definition: SubProblem.h:271
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
RAVIART_THOMAS
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...
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 option 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 It sho...
NEDELEC_ONE
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:87
void initExecutionTypes(const std::string &name, ExecFlagEnum &input)
Initialize the possible execution types.
std::map< std::string, T >::iterator find(const std::string &name)
const ExecFlagType EXEC_FINAL
Definition: Moose.C:38
Real & _time
The current time for output purposes.
Definition: Output.h:208
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:1766
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.