https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AddTimeStepperAction.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 "TimeStepper.h"
12#include "FEProblemBase.h"
13#include "TransientBase.h"
14
15registerMooseAction("MooseApp", AddTimeStepperAction, "add_time_stepper");
16registerMooseAction("MooseApp", AddTimeStepperAction, "add_time_steppers");
17
20{
22 params.addClassDescription("Add a TimeStepper object to the simulation.");
23 return params;
24}
25
30
31void
33{
34 std::string name;
35 // Task: add_time_stepper corresponding to [TimeStepper] block
36 if (_current_task == "add_time_stepper")
37 name = _type;
38 // Task: add_time_steppers corresponding to [TimeSteppers] block
39 else
40 name = _name;
41
42 TransientBase * transient = dynamic_cast<TransientBase *>(_app.getExecutioner());
43 if (!transient)
44 mooseError("Cannot add TimeSteppers without a Transient executioner");
45 _moose_object_pars.set<TransientBase *>("_executioner") = transient;
46
47 auto ts =
48 _problem->addObject<TimeStepper>(_type, name, _moose_object_pars, /* threaded = */ false)[0];
49
50 if (name == "TimeStepper" || name == "CompositionDT")
51 ts->mooseError("The user-defined time stepper name '", name, "' is a reserved name");
52}
registerMooseAction("MooseApp", AddTimeStepperAction, "add_time_stepper")
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition Action.h:178
const std::string & _current_task
The current action (even though we have separate instances for each action)
Definition Action.h:172
Add all timestepper(s) info from input.
static InputParameters validParams()
AddTimeStepperAction(const InputParameters &params)
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition MooseApp.C:2015
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
const std::string & _name
The name of this class.
Definition MooseBase.h:381
InputParameters _moose_object_pars
The parameters for the object to be created.
static InputParameters validParams()
std::string _type
The Object type that is being created.
Base class for time stepping.
Definition TimeStepper.h:23
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...