10 #ifdef MOOSE_MFEM_ENABLED 23 "Base class for defining linear mfem::Solver derived classes for Moose.");
24 params.
addParam<
bool>(
"low_order_refined",
false,
"Set usage of Low-Order Refined solver.");
29 :
SolverBase(parameters), _lor{getParam<bool>(
"low_order_refined")}, _preconditioner{
nullptr}
42 "Moose::MFEM::SolverBase", getParam<MFEMSolverName>(
"preconditioner"));
48 mooseError(
"Eigensolvers cannot be used as preconditioners.");
51 if constexpr (std::is_base_of_v<mfem::HypreSolver, T> || std::is_same_v<mfem::HypreAME, T>)
52 if (
auto *
const hypre_pre = dynamic_cast<mfem::HypreSolver *>(&mfem_pre))
53 solver.SetPreconditioner(*hypre_pre);
55 mooseError(
"hypre solver preconditioners must themselves be hypre solvers");
57 solver.SetPreconditioner(mfem_pre);
72 mooseAssert(
_solver,
"setOperator called before the solver was constructed");
79 if (
auto fec = dynamic_cast<const mfem::H1_FECollection *>(blf.FESpace()->FEColl()))
81 if (fec->GetBasisType() != mfem::BasisType::GaussLobatto)
82 mooseError(
"Low-Order-Refined solver requires the FESpace basis to be GaussLobatto " 85 else if (
auto fec = dynamic_cast<const mfem::ND_FECollection *>(blf.FESpace()->FEColl()))
87 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
88 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
89 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 90 "and the open-basis to be IntegratedGLL for ND elements.");
92 else if (
auto fec = dynamic_cast<const mfem::RT_FECollection *>(blf.FESpace()->FEColl()))
94 if (fec->GetClosedBasisType() != mfem::BasisType::GaussLobatto ||
95 fec->GetOpenBasisType() != mfem::BasisType::IntegratedGLL)
96 mooseError(
"Low-Order-Refined solver requires the FESpace closed-basis to be GaussLobatto " 97 "and the open-basis to be IntegratedGLL for RT elements.");
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 SetOperator(mfem::OperatorHandle &op)
Updates the solver at the operator level.
LinearSolverBase(const InputParameters ¶meters)
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.
LinearSolverBase * GetPreconditioner()
Returns this solver's preconditioner.
static InputParameters validParams()
std::shared_ptr< LinearSolverBase > _preconditioner
Preconditioner to be used for the problem.
Base class for linear MFEM solvers and preconditioners.
static InputParameters validParams()
Base class for wrapping mfem::Solver-derived classes.
void SetPreconditioner(T &solver)
Retrieves the preconditioner userobject if present, sets the member pointer to said object if still u...
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...
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
virtual void CheckSpectralEquivalence(mfem::ParBilinearForm &blf) const
Checks for the correct configuration of quadrature bases for LOR spectral equivalence.
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.