10 #ifdef MOOSE_MFEM_ENABLED 20 params.
addClassDescription(
"Base class for defining mfem::Solver derived classes for Moose.");
23 params.
addParam<
bool>(
"low_order_refined",
false,
"Set usage of Low-Order Refined solver.");
30 _lor{getParam<bool>(
"low_order_refined")},
32 _preconditioner{
nullptr}
45 "MFEMSolverBase", getParam<MFEMSolverName>(
"preconditioner")));
51 mooseError(
"Eigensolvers cannot be used as preconditioners.");
54 if constexpr (std::is_base_of_v<mfem::HypreSolver, T> || std::is_same_v<mfem::HypreAME, T>)
55 if (
auto *
const hypre_pre = dynamic_cast<mfem::HypreSolver *>(&mfem_pre))
56 solver.SetPreconditioner(*hypre_pre);
58 mooseError(
"hypre solver preconditioners must themselves be hypre solvers");
60 solver.SetPreconditioner(mfem_pre);
75 mooseAssert(
_solver,
"setOperator called before the solver was constructed");
82 if (
auto fec = dynamic_cast<const mfem::H1_FECollection *>(blf.FESpace()->FEColl()))
84 if (fec->GetBasisType() != mfem::BasisType::GaussLobatto)
85 mooseError(
"Low-Order-Refined solver requires the FESpace basis to be GaussLobatto " 88 else if (
auto fec = dynamic_cast<const mfem::ND_FECollection *>(blf.FESpace()->FEColl()))
90 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
91 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
92 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 93 "and the open-basis to be IntegratedGLL for ND elements.");
95 else if (
auto fec = dynamic_cast<const mfem::RT_FECollection *>(blf.FESpace()->FEColl()))
97 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
98 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
99 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 100 "and the open-basis to be IntegratedGLL for RT elements.");
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
T & getMFEMObject(const std::string &system, const std::string &name, const THREAD_ID tid=0) const
Retrieve an MFEM object from the warehouse by system and name.
virtual void checkSpectralEquivalence(mfem::ParBilinearForm &blf) const
Checks for the correct configuration of quadrature bases for LOR spectral equivalence.
static InputParameters validParams()
void setPreconditioner(T &solver)
Retrieves the preconditioner userobject if present, sets the member pointer to said object if still u...
MFEMSolverBase(const InputParameters ¶meters)
MFEMSolverBase * getPreconditioner()
Returns this solver's preconditioner.
static InputParameters validParams()
Declare the common parameters required by MFEM MooseObject-backed classes.
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...
virtual void setOperator(mfem::OperatorHandle &op)
Sets an already-assembled operator on the wrapped 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.
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.
std::shared_ptr< MFEMSolverBase > _preconditioner
Preconditioner to be used for the problem.