10 #ifdef MOOSE_MFEM_ENABLED 18 params.
addClassDescription(
"Base class for defining mfem::Solver derived classes for Moose.");
20 params.
addParam<
bool>(
"low_order_refined",
false,
"Set usage of Low-Order Refined solver.");
27 _lor{getParam<bool>(
"low_order_refined")},
29 _preconditioner{
nullptr}
41 &
const_cast<MFEMSolverBase &
>(getUserObject<MFEMSolverBase>(
"preconditioner"));
44 if constexpr (std::is_base_of_v<mfem::HypreSolver, T>)
45 if (
auto *
const hypre_pre = dynamic_cast<mfem::HypreSolver *>(&mfem_pre))
46 solver.SetPreconditioner(*hypre_pre);
48 mooseError(
"hypre solver preconditioners must themselves be hypre solvers");
50 solver.SetPreconditioner(mfem_pre);
52 if constexpr (std::is_same_v<mfem::HypreGMRES, T>)
53 HYPRE_GMRESSetPrecondMatrix(HYPRE_Solver(solver), NULL);
54 else if constexpr (std::is_same_v<mfem::HyprePCG, T>)
55 HYPRE_PCGSetPrecondMatrix(HYPRE_Solver(solver), NULL);
68 if (
auto fec = dynamic_cast<const mfem::H1_FECollection *>(blf.FESpace()->FEColl()))
70 if (fec->GetBasisType() != mfem::BasisType::GaussLobatto)
71 mooseError(
"Low-Order-Refined solver requires the FESpace basis to be GaussLobatto " 74 else if (
auto fec = dynamic_cast<const mfem::ND_FECollection *>(blf.FESpace()->FEColl()))
76 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
77 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
78 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 79 "and the open-basis to be IntegratedGLL for ND elements.");
81 else if (
auto fec = dynamic_cast<const mfem::RT_FECollection *>(blf.FESpace()->FEColl()))
83 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
84 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
85 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 86 "and the open-basis to be IntegratedGLL for RT elements.");
static InputParameters validParams()
virtual void checkSpectralEquivalence(mfem::ParBilinearForm &blf) const
Checks for the correct configuration of quadrature bases for LOR spectral equivalence.
MFEMSolverBase * _preconditioner
Preconditioner to be used for the problem.
static InputParameters validParams()
void setPreconditioner(T &solver)
Retrieves the preconditioner userobject if present, sets the member pointer to said object if still u...
This class adds a getMFEMProblem method.
MFEMSolverBase(const InputParameters ¶meters)
Base class for wrapping mfem::Solver-derived classes.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
mfem::Solver & getSolver()
Returns the wrapped MFEM solver.
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.