ExaDG
Loading...
Searching...
No Matches
multigrid_preconditioner.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef EXADG_CONVECTION_DIFFUSION_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_
23#define EXADG_CONVECTION_DIFFUSION_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_
24
25// ExaDG
26#include <exadg/convection_diffusion/spatial_discretization/operators/combined_operator.h>
27#include <exadg/operators/multigrid_operator.h>
28#include <exadg/solvers_and_preconditioners/multigrid/multigrid_preconditioner_base.h>
29
30namespace ExaDG
31{
32namespace ConvDiff
33{
34/*
35 * Multigrid preconditioner for scalar convection-diffusion equation.
36 */
37template<int dim, typename Number>
38class MultigridPreconditioner : public MultigridPreconditionerBase<dim, Number>
39{
40private:
41 typedef MultigridPreconditionerBase<dim, Number> Base;
42
43public:
44 typedef typename Base::MultigridNumber MultigridNumber;
45
46private:
47 typedef CombinedOperator<dim, Number> PDEOperator;
48 typedef CombinedOperator<dim, MultigridNumber> PDEOperatorMG;
49
52
53 typedef typename Base::Map_DBC Map_DBC;
54 typedef typename Base::Map_DBC_ComponentMask Map_DBC_ComponentMask;
55 typedef typename Base::PeriodicFacePairs PeriodicFacePairs;
56 typedef typename Base::VectorType VectorType;
57 typedef typename Base::VectorTypeMG VectorTypeMG;
58
59public:
60 MultigridPreconditioner(MPI_Comm const & mpi_comm);
61
62 virtual ~MultigridPreconditioner(){};
63
67 void
68 initialize(MultigridData const & mg_data,
69 std::shared_ptr<Grid<dim> const> grid,
70 std::shared_ptr<MultigridMappings<dim, Number>> const multigrid_mappings,
71 dealii::FiniteElement<dim> const & fe,
72 PDEOperator const & pde_operator,
73 MultigridOperatorType const & mg_operator_type,
74 bool const mesh_is_moving,
75 Map_DBC const & dirichlet_bc,
76 Map_DBC_ComponentMask const & dirichlet_bc_component_mask);
77
81 void
82 update() final;
83
84private:
85 void
86 fill_matrix_free_data(MatrixFreeData<dim, MultigridNumber> & matrix_free_data,
87 unsigned int const level,
88 unsigned int const dealii_tria_level) final;
89
90 std::shared_ptr<MGOperatorBase>
91 initialize_operator(unsigned int const level) final;
92
93 void
94 initialize_dof_handler_and_constraints(
95 bool const operator_is_singular,
96 unsigned int const n_components,
97 Map_DBC const & dirichlet_bc,
98 Map_DBC_ComponentMask const & dirichlet_bc_component_mask) final;
99
100 void
101 initialize_transfer_operators() final;
102
103 std::shared_ptr<PDEOperatorMG>
104 get_operator(unsigned int level) const;
105
106 std::shared_ptr<MultigridTransfer<dim, MultigridNumber, VectorTypeMG>> transfers_velocity;
107
108 unsigned int degree_velocity;
109
110 dealii::MGLevelObject<std::shared_ptr<dealii::DoFHandler<dim> const>> dof_handlers_velocity;
111 dealii::MGLevelObject<std::shared_ptr<dealii::AffineConstraints<MultigridNumber>>>
112 constraints_velocity;
113
115
116 PDEOperator const * pde_operator;
117
118 MultigridOperatorType mg_operator_type;
119
120 bool mesh_is_moving;
121};
122
123} // namespace ConvDiff
124} // namespace ExaDG
125
126#endif /* EXADG_CONVECTION_DIFFUSION_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_ */
Definition combined_operator.h:57
void initialize(MultigridData const &mg_data, std::shared_ptr< Grid< dim > const > grid, std::shared_ptr< MultigridMappings< dim, Number > > const multigrid_mappings, dealii::FiniteElement< dim > const &fe, PDEOperator const &pde_operator, MultigridOperatorType const &mg_operator_type, bool const mesh_is_moving, Map_DBC const &dirichlet_bc, Map_DBC_ComponentMask const &dirichlet_bc_component_mask)
Definition multigrid_preconditioner.cpp:48
void update() final
Definition multigrid_preconditioner.cpp:110
Definition grid.h:40
Definition grid.h:84
Definition multigrid_operator_base.h:36
Definition multigrid_operator.h:32
Definition driver.cpp:33
Definition combined_operator.h:36
Definition matrix_free_data.h:40
Definition multigrid_parameters.h:259