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 "MFEMOperatorJacobiSmoother.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMOperatorJacobiSmoother); 16 : 17 : InputParameters 18 2214 : MFEMOperatorJacobiSmoother::validParams() 19 : { 20 2214 : InputParameters params = Moose::MFEM::LinearSolverBase::validParams(); 21 4428 : params.addClassDescription("MFEM solver for performing Jacobi smoothing of the equation system."); 22 4428 : params.addParam<double>( 23 : "damping", 24 4428 : 1.0, 25 : "Damping factor omega for the scaled-Jacobi iteration y = omega * D^{-1} * x. " 26 : "When used as a multigrid smoother, omega must satisfy omega < 2/lambda_max(D^{-1}A)."); 27 2214 : return params; 28 0 : } 29 : 30 44 : MFEMOperatorJacobiSmoother::MFEMOperatorJacobiSmoother(const InputParameters & parameters) 31 44 : : Moose::MFEM::LinearSolverBase(parameters) 32 : { 33 44 : ConstructSolver(); 34 44 : } 35 : 36 : void 37 44 : MFEMOperatorJacobiSmoother::ConstructSolver() 38 : { 39 88 : _solver = std::make_unique<mfem::OperatorJacobiSmoother>(getParam<double>("damping")); 40 88 : _solver->iterative_mode = getParam<bool>("use_initial_guess"); 41 44 : } 42 : 43 : void 44 31 : MFEMOperatorJacobiSmoother::SetupLOR(mfem::ParBilinearForm & a, mfem::Array<int> & ess_bdr_markers) 45 : { 46 31 : if (_lor) 47 : { 48 31 : CheckSpectralEquivalence(a); 49 31 : mfem::Array<int> ess_tdofs; 50 31 : a.ParFESpace()->GetEssentialTrueDofs(ess_bdr_markers, ess_tdofs); 51 31 : _solver.reset(new mfem::LORSolver<mfem::OperatorJacobiSmoother>(a, ess_tdofs)); 52 31 : } 53 31 : } 54 : 55 : #endif