https://mooseframework.inl.gov
MFEMMatrixFreeAMS.h
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 #pragma once
13 
14 #include "MFEMLinearSolverBase.h"
15 
16 namespace Moose::MFEM
17 {
22 class MatrixFreeAMS : public mfem::Solver
23 {
24 public:
25  MatrixFreeAMS(mfem::Coefficient & alpha_coef,
26  mfem::Coefficient & beta_coef,
27  int inner_pi_its = 0,
28  int inner_g_its = 1);
29 
31  void SetBilinearForm(mfem::ParBilinearForm & a) { _aform = &a; }
33  void SetBoundaryMarkers(mfem::Array<int> & ess_bdr_markers)
34  {
35  _ess_bdr_markers = ess_bdr_markers;
36  }
37  void SetOperator(const mfem::Operator & op) override;
38  void Mult(const mfem::Vector & x, mfem::Vector & y) const override
39  {
40  _matrix_free_ams->Mult(x, y);
41  }
42 
43 private:
44  std::unique_ptr<mfem::MatrixFreeAMS> _matrix_free_ams{nullptr};
45  mfem::Coefficient & _alpha_coef;
46  mfem::Coefficient & _beta_coef;
47  const int _inner_pi_its;
48  const int _inner_g_its;
49  mfem::ParBilinearForm * _aform;
50  mfem::Array<int> _ess_bdr_markers;
51 };
52 } // namespace Moose::MFEM
53 
58 {
59 public:
61 
63 
65  void SetupLOR(mfem::ParBilinearForm & a, mfem::Array<int> & ess_bdr_markers) override;
66 
67 protected:
68  void ConstructSolver() override;
69 
70 private:
71  mfem::Coefficient & _alpha_coef;
72  mfem::Coefficient & _beta_coef;
73  const int _inner_pi_its;
74  const int _inner_g_its;
75 };
76 
77 #endif
void SetOperator(const mfem::Operator &op) override
static InputParameters validParams()
Wrapper for mfem::MatrixFreeAMS solver.
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
mfem::Coefficient & _beta_coef
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void SetupLOR(mfem::ParBilinearForm &a, mfem::Array< int > &ess_bdr_markers) override
Updates the solver with the bilinear form, as MFEMMatrixFreeAMS is an LOR-based solver.
mfem::Coefficient & _alpha_coef
void SetBoundaryMarkers(mfem::Array< int > &ess_bdr_markers)
Set the marker array labelling essential boundaries.
mfem::Coefficient & _beta_coef
Base class for linear MFEM solvers and preconditioners.
MFEMMatrixFreeAMS(const InputParameters &)
std::unique_ptr< mfem::MatrixFreeAMS > _matrix_free_ams
mfem::ParBilinearForm * _aform
Wrapper for mfem::MatrixFreeAMS solver that creates an mfem::MatrixFreeAMS solver from the operator w...
mfem::Coefficient & _alpha_coef
void SetBilinearForm(mfem::ParBilinearForm &a)
Set the bilinear form corresponding to the curl-curl problem being preconditioned.
MatrixFreeAMS(mfem::Coefficient &alpha_coef, mfem::Coefficient &beta_coef, int inner_pi_its=0, int inner_g_its=1)
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
mfem::Array< int > _ess_bdr_markers