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 : #include "SubChannelCreateProblemAction.h" 11 : #include "ActionFactory.h" 12 : #include "SubChannelApp.h" 13 : #include "FEProblemBase.h" 14 : #include "SCM.h" 15 : #include "SubChannelMesh.h" 16 : 17 : registerMooseAction("SubChannelApp", SubChannelCreateProblemAction, "create_problem"); 18 : 19 : InputParameters 20 297 : SubChannelCreateProblemAction::validParams() 21 : { 22 297 : InputParameters params = MooseObjectAction::validParams(); 23 297 : params.addClassDescription("Creates the input block that encopasses all the problem parameters"); 24 594 : params.addRequiredParam<std::string>("type", "Problem type"); 25 594 : params.addParam<std::string>("name", "SubChannel Problem", "The name of the problem"); 26 297 : return params; 27 0 : } 28 : 29 297 : SubChannelCreateProblemAction::SubChannelCreateProblemAction(const InputParameters & parameters) 30 297 : : MooseObjectAction(parameters) 31 : { 32 297 : } 33 : 34 : void 35 297 : SubChannelCreateProblemAction::act() 36 : { 37 : // build the problem only if we have mesh 38 297 : if (_mesh.get() != NULL) 39 : { 40 : // when this action is built by parser with Problem input block, this action 41 : // must act i.e. create a problem. Thus if a problem has been created, it will error out. 42 297 : if (_problem) 43 0 : mooseError("Trying to build a problem but problem has already existed"); 44 : 45 297 : _moose_object_pars.set<MooseMesh *>("mesh") = _mesh.get(); 46 297 : _moose_object_pars.set<bool>("use_nonlinear") = _app.useNonlinear(); 47 : 48 297 : _problem = 49 891 : _factory.create<FEProblemBase>(_type, getParam<std::string>("name"), _moose_object_pars); 50 : } 51 297 : }