https://mooseframework.inl.gov
Exodus.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 #include "Exodus.h"
11 
12 // Moose includes
13 #include "DisplacedProblem.h"
14 #include "ExodusFormatter.h"
15 #include "FEProblem.h"
16 #include "FileMesh.h"
17 #include "MooseApp.h"
18 #include "MooseVariableScalar.h"
19 #include "LockFile.h"
20 
21 #include "libmesh/exodusII_io.h"
22 #include "libmesh/libmesh_config.h" // LIBMESH_HAVE_HDF5
23 
24 using namespace libMesh;
25 
26 registerMooseObject("MooseApp", Exodus);
27 
30 {
31  // Get the base class parameters
33  params +=
34  AdvancedOutput::enableOutputTypes("nodal elemental scalar postprocessor reporter input");
35 
36  // Enable sequential file output (do not set default, the use_displace criteria relies on
37  // isParamValid, see Constructor)
38  params.addParam<bool>("sequence",
39  "Enable/disable sequential file output (enabled by default "
40  "when 'use_displace = true', otherwise defaults to false");
41 
42  // Select problem dimension for mesh output
43  params.addDeprecatedParam<bool>("use_problem_dimension",
44  "Use the problem dimension to the mesh output. "
45  "Set to false when outputting lower dimensional "
46  "meshes embedded in a higher dimensional space.",
47  "Use 'output_dimension = problem_dimension' instead.");
48 
49  MooseEnum output_dimension("default 1 2 3 problem_dimension", "default");
50 
51  params.addParam<MooseEnum>(
52  "output_dimension", output_dimension, "The dimension of the output file");
53 
54  params.addParamNamesToGroup("output_dimension", "Advanced");
55 
56  // Set the default padding to 3
57  params.set<unsigned int>("padding") = 3;
58 
59  // Add description for the Exodus class
60  params.addClassDescription("Object for output data in the Exodus format");
61 
62  // Flag for overwriting at each timestep
63  params.addParam<bool>("overwrite",
64  false,
65  "When true the latest timestep will overwrite the "
66  "existing file, so only a single timestep exists.");
67 
68  // Set outputting of the input to be on by default
69  params.set<ExecFlagEnum>("execute_input_on") = EXEC_INITIAL;
70 
71  // Flag for outputting discontinuous data to Exodus
72  params.addParam<bool>(
73  "discontinuous", false, "Enables discontinuous output format for Exodus files.");
74 
75  // Flag for outputting added side elements (for side-discontinuous data) to Exodus
76  params.addParam<bool>(
77  "side_discontinuous", false, "Enables adding side-discontinuous output in Exodus files.");
78 
79  // Flag for outputting Exodus data in HDF5 format (when libMesh is
80  // configured with HDF5 support). libMesh wants to do so by default
81  // (for backwards compatibility with libMesh HDF5 users), but we
82  // want to avoid this by default (for backwards compatibility with
83  // most Moose users and to avoid generating regression test gold
84  // files that non-HDF5 Moose builds can't read)
85  params.addParam<bool>("write_hdf5", false, "Enables HDF5 output format for Exodus files.");
86 
87  // Set output of names to be truncated to a certain character count.
88  // libMesh+ExodusII currently supports up to 80, so we would like to
89  // default to that to avoid truncation when possible.
90  //
91  // We used to truncate at 32, so we make this user-configurable to
92  // make it easier to match old gold files.
93  //
94  // We're still defaulting to 32 until our apps in CI start using
95  // this option (and/or re-golding) downstream.
96  //
97  // If someone tries to set truncation at less than 32 they're
98  // probably making a mistake.
99  params.addRangeCheckedParam<unsigned int>("max_output_name_length",
100  32,
101  "32<=max_output_name_length<=80",
102  "Maximum length for names in Exodus file output.");
103 
104  params.addParamNamesToGroup("write_hdf5 max_output_name_length", "Advanced");
105 
106  // Need a layer of geometric ghosting for mesh serialization
107  params.addRelationshipManager("ElementPointNeighborLayers",
109 
110  // Return the InputParameters
111  return params;
112 }
113 
114 Exodus::Exodus(const InputParameters & parameters)
115  : SampledOutput(parameters),
116  _exodus_initialized(false),
117  _exodus_mesh_changed(declareRestartableData<bool>("exodus_mesh_changed", true)),
118  _sequence(isParamValid("sequence") ? getParam<bool>("sequence")
119  : _use_displaced ? true
120  : false),
121  _exodus_num(declareRestartableData<unsigned int>("exodus_num", 0)),
122  _recovering(_app.isRecovering()),
123  _overwrite(getParam<bool>("overwrite")),
124  _output_dimension(getParam<MooseEnum>("output_dimension").getEnum<OutputDimension>()),
125  _discontinuous(getParam<bool>("discontinuous")),
126  _side_discontinuous(getParam<bool>("side_discontinuous")),
127  _write_hdf5(getParam<bool>("write_hdf5")),
128  _max_output_name_length(getParam<unsigned int>("max_output_name_length"))
129 {
130  if (isParamValid("use_problem_dimension"))
131  {
132  auto use_problem_dimension = getParam<bool>("use_problem_dimension");
133 
134  if (use_problem_dimension)
136  else
138  }
139  // If user sets 'discontinuous = true' and 'elemental_as_nodal = false', issue an error that these
140  // are incompatible states
141  if (_discontinuous && parameters.isParamSetByUser("elemental_as_nodal") && !_elemental_as_nodal)
142  mooseError(name(),
143  ": Invalid parameters. 'elemental_as_nodal' set to false while 'discontinuous' set "
144  "to true.");
145  // At this point, if we have discontinuous ouput, we know the user hasn't explicitly set
146  // 'elemental_as_nodal = false', so we can safely default it to true
147  if (_discontinuous)
148  _elemental_as_nodal = true;
149 }
150 
151 void
152 Exodus::setOutputDimension(unsigned int /*dim*/)
153 {
155  "This method is no longer needed. We can determine output dimension programmatically");
156 }
157 
158 void
160 {
161  // Call base class setup method
163 
164  // The libMesh::ExodusII_IO will fail when it is closed if the object is created but
165  // nothing is written to the file. This checks that at least something will be written.
166  if (!hasOutput())
167  mooseError("The current settings result in nothing being output to the Exodus file.");
168 
169  // Test that some sort of variable output exists (case when all variables are disabled but input
170  // output is still enabled
172  !hasScalarOutput())
173  mooseError("The current settings results in only the input file and no variables being output "
174  "to the Exodus file, this is not supported.");
175 }
176 
177 void
179 {
180  // Maintain Sampled::meshChanged() functionality
182 
183  // Indicate to the Exodus object that the mesh has changed
184  _exodus_mesh_changed = true;
185 }
186 
187 void
188 Exodus::sequence(bool state)
189 {
190  _sequence = state;
191 }
192 
193 void
195 {
196  if (_exodus_io_ptr)
197  {
198  // Do nothing if the ExodusII_IO objects exists, but has not been initialized
199  if (!_exodus_initialized)
200  return;
201 
202  // Do nothing if the output is using oversampling. In this case the mesh that is being output
203  // has not been changed, so there is no need to create a new ExodusII_IO object
205  return;
206 
207  // Do nothing if the mesh has not changed and sequential output is not desired
209  return;
210  }
211 
212  auto serialize = [this](auto & moose_mesh)
213  {
214  auto & lm_mesh = moose_mesh.getMesh();
215  // Exodus is serial output so that we have to gather everything to "zero".
216  lm_mesh.gather_to_zero();
217  // This makes the face information out-of-date on process 0 for distributed meshes, e.g.
218  // elements will have neighbors that they didn't previously have
219  if ((this->processor_id() == 0) && !lm_mesh.is_replicated())
220  moose_mesh.markFiniteVolumeInfoDirty();
221  };
222  serialize(_problem_ptr->mesh());
223 
224  // We need to do the same thing for displaced mesh to make them consistent.
225  // In general, it is a good idea to make the reference mesh and the displaced mesh
226  // consistent since some operations or calculations are already based on this assumption.
227  // For example,
228  // FlagElementsThread::onElement(const Elem * elem)
229  // if (_displaced_problem)
230  // _displaced_problem->mesh().elemPtr(elem->id())->set_refinement_flag((Elem::RefinementState)marker_value);
231  // Here we assume that the displaced mesh and the reference mesh are identical except
232  // coordinations.
234  serialize(_problem_ptr->getDisplacedProblem()->mesh());
235 
236  // Create the ExodusII_IO object
237  _exodus_io_ptr = std::make_unique<ExodusII_IO>(_es_ptr->get_mesh());
238  _exodus_initialized = false;
239 
240  if (_write_hdf5)
241  {
242 #ifndef LIBMESH_HAVE_HDF5
243  mooseError("Moose input requested HDF Exodus output, but libMesh was built without HDF5.");
244 #endif
245 
246  // This is redundant unless the libMesh default changes
247  _exodus_io_ptr->set_hdf5_writing(true);
248  }
249  else
250  {
251  _exodus_io_ptr->set_hdf5_writing(false);
252  }
253 
254  _exodus_io_ptr->set_max_name_length(_max_output_name_length);
255 
257  _exodus_io_ptr->write_added_sides(true);
258 
259  // Increment file number and set appending status, append if all the following conditions are met:
260  // (1) If the application is recovering (not restarting)
261  // (2) The mesh has NOT changed
262  // (3) An existing Exodus file exists for appending (_exodus_num > 0)
263  // (4) Sequential output is NOT desired
264  // (5) Exodus is NOT being output only on FINAL
266  (getExecuteOnEnum().size() != 1 || !getExecuteOnEnum().contains(EXEC_FINAL)))
267  {
268  // Set the recovering flag to false so that this special case is not triggered again
269  _recovering = false;
270 
271  // Set the append flag to true b/c on recover the file is being appended
272  _exodus_io_ptr->append(true);
273  }
274  else
275  {
276  // Disable file appending and reset exodus file number count
277  _exodus_io_ptr->append(false);
278 
279  // Customize file output
281  }
282 
284 }
285 
286 void
288 {
290  _file_num++;
291 
292  _exodus_num = 1;
293 }
294 
295 void
297  const MooseMesh & mesh,
298  OutputDimension output_dimension)
299 {
300  switch (output_dimension)
301  {
303  // If the mesh_dimension is 1, we need to write out as 3D.
304  //
305  // This works around an issue in Paraview where 1D meshes cannot
306  // not be visualized correctly. Otherwise, write out based on the effectiveSpatialDimension.
307  if (mesh.getMesh().mesh_dimension() == 1)
308  exodus_io.write_as_dimension(3);
309  else
310  exodus_io.write_as_dimension(static_cast<int>(mesh.effectiveSpatialDimension()));
311  break;
312 
316  exodus_io.write_as_dimension(static_cast<int>(output_dimension));
317  break;
318 
321  break;
322 
323  default:
324  ::mooseError("Unknown output_dimension in Exodus writer");
325  }
326 }
327 
328 void
330 {
331  // Set the output variable to the nodal variables
332  std::vector<std::string> nodal(getNodalVariableOutput().begin(), getNodalVariableOutput().end());
333  _exodus_io_ptr->set_output_variables(nodal);
334 
335  // Check if the mesh is contiguously numbered, because exodus output will renumber to force that
336  const auto & mesh = _problem_ptr->mesh().getMesh();
337  const bool mesh_contiguous_numbering =
338  (mesh.n_nodes() == mesh.max_node_id()) && (mesh.n_elem() == mesh.max_elem_id());
339 
340  // Write the data via libMesh::ExodusII_IO
341  if (_discontinuous)
342  _exodus_io_ptr->write_timestep_discontinuous(
344  else
345  _exodus_io_ptr->write_timestep(
347 
348  if (!_overwrite)
349  _exodus_num++;
350 
351  if (!mesh_contiguous_numbering)
353 
354  // This satisfies the initialization of the ExodusII_IO object
355  _exodus_initialized = true;
356 }
357 
358 void
360 {
361  // Make sure the the file is ready for writing of elemental data
364 
365  // Write the elemental data
366  std::vector<std::string> elemental(getElementalVariableOutput().begin(),
368  _exodus_io_ptr->set_output_variables(elemental);
369  _exodus_io_ptr->write_element_data(*_es_ptr);
370 }
371 
372 void
374 {
375  // List of desired postprocessor outputs
376  const std::set<std::string> & pps = getPostprocessorOutput();
377 
378  // Append the postprocessor data to the global name value parameters; scalar outputs
379  // also append these member variables
380  for (const auto & name : pps)
381  {
382  _global_names.push_back(name);
384  }
385 }
386 
387 void
389 {
390  for (const auto & combined_name : getReporterOutput())
391  {
392  ReporterName r_name(combined_name);
393  if (_reporter_data.hasReporterValue<Real>(r_name) &&
395  {
396  const Real & value = _reporter_data.getReporterValue<Real>(r_name);
397  _global_names.push_back(r_name.getValueName());
398  _global_values.push_back(value);
399  }
400  }
401 }
402 
403 void
405 {
406  // List of desired scalar outputs
407  const std::set<std::string> & out = getScalarOutput();
408 
409  // Append the scalar to the global output lists
410  for (const auto & out_name : out)
411  {
412  // Make sure scalar values are in sync with the solution vector
413  // and are visible on this processor. See TableOutput.C for
414  // TableOutput::outputScalarVariables() explanatory comments
415 
416  MooseVariableScalar & scalar_var = _problem_ptr->getScalarVariable(0, out_name);
417  scalar_var.reinit();
418  VariableValue value(scalar_var.sln());
419 
420  const std::vector<dof_id_type> & dof_indices = scalar_var.dofIndices();
421  const unsigned int n = dof_indices.size();
422  value.resize(n);
423 
424  const DofMap & dof_map = scalar_var.sys().dofMap();
425  for (unsigned int i = 0; i != n; ++i)
426  {
427  const processor_id_type pid = dof_map.dof_owner(dof_indices[i]);
428  this->comm().broadcast(value[i], pid);
429  }
430 
431  // If the scalar has a single component, output the name directly
432  if (n == 1)
433  {
434  _global_names.push_back(out_name);
435  _global_values.push_back(value[0]);
436  }
437 
438  // If the scalar as many components add indices to the end of the name
439  else
440  {
441  for (unsigned int i = 0; i < n; ++i)
442  {
443  std::ostringstream os;
444  os << out_name << "_" << i;
445  _global_names.push_back(os.str());
446  _global_values.push_back(value[i]);
447  }
448  }
449  }
450 }
451 
452 void
454 {
455  // Format the input file
456  ExodusFormatter syntax_formatter;
457  syntax_formatter.printInputFile(_app.actionWarehouse());
458  syntax_formatter.format();
459 
460  // Store the information
461  _input_record = syntax_formatter.getInputFileRecord();
462 }
463 
464 void
466 {
467  // Prepare the ExodusII_IO object
468  outputSetup();
469  LockFile lf(filename(), processor_id() == 0);
470 
471  // Adjust the position of the output
472  if (_app.hasOutputPosition())
473  _exodus_io_ptr->set_coordinate_offset(_app.getOutputPosition());
474 
475  // Clear the global variables (postprocessors and scalars)
476  _global_names.clear();
477  _global_values.clear();
478 
479  // Call the individual output methods
481 
482  // Write the global variables (populated by the output methods)
483  if (!_global_values.empty())
484  {
485  if (!_exodus_initialized)
487  _exodus_io_ptr->write_global_data(_global_values, _global_names);
488  }
489 
490  // Write the input file record if it exists and the output file is initialized
491  if (!_input_record.empty() && _exodus_initialized)
492  {
493  _exodus_io_ptr->write_information_records(_input_record);
494  _input_record.clear();
495  }
496 
497  // Reset the mesh changed flag
498  _exodus_mesh_changed = false;
499 
500  // It is possible to have an empty file created with the following scenario. By default the
501  // 'execute_on_input' flag is setup to run on INITIAL. If the 'execute_on' is set to FINAL
502  // but the simulation stops early (e.g., --test-checkpoint-half-transient) the Exodus file is
503  // created but there is no data in it, because of the initial call to write the input data seems
504  // to create the file but doesn't actually write the data into the solution/mesh is also supplied
505  // to the IO object. Then if --recover is used this empty file fails to open for appending.
506  //
507  // The code below will delete any empty files that exist. Another solution is to set the
508  // 'execute_on_input' flag to NONE.
509  std::string current = filename();
510  if (processor_id() == 0 && MooseUtils::checkFileReadable(current, false, false) &&
511  (MooseUtils::fileSize(current) == 0))
512  {
513  int err = std::remove(current.c_str());
514  if (err != 0)
515  mooseError("MOOSE failed to remove the empty file ", current);
516  }
517 }
518 
519 std::string
521 {
522  // Append the .e extension on the base file name
523  std::ostringstream output;
524  output << _file_base + ".e";
525 
526  // Add the -s00x extension to the file
527  if (_file_num > 1)
528  output << "-s" << std::setw(_padding) << std::setprecision(0) << std::setfill('0') << std::right
529  << _file_num;
530 
531  return output.str();
532 }
533 
534 void
536 {
537  // Check if the mesh is contiguously numbered, because exodus output will renumber to force that
538  const auto & mesh = _problem_ptr->mesh().getMesh();
539  const bool mesh_contiguous_numbering =
540  (mesh.n_nodes() == mesh.max_node_id()) && (mesh.n_elem() == mesh.max_elem_id());
541 
542  // Write a timestep with no variables
543  _exodus_io_ptr->set_output_variables(std::vector<std::string>());
544  _exodus_io_ptr->write_timestep(
546 
547  if (!_overwrite)
548  _exodus_num++;
549 
550  if (!mesh_contiguous_numbering)
552  _exodus_initialized = true;
553 }
554 
555 void
557 {
558  _exodus_io_ptr.reset();
559 }
560 
561 void
563 {
564  // We renumbered our mesh, so we need the other mesh to do the same
565  if (auto * const disp_problem = _problem_ptr->getDisplacedProblem().get(); disp_problem)
566  {
567  auto & disp_eq = disp_problem->es();
568  auto & other_mesh = &disp_eq == _es_ptr ? _problem_ptr->mesh().getMesh() : disp_eq.get_mesh();
569  mooseAssert(
570  !other_mesh.allow_renumbering(),
571  "The only way we shouldn't have contiguous numbering is if we've disabled renumbering");
572  other_mesh.allow_renumbering(true);
573  other_mesh.renumber_nodes_and_elements();
574  // Copying over the comment in MeshOutput::write_equation_systems
575  // Not sure what good going back to false will do here, the
576  // renumbering horses have already left the barn...
577  other_mesh.allow_renumbering(false);
578  }
579 
580  // Objects that depend on element/node ids are no longer valid
582  /*intermediate_change=*/false, /*contract_mesh=*/false, /*clean_refinement_flags=*/false);
583 }
OStreamProxy err
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
virtual void meshChanged(bool intermediate_change, bool contract_mesh, bool clean_refinement_flags)
Update data after a mesh change.
bool _use_sampled_output
Flag indicating that the sampled output should be used to re-sample the underlying EquationSystem of ...
Definition: SampledOutput.h:71
void use_mesh_dimension_instead_of_spatial_dimension(bool val)
virtual void outputReporters() override
Writes the Reporter values to the ExodusII output.
Definition: Exodus.C:388
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::vector< std::string > _input_record
Storage for input file record; this is written to the file only after it has been initialized...
Definition: Exodus.h:194
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void write_as_dimension(unsigned dim)
processor_id_type dof_owner(const dof_id_type dof) const
virtual void sequence(bool state)
Set the sequence state When the sequence state is set to true then the outputSetup() method is called...
Definition: Exodus.C:188
bool hasOutputPosition() const
Whether or not an output position has been set.
Definition: MooseApp.h:281
void allow_renumbering(bool allow)
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
virtual void meshChanged() override
Set flag indicating that the mesh has changed.
Definition: Exodus.C:178
virtual void output() override
Overload the OutputBase::output method, this is required for ExodusII output due to the method utiliz...
Definition: Exodus.C:465
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
std::unique_ptr< libMesh::ExodusII_IO > _exodus_io_ptr
Pointer to the libMesh::ExodusII_IO object that performs the actual data output.
Definition: Exodus.h:147
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
MeshBase & mesh
bool _write_hdf5
Flag to output HDF5 format (when available) in Exodus.
Definition: Exodus.h:209
bool _elemental_as_nodal
Flags to control nodal output.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Parallel::Communicator & comm() const
virtual std::string filename() override
Returns the current filename, this method handles the -s000 suffix common to ExodusII files...
Definition: Exodus.C:520
std::string _file_base
The base filename from the input paramaters.
Definition: FileOutput.h:89
bool _overwrite
Flag for overwriting timesteps.
Definition: Exodus.h:197
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:34
void clear()
Reset Exodus output.
Definition: Exodus.C:556
bool _side_discontinuous
Flag to output added disjoint fictitious sides for side_discontinuous variables.
Definition: Exodus.h:206
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
virtual void outputNodalVariables() override
Outputs nodal, nonlinear variables.
Definition: Exodus.C:329
OutputDimension
Definition: Exodus.h:29
OutputDimension _output_dimension
Enum for the output dimension.
Definition: Exodus.h:200
bool _discontinuous
Flag to output discontinuous format in Exodus.
Definition: Exodus.h:203
Based class for providing re-positioning and oversampling support to output objects.
Definition: SampledOutput.h:39
bool _exodus_initialized
Flag for indicating the status of the ExodusII file that is being written.
Definition: Exodus.h:167
static InputParameters validParams()
Definition: Exodus.C:29
unsigned int _padding
Number of digits to pad the extensions.
Definition: FileOutput.h:83
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
uint8_t processor_id_type
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1164
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
void setOutputDimension(unsigned int dim)
Force the output dimension programatically.
Definition: Exodus.C:152
bool hasNodalVariableOutput()
Returns true if there exists nodal nonlinear variables for output.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3575
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
Definition: ReporterData.h:394
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
bool _recovering
Flag indicating MOOSE is recovering via –recover command-line option.
Definition: Exodus.h:191
bool & _exodus_mesh_changed
A flag indicating to the Exodus object that the mesh has changed.
Definition: Exodus.h:170
Class for output data to the ExodusII format.
Definition: Exodus.h:24
const ExecFlagEnum & getExecuteOnEnum() const
Return the execute on MultiMooseEnum for this object.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition: Output.h:185
virtual dof_id_type max_elem_id() const=0
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:93
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
std::vector< std::string > & getInputFileRecord()
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
void mooseDeprecated(Args &&... args) const
std::vector< std::string > _global_names
Storage for names of the above scalar values.
Definition: Exodus.h:153
std::size_t fileSize(const std::string &filename)
Definition: MooseUtils.C:1095
Exodus(const InputParameters &parameters)
Class constructor.
Definition: Exodus.C:114
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
bool hasScalarOutput()
Returns true if there exists scalar variables for output.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:216
virtual void meshChanged() override
Called on this object when the mesh changes.
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:385
std::vector< Real > _global_values
Storage for scalar values (postprocessors and scalar AuxVariables)
Definition: Exodus.h:150
bool contains(std::string_view superstring, std::string_view substring)
const std::string & getObjectName() const
Return the object name that produces the Reporter value.
Definition: ReporterName.C:41
unsigned int & _exodus_num
Count of outputs per exodus file.
Definition: Exodus.h:176
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.
bool _sequence
Sequence flag, if true each timestep is written to a new file.
Definition: Exodus.h:173
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
Point getOutputPosition() const
Get the output position.
Definition: MooseApp.h:287
const ReporterData & _reporter_data
Storage for Reporter values.
virtual void outputElementalVariables() override
Outputs elemental, nonlinear variables.
Definition: Exodus.C:359
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:343
void outputEmptyTimestep()
A helper function for &#39;initializing&#39; the ExodusII output file, see the comments for the _initialized ...
Definition: Exodus.C:535
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
virtual void outputSetup()
Performs the necessary deletion and re-creating of ExodusII_IO object.
Definition: Exodus.C:194
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
static void setOutputDimensionInExodusWriter(libMesh::ExodusII_IO &exodus_io, const MooseMesh &mesh, OutputDimension output_dim=OutputDimension::DEFAULT)
Helper method to change the output dimension in the passed in Exodus writer depending on the dimensio...
Definition: Exodus.C:296
OStreamProxy out
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:194
const MeshBase & get_mesh() const
virtual void outputInput() override
Writes the input file to the ExodusII output.
Definition: Exodus.C:453
Class for scalar variables (they are different).
virtual MooseMesh & mesh() override
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced") ...
Definition: Output.h:197
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
unsigned int mesh_dimension() const
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
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...
unsigned int _max_output_name_length
Maximum length of untruncated names in Exodus output.
Definition: Exodus.h:212
virtual void outputScalarVariables() override
Writes scalar AuxVariables to global output parameters.
Definition: Exodus.C:404
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
Definition: ReporterData.h:458
unsigned int & _file_num
A file number counter, initialized to 0 (this must be controlled by the child class, see Exodus)
Definition: FileOutput.h:80
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition: MooseBase.h:209
Gets an exclusive lock on a file.
Definition: LockFile.h:22
virtual void customizeFileOutput()
Customizes file output settings.
Definition: Exodus.C:287
const std::string & getValueName() const
Return the data name for the Reporter value.
Definition: ReporterName.C:47
void printInputFile(ActionWarehouse &wh)
virtual dof_id_type max_node_id() const=0
virtual dof_id_type n_elem() const=0
processor_id_type processor_id() const
SystemBase & sys()
Get the system this variable is part of.
bool checkFileReadable(const std::string &filename, bool check_line_endings, bool throw_on_unreadable, bool check_for_git_lfs_pointer)
Definition: MooseUtils.C:254
Real getGlobalTimeOffset() const
Each App has it&#39;s own local time.
Definition: MooseApp.h:317
const ExecFlagType EXEC_FINAL
Definition: Moose.C:46
static InputParameters validParams()
Definition: SampledOutput.C:25
const VariableValue & sln() const
virtual void outputPostprocessors() override
Writes postprocessor values to global output parameters.
Definition: Exodus.C:373
virtual Real getOutputTime()
Get the time that will be used for stream/file outputting.
Definition: PetscOutput.C:273
void ErrorVector unsigned int
The Reporter system is comprised of objects that can contain any number of data values.
Definition: ReporterName.h:30
virtual dof_id_type n_nodes() const=0
registerMooseObject("MooseApp", Exodus)
void handleExodusIOMeshRenumbering()
Handle the call to mesh renumbering in libmesh&#39;s ExodusIO on non-contiguously numbered meshes...
Definition: Exodus.C:562
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...
virtual void initialSetup() override
Performs basic error checking and initial setup of ExodusII_IO output object.
Definition: Exodus.C:159
virtual void initialSetup() override
Call init() method on setup.
Definition: SampledOutput.C:76
const ExecFlagType EXEC_INITIAL
Definition: Moose.C:30