https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMGeometricMultigridSolver.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
16
51{
52public:
54
56
58 void ConstructSolver() override;
59
60protected:
62 void SetOperatorImpl(mfem::Operator & op) override;
63
64private:
67 mfem::AssemblyLevel ParseAssemblyLevel(const std::string & s) const;
68
70 void BuildMultigrid(const mfem::Operator & op);
71
80 class MGProxy : public mfem::Solver
81 {
82 public:
85
87 void SetMG(mfem::GeometricMultigrid & mg);
88
90 void SetOperator(const mfem::Operator & op) override;
91
93 void Mult(const mfem::Vector & x, mfem::Vector & y) const override;
94
95 private:
98
100 mfem::GeometricMultigrid * _mg = nullptr;
101 };
102
104 const std::string _var_name;
105
107 std::shared_ptr<mfem::ParFiniteElementSpaceHierarchy> _hierarchy;
108
110 const std::vector<MFEMSolverName> _smoother_names;
111
113 const MFEMSolverName _coarse_solver_name;
114
116 std::vector<mfem::AssemblyLevel> _assembly_levels;
117
119 MGProxy * _mg_proxy = nullptr;
120
122 std::vector<std::shared_ptr<mfem::ParBilinearForm>> _level_blfs;
123
125 std::vector<std::unique_ptr<mfem::OperatorHandle>> _level_ops;
126
128 std::unique_ptr<mfem::GeometricMultigrid> _mg;
129};
130
131#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Stable preconditioner object seen by outer MFEM solvers.
void SetOperator(const mfem::Operator &op) override
Rebuilds the owner's multigrid hierarchy for the new outer-solver operator.
void SetMG(mfem::GeometricMultigrid &mg)
Updates the concrete MFEM multigrid object used by Mult().
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Applies the current concrete MFEM multigrid preconditioner.
MFEMGeometricMultigridSolver & _owner
Solver object that owns the concrete multigrid and level data.
mfem::GeometricMultigrid * _mg
Non-owning pointer to the currently active concrete MFEM multigrid object.
P-multigrid / geometric multigrid preconditioner backed by mfem::GeometricMultigrid.
std::unique_ptr< mfem::GeometricMultigrid > _mg
Concrete MFEM multigrid preconditioner rebuilt on each SetOperator() call.
const std::string _var_name
Trial variable whose operator is preconditioned by this solver.
std::shared_ptr< mfem::ParFiniteElementSpaceHierarchy > _hierarchy
Finite element space hierarchy defining the multigrid levels.
mfem::AssemblyLevel ParseAssemblyLevel(const std::string &s) const
Map assembly-level string ("legacy", "full", "element", "partial", "none") to the corresponding mfem:...
void ConstructSolver() override
Creates a stable proxy solver; the real multigrid is built when the proxy gets an operator.
std::vector< mfem::AssemblyLevel > _assembly_levels
Assembly level requested for each multigrid level after optional single-value expansion.
std::vector< std::shared_ptr< mfem::ParBilinearForm > > _level_blfs
Rediscretized bilinear forms kept alive for the active linear coarse-level operators.
MGProxy * _mg_proxy
Non-owning pointer to the proxy solver stored in _solver.
void BuildMultigrid(const mfem::Operator &op)
Rebuild the multigrid object and per-level operators for the supplied finest-level operator.
const std::vector< MFEMSolverName > _smoother_names
Names of solvers used as smoothers on interior multigrid levels.
void SetOperatorImpl(mfem::Operator &op) override
Rebuilds the multigrid hierarchy for the supplied finest-level operator.
const MFEMSolverName _coarse_solver_name
Name of the solver used on the coarsest multigrid level.
std::vector< std::unique_ptr< mfem::OperatorHandle > > _level_ops
Constrained linear coarse-level operators; destroyed before the forms that own their data.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Base class for linear MFEM solvers and preconditioners.