https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
15
16namespace Moose::MFEM
17{
22class MatrixFreeAMS : public mfem::Solver
23{
24public:
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 mooseAssert(_matrix_free_ams,
41 "MatrixFreeAMS preconditioner was not initialized with both the operator and "
42 "bilinear form before use.");
43 _matrix_free_ams->Mult(x, y);
44 }
45
46private:
47 std::unique_ptr<mfem::MatrixFreeAMS> _matrix_free_ams{nullptr};
48 mfem::Coefficient & _alpha_coef;
49 mfem::Coefficient & _beta_coef;
50 const int _inner_pi_its;
51 const int _inner_g_its;
52 mfem::ParBilinearForm * _aform;
53 mfem::Array<int> _ess_bdr_markers;
54};
55} // namespace Moose::MFEM
56
60class MFEMMatrixFreeAMS : public Moose::MFEM::LORLinearSolverBase<mfem::MatrixFreeAMS>
61{
62public:
64
66
67 void ConstructSolver() override;
68
69protected:
70 virtual void SetSolverParameters(mfem::MatrixFreeAMS &) override {}
71
72private:
73 mfem::Coefficient & _alpha_coef;
74 mfem::Coefficient & _beta_coef;
75 const int _inner_pi_its;
76 const int _inner_g_its;
77};
78
79#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Wrapper for mfem::MatrixFreeAMS solver.
mfem::Coefficient & _beta_coef
virtual void SetSolverParameters(mfem::MatrixFreeAMS &) override
Update the wrapped MFEM solver parameters.
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
static InputParameters validParams()
mfem::Coefficient & _alpha_coef
Base class for LOR compatible linear MFEM solvers and preconditioners.
Wrapper for mfem::MatrixFreeAMS solver that creates an mfem::MatrixFreeAMS solver from the operator w...
void SetBoundaryMarkers(mfem::Array< int > &ess_bdr_markers)
Set the marker array labelling essential boundaries.
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
std::unique_ptr< mfem::MatrixFreeAMS > _matrix_free_ams
mfem::Coefficient & _beta_coef
void SetBilinearForm(mfem::ParBilinearForm &a)
Set the bilinear form corresponding to the curl-curl problem being preconditioned.
void SetOperator(const mfem::Operator &op) override
mfem::Array< int > _ess_bdr_markers
mfem::Coefficient & _alpha_coef
mfem::ParBilinearForm * _aform
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).