https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMHypreAME.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 "MFEMHypreAME.h"
13#include "MFEMProblem.h"
14
16
19{
21 params.addClassDescription("Hypre auxiliary-space Maxwell eigensolver to compute the lowest "
22 "eigenmodes of a generalized eigenvalue problem.");
23
24 return params;
25}
26
28 : Moose::MFEM::EigensolverBase(parameters)
29{
31}
32
33void
35{
36 _eigensolver = std::make_unique<mfem::HypreAME>(getMFEMProblem().getComm());
37
38 _eigensolver->SetNumModes(_num_modes);
39 _eigensolver->SetMaxIter(getParam<int>("l_max_its"));
40 _eigensolver->SetTol(getParam<mfem::real_t>("l_tol"));
41 _eigensolver->SetPrintLevel(getParam<int>("print_level"));
42}
43
44void
46{
47 if (auto * prec = dynamic_cast<mfem::HypreSolver *>(&_preconditioner->GetSolver()))
48 _eigensolver->SetPreconditioner(*prec);
49 else
50 paramError("preconditioner", "MFEMHypreAME requires a hypre solver as its preconditioner");
51}
52
53#endif
registerMooseObject("MooseApp", MFEMHypreAME)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
Class for the HypreAME eigensolver.
virtual void ConstructSolver() override
Override in derived classes to construct and set the solver options.
static InputParameters validParams()
MFEMHypreAME(const InputParameters &parameters)
std::unique_ptr< mfem::HypreAME > _eigensolver
Eigensolver to be used for the problem.
virtual void SetPreconditionerImpl() override
Override in solvers that accept a preconditioner.
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition MFEMObject.h:45
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
static InputParameters validParams()
int _num_modes
Number of eigenmodes to compute.
std::shared_ptr< LinearSolverBase > _preconditioner
Preconditioner 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...