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