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 236 : EquationSystemProblemOperator::SetGridFunctions() 18 : { 19 236 : _test_var_names = GetEquationSystem()->TestVarNames(); 20 236 : _trial_var_names = GetEquationSystem()->TrialVarNames(); 21 236 : ProblemOperator::SetGridFunctions(); 22 236 : } 23 : 24 : void 25 236 : EquationSystemProblemOperator::Init(mfem::BlockVector & X) 26 : { 27 236 : ProblemOperator::Init(X); 28 : 29 236 : GetEquationSystem()->BuildEquationSystem(); 30 236 : } 31 : 32 : void 33 188 : EquationSystemProblemOperator::Solve() 34 : { 35 188 : GetEquationSystem()->BuildJacobian(_true_x, _true_rhs); 36 : 37 188 : 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 188 : _problem_data.jacobian_solver->updateSolver( 41 188 : *_equation_system->_blfs.Get(_equation_system->_test_var_names.at(0)), 42 188 : _equation_system->_ess_tdof_lists.at(0)); 43 : 44 188 : _problem_data.nonlinear_solver->SetSolver(_problem_data.jacobian_solver->getSolver()); 45 188 : _problem_data.nonlinear_solver->SetOperator(*GetEquationSystem()); 46 188 : _problem_data.nonlinear_solver->Mult(_true_rhs, _true_x); 47 : 48 188 : GetEquationSystem()->RecoverFEMSolution(_true_x, _problem_data.gridfunctions); 49 188 : } 50 : 51 : } // namespace Moose::MFEM 52 : 53 : #endif