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