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 "ProblemOperator.h" 15 : #include "EquationSystemInterface.h" 16 : 17 : namespace Moose::MFEM 18 : { 19 : /** 20 : * Steady-state ProblemOperator that prepares and solves a single EquationSystem. 21 : * 22 : * On each call to Solve() this class: 23 : * 1. Forms equation-system data (kernels -> weak forms -> constrained linear part and 24 : * nonlinear action forms). 25 : * 2. Calls EquationSystem::ProvideOperator() to pass either the EquationSystem itself or 26 : * the assembled linear operator (and the bilinear form for LOR preconditioners) to the 27 : * configured solver tree. 28 : * 3. Dispatches to the linear or nonlinear solve path via SolveWithOperator(). 29 : * 4. Scatters the true-DoF solution back to the grid functions. 30 : * 31 : * @see EquationSystem for the class that owns the weak-form mathematics. 32 : * @see ProblemOperatorBase for the block-vector bookkeeping and solve-dispatch infrastructure. 33 : */ 34 : class EquationSystemProblemOperator : public ProblemOperator, public EquationSystemInterface 35 : { 36 : public: 37 1255 : EquationSystemProblemOperator(MFEMProblem & problem) 38 1255 : : ProblemOperator(problem), _equation_system(_problem_data.eqn_system) 39 : { 40 1255 : } 41 : 42 : virtual void SetGridFunctions() override; 43 : virtual void Solve() override; 44 : 45 4194 : [[nodiscard]] virtual EquationSystem * GetEquationSystem() const override 46 : { 47 : mooseAssert(_equation_system, "No EquationSystem in EquationSystemProblemOperator."); 48 4194 : return _equation_system.get(); 49 : } 50 : 51 : protected: 52 : /// Form equation-system state used by Solve(). 53 : void FormEquationSystemOperator(); 54 : 55 : private: 56 : std::shared_ptr<EquationSystem> _equation_system{nullptr}; 57 : }; 58 : 59 : } // namespace Moose::MFEM 60 : 61 : #endif