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", 1e-5,
"Set the relative tolerance.");
25 params.
addParam<
int>(
"l_max_its", 10000,
"Set the maximum number of iterations.");
26 params.
addParam<
int>(
"print_level", 2,
"Set the solver verbosity.");
29 "Vector H1 FESpace of the unknown, required when vector_treatment is 'by_component' or "
30 "'rigid_body_modes'.");
31 MooseEnum vector_treatment(
"auto scalar by_component rigid_body_modes",
"auto");
34 "Specifies how BoomerAMG treats the components of a vector unknown.");
36 "Coarsens all degrees of "
37 "freedom together as one unknown.");
38 vector_treatment.addDocumentation(
40 "Coarsens each component separately and "
41 "does not interpolate between them (hypre's 'unknown' approach, SetSystemsOptions).");
42 vector_treatment.addDocumentation(
44 "Adds the rigid body modes of the fespace to the interpolation "
45 "(hypre's GM/LN approach, SetElasticityOptions). Only applied on the CPU.");
46 vector_treatment.addDocumentation(
"auto",
47 "Applies 'rigid_body_modes' vector_treatment option if fespace "
48 "is set and 'scalar' otherwise.");
52 "HypreBoomerAMG strong threshold. Defaults to 0.25, or to 0.5 when vector_treatment is "
53 "'by_component' or 'rigid_body_modes'.");
54 MooseEnum errmode(
"ignore=0 warn=1 abort=2",
"abort");
55 params.
addParam<
MooseEnum>(
"error_mode", errmode,
"Set the behavior for treating hypre errors.");
60 :
Moose::MFEM::LORLinearSolverBase<
mfem::HypreBoomerAMG>(parameters),
62 isParamSetByUser(
"fespace")
64 .getMFEMObject<
MFEMFESpace>(
"MFEMFESpace", getParam<MFEMFESpaceName>(
"fespace"))
74 "is only used when vector_treatment is 'by_component' or 'rigid_body_modes'.");
79 "'by_component' and 'rigid_body_modes' require fespace to be set.");
82 "must be a vector space when vector_treatment is 'by_component' or "
83 "'rigid_body_modes'.");
88 "must have ordering = VDIM when vector_treatment is 'by_component' or "
89 "'rigid_body_modes'.");
100 auto solver = std::make_unique<mfem::HypreBoomerAMG>();
108 solver.iterative_mode = getParam<bool>(
"use_initial_guess");
109 solver.SetTol(getParam<mfem::real_t>(
"l_tol"));
110 solver.SetMaxIter(getParam<int>(
"l_max_its"));
111 solver.SetPrintLevel(getParam<int>(
"print_level"));
112 solver.SetErrorMode(mfem::HypreSolver::ErrorMode(
int(getParam<MooseEnum>(
"error_mode"))));
120 if (!mfem::HypreUsingGPU())
130 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...