https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ExodusTimeSequenceStepper.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
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}
33
34void
36{
37 // Read the Exodus file on processor 0
38 std::vector<Real> times;
39 if (processor_id() == 0)
40 {
41 // Check that the required file exists
43
44 // dummy mesh
45 ReplicatedMesh mesh(_communicator);
46
47 ExodusII_IO exodusII_io(mesh);
48 exodusII_io.read(_mesh_file);
49 times = exodusII_io.get_time_steps();
50 }
51
52 // distribute timestep list
53 unsigned int num_steps = times.size();
54 _communicator.broadcast(num_steps);
55 times.resize(num_steps);
57
58 setupSequence(times);
59}
registerMooseObject("MooseApp", ExodusTimeSequenceStepper)
Solves the PDEs at a sequence of time points given as a vector in the input file.
std::string _mesh_file
The ExodusII file that is being read.
virtual void init() override
Initialize the time stepper.
ExodusTimeSequenceStepper(const InputParameters &parameters)
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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 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.
void setupSequence(const std::vector< Real > &times)
static InputParameters validParams()
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
MeshBase & mesh
bool checkFileReadable(const std::string &filename, bool check_line_endings, bool throw_on_unreadable, bool check_for_git_lfs_pointer)
Definition MooseUtils.C:265