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_STRUCTURE_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_
23#define EXADG_STRUCTURE_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_
24
25// ExaDG
26#include <exadg/operators/multigrid_operator.h>
27#include <exadg/solvers_and_preconditioners/multigrid/multigrid_preconditioner_base.h>
28#include <exadg/structure/spatial_discretization/operators/elasticity_operator_base.h>
29#include <exadg/structure/spatial_discretization/operators/linear_operator.h>
30#include <exadg/structure/spatial_discretization/operators/nonlinear_operator.h>
31
32namespace ExaDG
33{
34namespace Structure
35{
36template<int dim, typename Number>
37class MultigridPreconditioner : public MultigridPreconditionerBase<dim, Number>
38{
39private:
40 typedef MultigridPreconditionerBase<dim, Number> Base;
41
42public:
43 typedef typename Base::MultigridNumber MultigridNumber;
44
45public:
46 typedef LinearOperator<dim, Number> PDEOperatorLinear;
47 typedef LinearOperator<dim, MultigridNumber> PDEOperatorLinearMG;
48
49 typedef NonLinearOperator<dim, Number> PDEOperatorNonlinear;
50 typedef NonLinearOperator<dim, MultigridNumber> PDEOperatorNonlinearMG;
51
55
56 typedef typename Base::Map_DBC Map_DBC;
57 typedef typename Base::Map_DBC_ComponentMask Map_DBC_ComponentMask;
58 typedef typename Base::PeriodicFacePairs PeriodicFacePairs;
59 typedef typename Base::VectorType VectorType;
60 typedef typename Base::VectorTypeMG VectorTypeMG;
61
62 MultigridPreconditioner(MPI_Comm const & mpi_comm);
63
64 void
65 initialize(MultigridData const & mg_data,
66 std::shared_ptr<Grid<dim> const> grid,
67 std::shared_ptr<MultigridMappings<dim, Number>> const multigrid_mappings,
68 dealii::FiniteElement<dim> const & fe,
69 ElasticityOperatorBase<dim, Number> const & pde_operator,
70 bool const nonlinear_operator,
71 Map_DBC const & dirichlet_bc,
72 Map_DBC_ComponentMask const & dirichlet_bc_component_mask);
73
74 /*
75 * This function updates the multigrid preconditioner.
76 */
77 void
78 update() final;
79
80private:
81 void
82 initialize_dof_handler_and_constraints(
83 bool const operator_is_singular,
84 unsigned int const n_components,
85 Map_DBC const & dirichlet_bc,
86 Map_DBC_ComponentMask const & dirichlet_bc_component_mask) final;
87
88 void
89 fill_matrix_free_data(MatrixFreeData<dim, MultigridNumber> & matrix_free_data,
90 unsigned int const level,
91 unsigned int const dealii_tria_level) final;
92
93 std::shared_ptr<MGOperatorBase>
94 initialize_operator(unsigned int const level,
95 bool const use_matrix_based_operator_level,
96 bool const assemble_matrix) final;
97
98 /*
99 * This function updates the multigrid operators for all levels
100 */
101 void
102 update_operators();
103
104 std::shared_ptr<PDEOperatorNonlinearMG>
105 get_operator_nonlinear(unsigned int level);
106
107 std::shared_ptr<PDEOperatorLinearMG>
108 get_operator_linear(unsigned int level);
109
110private:
112
113 ElasticityOperatorBase<dim, Number> const * pde_operator;
114
115 // additional constraints without Dirichlet degrees of freedom
116 dealii::MGLevelObject<std::shared_ptr<dealii::DoFHandler<dim> const>> dof_handlers_inhomogeneous;
117 dealii::MGLevelObject<std::shared_ptr<dealii::AffineConstraints<MultigridNumber>>>
118 constraints_inhomogeneous;
119
120 bool nonlinear;
121};
122
123} // namespace Structure
124} // namespace ExaDG
125
126#endif /* EXADG_STRUCTURE_PRECONDITIONERS_MULTIGRID_PRECONDITIONER_H_ */
Definition grid.h:40
Definition grid.h:84
Definition multigrid_operator_base.h:36
Definition multigrid_operator.h:32
Definition elasticity_operator_base.h:72
Definition linear_operator.h:34
Definition nonlinear_operator.h:34
Definition driver.cpp:33
Definition matrix_free_data.h:40
Definition multigrid_parameters.h:259
Definition elasticity_operator_base.h:37