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