www.mooseframework.org
ExodusTimeSequenceStepper.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 
11 #include "MooseUtils.h"
12 #include "libmesh/serial_mesh.h"
13 #include "libmesh/exodusII_io.h"
14 
16 
19 {
21  params.addRequiredParam<MeshFileName>(
22  "mesh",
23  "The name of the mesh file to extract the time sequence from (must be an exodusII file).");
24  params.addClassDescription("Solves the Transient problem at a sequence of time points taken from "
25  "a specified exodus file.");
26  return params;
27 }
28 
30  : TimeSequenceStepperBase(parameters), _mesh_file(getParam<MeshFileName>("mesh"))
31 {
32  // Read the Exodus file on processor 0
33  std::vector<Real> times;
34  if (processor_id() == 0)
35  {
36  // Check that the required file exists
38 
39  // dummy mesh
40  ReplicatedMesh mesh(_communicator);
41 
42  ExodusII_IO exodusII_io(mesh);
43  exodusII_io.read(_mesh_file);
44  times = exodusII_io.get_time_steps();
45  }
46 
47  // distribute timestep list
48  unsigned int num_steps = times.size();
49  _communicator.broadcast(num_steps);
50  times.resize(num_steps);
51  _communicator.broadcast(times);
52 
53  setupSequence(times);
54 }
ExodusTimeSequenceStepper(const InputParameters &parameters)
MeshBase & mesh
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void setupSequence(const std::vector< Real > &times)
const Parallel::Communicator & _communicator
static InputParameters validParams()
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...
Solves the PDEs at a sequence of time points given as a vector in the input file. ...
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:256
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
Solves the PDEs at a sequence of given time points.
static InputParameters validParams()
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...
registerMooseObject("MooseApp", ExodusTimeSequenceStepper)
processor_id_type processor_id() const
std::string _mesh_file
The ExodusII file that is being read.