10#ifdef MOOSE_MFEM_ENABLED
22 params.
addClassDescription(
"Hypre BoomerAMG solver and preconditioner for the iterative solution "
23 "of MFEM equation systems.");
24 params.
addParam<mfem::real_t>(
"l_tol", 0,
"Set the relative tolerance.");
25 params.
addParam<
int>(
"l_max_its", 1,
"Set the maximum number of iterations.");
28 params.
addParam<
int>(
"print_level", 2,
"Set the solver verbosity.");
31 "Vector H1 FESpace of the unknown, required when vector_treatment is 'by_component' or "
32 "'rigid_body_modes'.");
33 MooseEnum vector_treatment(
"auto scalar by_component rigid_body_modes",
"auto");
36 "Specifies how BoomerAMG treats the components of a vector unknown.");
38 "Coarsens all degrees of "
39 "freedom together as one unknown.");
40 vector_treatment.addDocumentation(
42 "Coarsens each component separately and "
43 "does not interpolate between them (hypre's 'unknown' approach, SetSystemsOptions).");
44 vector_treatment.addDocumentation(
46 "Adds the rigid body modes of the fespace to the interpolation "
47 "(hypre's GM/LN approach, SetElasticityOptions). Only applied on the CPU.");
48 vector_treatment.addDocumentation(
"auto",
49 "Applies 'rigid_body_modes' vector_treatment option if fespace "
50 "is set and 'scalar' otherwise.");
54 "HypreBoomerAMG strong threshold. Defaults to 0.25, or to 0.5 when vector_treatment is "
55 "'by_component' or 'rigid_body_modes'.");
56 MooseEnum errmode(
"ignore=0 warn=1 abort=2",
"abort");
57 params.
addParam<
MooseEnum>(
"error_mode", errmode,
"Set the behavior for treating hypre errors.");
62 :
Moose::MFEM::LORLinearSolverBase<
mfem::HypreBoomerAMG>(parameters),
64 isParamSetByUser(
"fespace")
66 .getMFEMObject<
MFEMFESpace>(
"MFEMFESpace", getParam<MFEMFESpaceName>(
"fespace"))
76 "is only used when vector_treatment is 'by_component' or 'rigid_body_modes'.");
81 "'by_component' and 'rigid_body_modes' require fespace to be set.");
84 "must be a vector space when vector_treatment is 'by_component' or "
85 "'rigid_body_modes'.");
90 "must have ordering = VDIM when vector_treatment is 'by_component' or "
91 "'rigid_body_modes'.");
102 auto solver = std::make_unique<mfem::HypreBoomerAMG>();
110 solver.iterative_mode = getParam<bool>(
"use_initial_guess");
111 solver.SetTol(getParam<mfem::real_t>(
"l_tol"));
112 solver.SetMaxIter(getParam<int>(
"l_max_its"));
113 solver.SetPrintLevel(getParam<int>(
"print_level"));
114 solver.SetErrorMode(mfem::HypreSolver::ErrorMode(
int(getParam<MooseEnum>(
"error_mode"))));
122 if (!mfem::HypreUsingGPU())
132 solver.SetStrengthThresh(getParam<mfem::real_t>(
"strength_threshold"));
registerMooseObject("MooseApp", MFEMHypreBoomerAMG)
Constructs and stores an mfem::ParFiniteElementSpace object.
Wrapper for mfem::HypreBoomerAMG solver.
MFEMHypreBoomerAMG(const InputParameters &)
std::shared_ptr< mfem::ParFiniteElementSpace > _mfem_fespace
VectorTreatment
How BoomerAMG treats the components of a vector unknown.
VectorTreatment _vector_treatment
The vector treatment in use, with AUTO resolved.
virtual void SetSolverParameters(mfem::HypreBoomerAMG &solver) override
Update the wrapped MFEM solver parameters.
static InputParameters validParams()
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
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.
void addDocumentation(const std::string &name, const std::string &doc)
Add an item documentation string.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static InputParameters validParams()
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...