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 
15 
18 {
20  params.addClassDescription("Hypre auxiliary-space divergence solver and preconditioner for the "
21  "iterative solution of MFEM equation systems.");
22  params.addParam<UserObjectName>("fespace", "H(div) FESpace to use in HypreADS setup.");
23  params.addParam<int>("print_level", 2, "Set the solver verbosity.");
24 
25  return params;
26 }
27 
29  : MFEMSolverBase(parameters), _mfem_fespace(getUserObject<MFEMFESpace>("fespace"))
30 {
32 }
33 
34 void
36 {
37  auto solver = std::make_unique<mfem::HypreADS>(_mfem_fespace.getFESpace().get());
38  solver->SetPrintLevel(getParam<int>("print_level"));
39 
40  _solver = std::move(solver);
41 }
42 
43 void
44 MFEMHypreADS::updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs)
45 {
46  if (_lor)
47  {
49  mooseError("Low-Order-Refined solver requires the FESpace closed_basis to be GaussLobatto "
50  "and the open-basis to be IntegratedGLL for ND and RT elements.");
51 
52  if (_mfem_fespace.getFESpace()->GetMesh()->GetElement(0)->GetGeometryType() !=
53  mfem::Geometry::Type::CUBE)
54  mooseError("LOR HypreADS Solver only supports hex meshes.");
55 
56  auto lor_solver = new mfem::LORSolver<mfem::HypreADS>(a, tdofs);
57  lor_solver->GetSolver().SetPrintLevel(getParam<int>("print_level"));
58  _solver.reset(lor_solver);
59  }
60 }
61 
62 #endif
Wrapper for mfem::HypreADS solver.
Definition: MFEMHypreADS.h:19
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:127
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
void constructSolver(const InputParameters &parameters) override
Override in derived classes to construct and set the solver options.
Definition: MFEMHypreADS.C:35
static InputParameters validParams()
Definition: MFEMHypreADS.C:17
MFEMHypreADS(const InputParameters &)
Definition: MFEMHypreADS.C:28
Constructs and stores an mfem::ParFiniteElementSpace object.
Definition: MFEMFESpace.h:22
virtual bool checkSpectralEquivalence(mfem::ParBilinearForm &blf) const
Checks for the correct configuration of quadrature bases for LOR spectral equivalence.
bool _lor
Variable defining whether to use LOR solver.
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...
Definition: MooseBase.h:267
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...
void updateSolver(mfem::ParBilinearForm &a, mfem::Array< int > &tdofs) override
Updates the solver with the bilinear form in case LOR solve is required.
Definition: MFEMHypreADS.C:44
std::shared_ptr< mfem::ParFiniteElementSpace > getFESpace() const
Returns a shared pointer to the constructed fespace.
Definition: MFEMFESpace.h:38
registerMooseObject("MooseApp", MFEMHypreADS)
const MFEMFESpace & _mfem_fespace
Definition: MFEMHypreADS.h:33
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.