www.mooseframework.org
SetupTimeStepperAction.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 
10 #include "SetupTimeStepperAction.h"
11 #include "Transient.h"
12 #include "Factory.h"
13 #include "TimeStepper.h"
14 
15 registerMooseAction("MooseApp", SetupTimeStepperAction, "setup_time_stepper");
16 
17 template <>
20 {
22 
23  return params;
24 }
25 
27  : MooseObjectAction(parameters)
28 {
29 }
30 
31 void
33 {
34  if (_problem->isTransient())
35  {
36  Transient * transient = dynamic_cast<Transient *>(_app.getExecutioner());
37  if (!transient)
38  mooseError("You can setup time stepper only with executioners of transient type.");
39 
40  _moose_object_pars.set<SubProblem *>("_subproblem") = _problem.get();
41  _moose_object_pars.set<Transient *>("_executioner") = transient;
42  std::shared_ptr<TimeStepper> ts =
44  transient->setTimeStepper(ts);
45  }
46 }
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.h:255
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:87
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:30
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:207
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Base class for time stepping.
Definition: TimeStepper.h:26
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:186
registerMooseAction("MooseApp", SetupTimeStepperAction, "setup_time_stepper")
InputParameters validParams< MooseObjectAction >()
std::string _type
The Object type that is being created.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
InputParameters _moose_object_pars
The parameters for the object to be created.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:216
SetupTimeStepperAction(InputParameters parameters)
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:183
InputParameters validParams< SetupTimeStepperAction >()