Line data Source code
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 : 20 : InputParameters 21 300 : SetupPredictorAction::validParams() 22 : { 23 300 : InputParameters params = MooseObjectAction::validParams(); 24 300 : params.addClassDescription("Add a Predictor object to the simulation."); 25 300 : return params; 26 0 : } 27 : 28 97 : SetupPredictorAction::SetupPredictorAction(const InputParameters & parameters) 29 97 : : MooseObjectAction(parameters) 30 : { 31 97 : } 32 : 33 : void 34 97 : SetupPredictorAction::act() 35 : { 36 97 : if (_problem->isTransient()) 37 : { 38 97 : TransientBase * transient = dynamic_cast<TransientBase *>(_app.getExecutioner()); 39 97 : if (!transient) 40 0 : mooseError("You can setup time stepper only with executioners of transient type."); 41 : 42 97 : _moose_object_pars.set<TransientBase *>("_executioner") = transient; 43 : std::shared_ptr<Predictor> predictor = 44 97 : _factory.create<Predictor>(_type, "Predictor", _moose_object_pars); 45 97 : predictor->_nl.setPredictor(predictor); 46 97 : } 47 97 : }