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 "MFEMHypreADS.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMHypreADS); 16 : 17 : InputParameters 18 2130 : MFEMHypreADS::validParams() 19 : { 20 2130 : InputParameters params = MFEMSolverBase::validParams(); 21 4260 : params.addClassDescription("Hypre auxiliary-space divergence solver and preconditioner for the " 22 : "iterative solution of MFEM equation systems."); 23 8520 : params.addParam<MFEMFESpaceName>("fespace", "H(div) FESpace to use in HypreADS setup."); 24 6390 : params.addParam<int>("print_level", 2, "Set the solver verbosity."); 25 : 26 2130 : return params; 27 0 : } 28 : 29 16 : MFEMHypreADS::MFEMHypreADS(const InputParameters & parameters) 30 : : MFEMSolverBase(parameters), 31 16 : _mfem_fespace(getMFEMProblem().getMFEMObject<MFEMFESpace>("MFEMFESpace", 32 48 : getParam<MFEMFESpaceName>("fespace"))) 33 : { 34 16 : constructSolver(); 35 16 : } 36 : 37 : void 38 16 : MFEMHypreADS::constructSolver() 39 : { 40 16 : auto solver = std::make_unique<mfem::HypreADS>(_mfem_fespace.getFESpace().get()); 41 32 : solver->SetPrintLevel(getParam<int>("print_level")); 42 : 43 16 : _solver = std::move(solver); 44 16 : } 45 : 46 : void 47 14 : MFEMHypreADS::updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs) 48 : { 49 14 : if (_lor) 50 : { 51 7 : checkSpectralEquivalence(a); 52 7 : if (_mfem_fespace.getFESpace()->GetMesh()->GetElement(0)->GetGeometryType() != 53 : mfem::Geometry::Type::CUBE) 54 0 : mooseError("LOR HypreADS Solver only supports hex meshes."); 55 : 56 7 : auto lor_solver = new mfem::LORSolver<mfem::HypreADS>(a, tdofs); 57 14 : lor_solver->GetSolver().SetPrintLevel(getParam<int>("print_level")); 58 7 : _solver.reset(lor_solver); 59 : } 60 14 : } 61 : 62 : #endif