www.mooseframework.org
ExodusTimeSequenceStepper.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
16 #include "MooseUtils.h"
17 #include "libmesh/serial_mesh.h"
18 #include "libmesh/exodusII_io.h"
19 
20 template <>
23 {
25  params.addRequiredParam<MeshFileName>(
26  "mesh",
27  "The name of the mesh file to extract the time sequence from (must be an exodusII file).");
28  params.addClassDescription("Solves the Transient problem at a sequence of time points taken from "
29  "a specified exodus file.");
30  return params;
31 }
32 
34  : TimeSequenceStepperBase(parameters), _mesh_file(getParam<MeshFileName>("mesh"))
35 {
36  // Read the Exodus file on processor 0
37  std::vector<Real> times;
38  if (processor_id() == 0)
39  {
40  // Check that the required file exists
42 
43  // dummy mesh
44  ReplicatedMesh mesh(_communicator);
45 
46  ExodusII_IO exodusII_io(mesh);
47  exodusII_io.read(_mesh_file);
48  times = exodusII_io.get_time_steps();
49  }
50 
51  // distribute timestep list
52  unsigned int num_steps = times.size();
53  _communicator.broadcast(num_steps);
54  times.resize(num_steps);
55  _communicator.broadcast(times);
56 
57  setupSequence(times);
58 }
ExodusTimeSequenceStepper(const InputParameters &parameters)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void setupSequence(const std::vector< Real > &times)
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:121
InputParameters validParams< TimeSequenceStepperBase >()
Solves the PDEs at a sequence of given time points.
InputParameters validParams< ExodusTimeSequenceStepper >()
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...
std::string _mesh_file
The ExodusII file that is being read.