https://mooseframework.inl.gov
MFEMHypreADS.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #include "MFEMHypreADS.h"
13 #include "MFEMProblem.h"
14 
16 
19 {
21  params.addClassDescription("Hypre auxiliary-space divergence solver and preconditioner for the "
22  "iterative solution of MFEM equation systems.");
23  params.addParam<MFEMFESpaceName>("fespace", "H(div) FESpace to use in HypreADS setup.");
24  params.addParam<int>("print_level", 2, "Set the solver verbosity.");
25 
26  return params;
27 }
28 
30  : Moose::MFEM::LORLinearSolverBase<mfem::HypreADS>(parameters),
31  _mfem_fespace(getMFEMProblem().getMFEMObject<MFEMFESpace>("MFEMFESpace",
32  getParam<MFEMFESpaceName>("fespace")))
33 {
35 }
36 
37 void
39 {
40  auto solver = std::make_unique<mfem::HypreADS>(_mfem_fespace.getFESpace().get());
41  SetSolverParameters(*solver);
42  _solver = std::move(solver);
43 }
44 
45 void
46 MFEMHypreADS::SetSolverParameters(mfem::HypreADS & solver)
47 {
48  solver.iterative_mode = getParam<bool>("use_initial_guess");
49  solver.SetPrintLevel(getParam<int>("print_level"));
50 }
51 
52 #endif
Wrapper for mfem::HypreADS solver.
Definition: MFEMHypreADS.h:20
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
Definition: MFEMHypreADS.C:38
virtual void SetSolverParameters(mfem::HypreADS &solver) override
Update the wrapped MFEM solver parameters.
Definition: MFEMHypreADS.C:46
static InputParameters validParams()
Definition: MFEMHypreADS.C:18
MFEMHypreADS(const InputParameters &)
Definition: MFEMHypreADS.C:29
Constructs and stores an mfem::ParFiniteElementSpace object.
Definition: MFEMFESpace.h:20
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
std::shared_ptr< mfem::ParFiniteElementSpace > getFESpace() const
Returns a shared pointer to the constructed fespace.
Definition: MFEMFESpace.h:36
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
registerMooseObject("MooseApp", MFEMHypreADS)
const MFEMFESpace & _mfem_fespace
Definition: MFEMHypreADS.h:34