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);
66 if (
auto fec = dynamic_cast<const mfem::H1_FECollection *>(blf.FESpace()->FEColl()))
68 if (fec->GetBasisType() != mfem::BasisType::GaussLobatto)
69 mooseError(
"Low-Order-Refined solver requires the FESpace basis to be GaussLobatto " 72 else if (
auto fec = dynamic_cast<const mfem::ND_FECollection *>(blf.FESpace()->FEColl()))
74 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
75 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
76 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 77 "and the open-basis to be IntegratedGLL for ND elements.");
79 else if (
auto fec = dynamic_cast<const mfem::RT_FECollection *>(blf.FESpace()->FEColl()))
81 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
82 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
83 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 84 "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)
Patch for mfem::HypreGMRES to reset preconditioning matrix at every nonlinear/time iteration...
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...
Patch for mfem::HyprePCG to reset preconditioning matrix at every nonlinear/time iteration.
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.