www.mooseframework.org
SetupPredictorAction.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 // MOOSE includes
11 #include "SetupPredictorAction.h"
12 #include "Transient.h"
13 #include "Predictor.h"
14 #include "Factory.h"
15 #include "NonlinearSystemBase.h"
16 
17 registerMooseAction("MooseApp", SetupPredictorAction, "setup_predictor");
18 
19 template <>
22 {
24 
25  return params;
26 }
27 
29  : MooseObjectAction(parameters)
30 {
31 }
32 
33 void
35 {
36  if (_problem->isTransient())
37  {
38  Transient * transient = dynamic_cast<Transient *>(_app.getExecutioner());
39  if (!transient)
40  mooseError("You can setup time stepper only with executioners of transient type.");
41 
42  _moose_object_pars.set<Transient *>("_executioner") = transient;
43  std::shared_ptr<Predictor> predictor =
45  _problem->getNonlinearSystemBase().setPredictor(predictor);
46  }
47 }
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
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:30
Base class for predictors.
Definition: Predictor.h:33
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.
Sets the predictor.
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", SetupPredictorAction, "setup_predictor")
InputParameters validParams< SetupPredictorAction >()
InputParameters validParams< MooseObjectAction >()
std::string _type
The Object type that is being created.
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
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:183
SetupPredictorAction(InputParameters parameters)