https://mooseframework.inl.gov
MFEMMUMPS.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 "MFEMMUMPS.h"
13 #include "MFEMProblem.h"
14 
15 registerMooseObject("MooseApp", MFEMMUMPS);
16 
19 {
21  params.addClassDescription("MFEM solver for performing direct solves of sparse systems in "
22  "parallel using the MUMPS library.");
23  params.addParam<int>("print_level", 2, "Set the solver verbosity.");
24 
25  return params;
26 }
27 
28 MFEMMUMPS::MFEMMUMPS(const InputParameters & parameters) : Moose::MFEM::LinearSolverBase(parameters)
29 {
31 }
32 
33 void
35 {
36  auto solver = std::make_unique<mfem::MUMPSSolver>(getMFEMProblem().getComm());
37  solver->iterative_mode = getParam<bool>("use_initial_guess");
38  solver->SetPrintLevel(getParam<int>("print_level"));
39  _solver = std::move(solver);
40 }
41 
42 void
43 MFEMMUMPS::SetupLOR(mfem::ParBilinearForm &, mfem::Array<int> &)
44 {
45  if (_lor)
46  mooseError("MUMPS solver does not support LOR solve");
47 }
48 
49 #endif
Wrapper for mfem::MUMPSSolver.
Definition: MFEMMUMPS.h:19
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
Definition: MFEMMUMPS.C:34
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition: MFEMObject.h:45
registerMooseObject("MooseApp", MFEMMUMPS)
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...
static InputParameters validParams()
bool _lor
Variable defining whether to use LOR solver.
MPI_Comm getComm()
Return the MPI communicator associated with this FE problem&#39;s mesh.
Definition: MFEMProblem.h:264
MFEMMUMPS(const InputParameters &parameters)
Definition: MFEMMUMPS.C:28
static InputParameters validParams()
Definition: MFEMMUMPS.C:18
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:281
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...
void SetupLOR(mfem::ParBilinearForm &a, mfem::Array< int > &tdofs) override
Updates the solver with the bilinear form in case LOR solve is required.
Definition: MFEMMUMPS.C:43