https://mooseframework.inl.gov
MFEMHypreLOBPCG.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 "MFEMHypreLOBPCG.h"
13 #include "MFEMProblem.h"
14 
16 
19 {
21 
22  params.addClassDescription("Locally Optimal Block PCG eigensolver to iteratively compute the "
23  "lowest eigenmodes of a generalized eigenvalue problem.");
24  params.addParam<int>("random_seed", 123, "Set the random seed for the solver.");
25 
26  return params;
27 }
28 
30  : Moose::MFEM::EigensolverBase(parameters)
31 {
33 }
34 
35 void
37 {
38  _eigensolver = std::make_unique<mfem::HypreLOBPCG>(getMFEMProblem().getComm());
39 
40  _eigensolver->SetNumModes(_num_modes);
41  _eigensolver->SetRandomSeed(getParam<int>("random_seed"));
42  _eigensolver->SetMaxIter(getParam<int>("l_max_its"));
43  _eigensolver->SetTol(getParam<mfem::real_t>("l_tol"));
44  _eigensolver->SetPrecondUsageMode(1);
45  _eigensolver->SetPrintLevel(getParam<int>("print_level"));
47 }
48 
49 #endif
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition: MFEMObject.h:45
std::unique_ptr< mfem::HypreLOBPCG > _eigensolver
Eigensolver to be used for the problem.
registerMooseObject("MooseApp", MFEMHypreLOBPCG)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Class for the Hypre LOBPCG eigensolver.
static InputParameters validParams()
virtual void ConstructSolver() override
Override in derived classes to construct and set the solver options.
MFEMHypreLOBPCG(const InputParameters &parameters)
MPI_Comm getComm()
Return the MPI communicator associated with this FE problem&#39;s mesh.
Definition: MFEMProblem.h:260
void SetPreconditioner(T &solver)
Retrieves the preconditioner userobject if present, sets the member pointer to said object if still u...
int _num_modes
Number of eigenmodes to compute.
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...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
static InputParameters validParams()