https://mooseframework.inl.gov
SetupPredictorAction.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 
10 // MOOSE includes
11 #include "SetupPredictorAction.h"
12 #include "TransientBase.h"
13 #include "Predictor.h"
14 #include "Factory.h"
15 #include "NonlinearSystemBase.h"
16 #include "FEProblemBase.h"
17 
18 registerMooseAction("MooseApp", SetupPredictorAction, "setup_predictor");
19 
22 {
24  params.addClassDescription("Add a Predictor object to the simulation.");
25  return params;
26 }
27 
29  : MooseObjectAction(parameters)
30 {
31 }
32 
33 void
35 {
36  if (_problem->isTransient())
37  {
38  TransientBase * transient = dynamic_cast<TransientBase *>(_app.getExecutioner());
39  if (!transient)
40  mooseError("You can setup time stepper only with executioners of transient type.");
41 
42  _moose_object_pars.set<TransientBase *>("_executioner") = transient;
43  std::shared_ptr<Predictor> predictor =
45  predictor->_nl.setPredictor(predictor);
46  }
47 }
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
Base class for predictors.
Definition: Predictor.h:28
static InputParameters validParams()
Factory & _factory
The Factory associated with the MooseApp.
NonlinearSystemBase & _nl
Definition: Predictor.h:45
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:111
Sets the predictor.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseAction("MooseApp", SetupPredictorAction, "setup_predictor")
static InputParameters validParams()
void setPredictor(std::shared_ptr< Predictor > predictor)
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Definition: TransientBase.h:27
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:353
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.C:2123
std::string _type
The Object type that is being created.
InputParameters _moose_object_pars
The parameters for the object to be created.
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:267
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...
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:171
SetupPredictorAction(const InputParameters &parameters)