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 "ExternalProblem.h" 12 : #include "NonlinearSystem.h" 13 : #include "AuxiliarySystem.h" 14 : 15 : InputParameters 16 52035 : ExternalProblem::validParams() 17 : { 18 52035 : InputParameters params = FEProblemBase::validParams(); 19 52035 : params.set<bool>("skip_nl_system_check") = true; 20 : 21 : // there is no nonlinear system (we set it as empty in the constructor) 22 52035 : params.suppressParameter<bool>("ignore_zeros_in_jacobian"); 23 52035 : params.suppressParameter<MooseEnum>("kernel_coverage_check"); 24 52035 : params.suppressParameter<std::vector<NonlinearSystemName>>("nl_sys_names"); 25 52035 : params.suppressParameter<bool>("previous_nl_solution_required"); 26 52035 : params.suppressParameter<bool>("skip_nl_system_check"); 27 52035 : params.suppressParameter<bool>("use_nonlinear"); 28 : 29 52035 : params.addClassDescription("Problem extension point for wrapping external applications"); 30 52035 : return params; 31 0 : } 32 : 33 308 : ExternalProblem::ExternalProblem(const InputParameters & parameters) : FEProblemBase(parameters) 34 : { 35 : /** 36 : * Ideally the nonlinear system should not exist since we won't ever use it or call solve on it. 37 : * However, MOOSE currently expects it to exist in several locations throughout the framework. 38 : * Luckily, it can just be empty (no variables). 39 : */ 40 308 : if (_num_nl_sys) 41 : { 42 308 : _nl[0] = std::make_shared<NonlinearSystem>(*this, "nl0"); 43 308 : _solver_systems[0] = std::dynamic_pointer_cast<SolverSystem>(_nl[0]); 44 : } 45 308 : _aux = std::make_shared<AuxiliarySystem>(*this, "aux0"); 46 : 47 : /** 48 : * We still need to create Assembly objects to hold the data structures for working with Aux 49 : * Variables, which will be used in the external problem. 50 : */ 51 308 : newAssemblyArray(_solver_systems); 52 : 53 : // Create extra vectors and matrices if any 54 308 : createTagVectors(); 55 : 56 : // Create extra solution vectors if any 57 308 : createTagSolutions(); 58 308 : } 59 : 60 : void 61 126 : ExternalProblem::solve(const unsigned int) 62 : { 63 126 : TIME_SECTION("solve", 1, "Solving", false) 64 : 65 126 : syncSolutions(Direction::TO_EXTERNAL_APP); 66 126 : externalSolve(); 67 126 : syncSolutions(Direction::FROM_EXTERNAL_APP); 68 126 : }