25 #include "smith/numerics/petsc_solvers.hpp"
55 EquationSolver(std::unique_ptr<mfem::NewtonSolver> nonlinear_solver, std::unique_ptr<mfem::Solver> linear_solver,
68 MPI_Comm comm = MPI_COMM_WORLD);
84 void solve(mfem::Vector& x)
const;
129 std::unique_ptr<mfem::Solver> preconditioner_;
134 std::unique_ptr<mfem::Solver> lin_solver_;
139 std::unique_ptr<mfem::NewtonSolver> nonlin_solver_;
146 bool nonlin_solver_set_solver_called_ =
false;
161 superlu_solver_.SetColumnPermutation(mfem::superlu::PARMETIS);
162 if (print_level == 0) {
163 superlu_solver_.SetPrintStatistics(
false);
173 void Mult(
const mfem::Vector& input, mfem::Vector& output)
const;
190 mutable std::unique_ptr<mfem::SuperLURowLocMatrix> superlu_mat_;
197 mfem::SuperLUSolver superlu_solver_;
200 #ifdef MFEM_USE_STRUMPACK
204 class StrumpackSolver :
public mfem::Solver {
211 StrumpackSolver(
int print_level, MPI_Comm comm) : strumpack_solver_(comm)
213 strumpack_solver_.SetKrylovSolver(strumpack::KrylovSolver::DIRECT);
214 strumpack_solver_.SetReorderingStrategy(strumpack::ReorderingStrategy::METIS);
216 if (print_level == 1) {
217 strumpack_solver_.SetPrintFactorStatistics(
true);
218 strumpack_solver_.SetPrintSolveStatistics(
true);
228 void Mult(
const mfem::Vector& input, mfem::Vector& output)
const;
236 void SetOperator(
const mfem::Operator& op);
243 mutable std::unique_ptr<mfem::STRUMPACKRowLocMatrix> strumpack_mat_;
250 mfem::STRUMPACKSolver strumpack_solver_;
263 std::unique_ptr<mfem::HypreParMatrix>
buildMonolithicMatrix(
const mfem::BlockOperator& block_operator);
275 const LinearSolverOptions& linear_opts,
276 mfem::Solver& preconditioner, MPI_Comm comm = MPI_COMM_WORLD);
286 LinearSolverOptions linear_opts = {}, MPI_Comm comm = MPI_COMM_WORLD);
295 [[maybe_unused]] MPI_Comm comm = MPI_COMM_WORLD);
305 std::unique_ptr<mfem::AmgXSolver> buildAMGX(
const AMGXOptions& options,
const MPI_Comm comm);
316 struct FromInlet<
smith::LinearSolverOptions> {
327 struct FromInlet<
smith::NonlinearSolverOptions> {
338 struct FromInlet<
smith::EquationSolver> {
This class manages the objects typically required to solve a nonlinear set of equations arising from ...
mfem::NewtonSolver & nonlinearSolver()
const mfem::Solver & linearSolver() const
mfem::Solver & preconditioner()
EquationSolver(std::unique_ptr< mfem::NewtonSolver > nonlinear_solver, std::unique_ptr< mfem::Solver > linear_solver, std::unique_ptr< mfem::Solver > preconditioner=nullptr)
const mfem::Solver & preconditioner() const
void solve(mfem::Vector &x) const
static void defineInputFileSchema(axom::inlet::Container &container)
const mfem::NewtonSolver & nonlinearSolver() const
mfem::Solver & linearSolver()
void setOperator(const mfem::Operator &op)
A wrapper class for using the MFEM SuperLU solver with a HypreParMatrix.
void SetOperator(const mfem::Operator &op)
Set the underlying matrix operator to use in the solution algorithm.
SuperLUSolver(int print_level, MPI_Comm comm)
Constructs a wrapper over an mfem::SuperLUSolver.
void Mult(const mfem::Vector &input, mfem::Vector &output) const
Factor and solve the linear system y = Op^{-1} x using DSuperLU.
Accelerator functionality.
std::unique_ptr< mfem::NewtonSolver > buildNonlinearSolver(NonlinearSolverOptions nonlinear_opts, const LinearSolverOptions &linear_opts, mfem::Solver &prec, MPI_Comm comm)
Build a nonlinear solver using the nonlinear option struct.
std::unique_ptr< mfem::HypreParMatrix > buildMonolithicMatrix(const mfem::BlockOperator &block_operator)
Function for building a monolithic parallel Hypre matrix from a block system of smaller Hypre matrice...
std::pair< std::unique_ptr< mfem::Solver >, std::unique_ptr< mfem::Solver > > buildLinearSolverAndPreconditioner(LinearSolverOptions linear_opts, MPI_Comm comm)
Build the linear solver and its associated preconditioner given a linear options struct.
std::unique_ptr< mfem::Solver > buildPreconditioner(LinearSolverOptions linear_opts, [[maybe_unused]] MPI_Comm comm)
Build a preconditioner from the available options.
This file contains enumerations and record types for physics solver configuration.
Parameters for an iterative linear solution scheme.
Nonlinear solution scheme parameters.