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 : #ifdef MOOSE_MFEM_ENABLED 11 : 12 : #include "EquationSystemProblemOperator.h" 13 : 14 : namespace Moose::MFEM 15 : { 16 : void 17 205 : EquationSystemProblemOperator::SetGridFunctions() 18 : { 19 205 : _test_var_names = GetEquationSystem()->TestVarNames(); 20 205 : _trial_var_names = GetEquationSystem()->TrialVarNames(); 21 205 : ProblemOperator::SetGridFunctions(); 22 205 : } 23 : 24 : void 25 205 : EquationSystemProblemOperator::Init(mfem::BlockVector & X) 26 : { 27 205 : ProblemOperator::Init(X); 28 : 29 205 : GetEquationSystem()->BuildEquationSystem(); 30 205 : } 31 : 32 : void 33 157 : EquationSystemProblemOperator::Solve() 34 : { 35 157 : GetEquationSystem()->BuildJacobian(_true_x, _true_rhs); 36 : 37 157 : if (_problem_data.jacobian_solver->isLOR() && _equation_system->_test_var_names.size() > 1) 38 0 : mooseError("LOR solve is only supported for single-variable systems"); 39 : 40 157 : _problem_data.jacobian_solver->updateSolver( 41 157 : *_equation_system->_blfs.Get(_equation_system->_test_var_names.at(0)), 42 157 : _equation_system->_ess_tdof_lists.at(0)); 43 : 44 157 : _problem_data.nonlinear_solver->SetSolver(_problem_data.jacobian_solver->getSolver()); 45 157 : _problem_data.nonlinear_solver->SetOperator(*GetEquationSystem()); 46 157 : _problem_data.nonlinear_solver->Mult(_true_rhs, _true_x); 47 : 48 157 : GetEquationSystem()->RecoverFEMSolution(_true_x, _problem_data.gridfunctions); 49 157 : } 50 : 51 : } // namespace Moose::MFEM 52 : 53 : #endif