Line data Source code
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 : #pragma once 13 : 14 : #include "MFEMSolverBase.h" 15 : 16 : #include "libmesh/ignore_warnings.h" 17 : #include "mfem.hpp" 18 : #include "libmesh/restore_warnings.h" 19 : 20 : namespace Moose::MFEM 21 : { 22 : /** 23 : * MooseObject base for nonlinear MFEM solve strategies configured in the input file. 24 : */ 25 : class NonlinearSolverBase : public SolverBase 26 : { 27 : public: 28 42 : virtual ~NonlinearSolverBase() = default; 29 : 30 : static InputParameters validParams(); 31 : 32 : NonlinearSolverBase(const InputParameters & parameters); 33 : 34 : void ConstructSolver() override = 0; 35 : 36 : /// Configure the nonlinear solver with the residual/Jacobian operator. 37 : virtual void SetOperator(const mfem::Operator & op) = 0; 38 : 39 : /// Configure the linear solver used inside the nonlinear solve. 40 : virtual void SetLinearSolver(mfem::Solver & solver) = 0; 41 : 42 : /// Solve the nonlinear system for the provided right-hand side and solution vector. 43 : virtual void Mult(const mfem::Vector & rhs, mfem::Vector & x) = 0; 44 : 45 : /// Return whether this nonlinear solver requires Jacobian/gradient information from the operator. 46 : virtual bool RequiresGradient() const = 0; 47 : 48 : /// Return whether this nonlinear solver requires an externally configured MFEM linear solver. 49 : virtual bool RequiresExternalLinearSolver() const = 0; 50 : }; 51 : } // namespace Moose::MFEM 52 : 53 : #endif