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 "MultiSystemSolveObject.h" 11 : #include "FEProblemBase.h" 12 : #include "LinearSystem.h" 13 : #include "NonlinearSystem.h" 14 : 15 : InputParameters 16 297171 : MultiSystemSolveObject::validParams() 17 : { 18 297171 : InputParameters params = emptyInputParameters(); 19 1188684 : params.addParam<std::vector<SolverSystemName>>( 20 : "system_names", 21 : "Names of the solver systems (both linear and nonlinear) that will be solved"); 22 891513 : params.addParamNamesToGroup("system_names", "Multiple solver system"); 23 297171 : return params; 24 0 : } 25 : 26 62571 : MultiSystemSolveObject::MultiSystemSolveObject(Executioner & ex) : SolveObject(ex) 27 : { 28 : // Retrieve pointers to all the systems from the problem by default 29 62571 : const auto & nl_sys_names = _problem.getNonlinearSystemNames(); 30 62571 : const auto & linear_sys_names = _problem.getLinearSystemNames(); 31 187713 : if (!isParamValid("system_names")) 32 : { 33 122698 : for (const auto & sys_name : nl_sys_names) 34 61454 : _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name))); 35 61257 : for (const auto & sys_name : linear_sys_names) 36 13 : _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name))); 37 61244 : _num_nl_systems = nl_sys_names.size(); 38 : } 39 : else 40 : { 41 1327 : _num_nl_systems = 0; 42 : // Retrieve pointers to all the user-specified systems in the order that the user specified them 43 5384 : for (const auto & sys_name : getParam<std::vector<SolverSystemName>>("system_names")) 44 : { 45 1403 : if (std::find(nl_sys_names.begin(), nl_sys_names.end(), sys_name) != nl_sys_names.end()) 46 : { 47 76 : _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name))); 48 76 : _num_nl_systems++; 49 : } 50 1327 : else if (std::find(linear_sys_names.begin(), linear_sys_names.end(), sys_name) != 51 2654 : linear_sys_names.end()) 52 1327 : _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name))); 53 : else 54 0 : paramError("system_names", 55 0 : "System '" + sys_name + 56 : "' was not found in the Problem. Did you forget to declare it in the " 57 : "[Problem] block?"); 58 : } 59 : } 60 62571 : }