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
15using namespace libMesh;
16
18
21{
23 params.addRequiredParam<MeshFileName>(
24 "mesh",
25 "The name of the mesh file to extract the time sequence from (must be an exodusII file).");
26 params.addClassDescription("Solves the Transient problem at a sequence of time points taken from "
27 "a specified exodus file.");
28 return params;
29}
30
32 : TimeSequenceStepperBase(parameters), _mesh_file(getParam<MeshFileName>("mesh"))
33{
34}
35
36void
38{
39 // Read the Exodus file on processor 0
40 std::vector<Real> times;
41 if (processor_id() == 0)
42 {
43 // Check that the required file exists
45
46 // dummy mesh
48
49 ExodusII_IO exodusII_io(mesh);
50 exodusII_io.read(_mesh_file);
51 times = exodusII_io.get_time_steps();
52 }
53
54 // distribute timestep list
55 unsigned int num_steps = times.size();
56 _communicator.broadcast(num_steps);
57 times.resize(num_steps);
59
60 setupSequence(times);
61}
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 std::vector< Real > & get_time_steps()
virtual void read(const std::string &name) override
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
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...