Loading [MathJax]/extensions/tex2jax.js
Fluid structure interaction suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
amg_muelu.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 by Luca Heltai
4 //
5 // This file is part of the FSI-suite platform, based on the deal.II library.
6 //
7 // The FSI-suite platform is free software; you can use it, redistribute it,
8 // and/or modify it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation; either version 3.0 of the License,
10 // or (at your option) any later version. The full text of the license can be
11 // found in the file LICENSE at the top level of the FSI-suite platform
12 // distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <parsed_lac/amg_muelu.h>
17 
18 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_TRILINOS_WITH_MUELU)
19 
20 # include <deal.II/dofs/dof_tools.h>
21 
23 
24 using namespace dealii;
25 
26 namespace ParsedLAC
27 {
28  AMGMueLuPreconditioner::AMGMueLuPreconditioner(
29  const std::string &name,
30  const bool &elliptic,
31  const unsigned int &n_cycles,
32  const bool &w_cycle,
33  const double &aggregation_threshold,
34  const unsigned int &smoother_sweeps,
35  const unsigned int &smoother_overlap,
36  const bool &output_details,
37  const std::string &smoother_type,
38  const std::string &coarse_type)
39  : ParameterAcceptor(name)
40  , PreconditionAMGMueLu()
41  , elliptic(elliptic)
42  , n_cycles(n_cycles)
43  , w_cycle(w_cycle)
44  , aggregation_threshold(aggregation_threshold)
45  , smoother_sweeps(smoother_sweeps)
46  , smoother_overlap(smoother_overlap)
47  , output_details(output_details)
48  , smoother_type(smoother_type)
49  , coarse_type(coarse_type)
50  {
52  }
53 
54  void
56  {
58  "Elliptic",
59  elliptic,
60  "Determines whether the AMG preconditioner should be optimized for "
61  "elliptic problems (ML option smoothed aggregation SA, using a "
62  "Chebyshev smoother) or for non-elliptic problems (ML option "
63  "non-symmetric smoothed aggregation NSSA, smoother is SSOR with "
64  "underrelaxation");
65 
67  "Number of cycles",
68  n_cycles,
69  "Defines how many multigrid cycles should be performed by the "
70  "preconditioner.");
71 
73  "w-cycle",
74  w_cycle,
75  "defines whether a w-cycle should be used instead of the standard "
76  "setting of a v-cycle.");
77 
79  "Aggregation threshold",
81  "This threshold tells the AMG setup how the coarsening should be "
82  "performed. In the AMG used by ML, all points that strongly couple with "
83  "the tentative coarse-level point form one aggregate. The term strong "
84  "coupling is controlled by the variable aggregation_threshold, meaning "
85  "that all elements that are not smaller than aggregation_threshold "
86  "times the diagonal element do couple strongly.");
87 
89  "Smoother sweeps",
91  "Determines how many sweeps of the smoother should be performed. When "
92  "the flag elliptic is set to true, i.e., for elliptic or almost "
93  "elliptic problems, the polynomial degree of the Chebyshev smoother is "
94  "set to smoother_sweeps. The term sweeps refers to the number of "
95  "matrix-vector products performed in the Chebyshev case. In the "
96  "non-elliptic case, smoother_sweeps sets the number of SSOR relaxation "
97  "sweeps for post-smoothing to be performed.");
98 
100  "Smoother overlap",
102  "Determines the overlap in the SSOR/Chebyshev error smoother when run "
103  "in parallel.");
104 
106  "Output details",
108  "If this flag is set to true, then internal information from the ML "
109  "preconditioner is printed to screen. This can be useful when debugging "
110  "the preconditioner.");
111 
113  "Smoother type",
115  "Determines which smoother to use for the AMG cycle.",
116  this->prm,
118  "|Aztec|IFPACK|Jacobi"
119  "|ML symmetric Gauss-Seidel|symmetric Gauss-Seidel"
120  "|ML Gauss-Seidel|Gauss-Seidel|block Gauss-Seidel"
121  "|symmetric block Gauss-Seidel|Chebyshev|MLS|Hiptmair"
122  "|Amesos-KLU|Amesos-Superlu|Amesos-UMFPACK|Amesos-Superludist"
123  "|Amesos-MUMPS|user-defined|SuperLU|IFPACK-Chebyshev|self"
124  "|do-nothing|IC|ICT|ILU|ILUT|Block Chebyshev"
125  "|IFPACK-Block Chebyshev"));
126 
128  "Coarse type",
129  coarse_type,
130  "Determines which solver to use on the coarsest level. The same "
131  "settings as for the smoother type are possible.",
132  this->prm,
134  "|Aztec|IFPACK|Jacobi"
135  "|ML symmetric Gauss-Seidel|symmetric Gauss-Seidel"
136  "|ML Gauss-Seidel|Gauss-Seidel|block Gauss-Seidel"
137  "|symmetric block Gauss-Seidel|Chebyshev|MLS|Hiptmair"
138  "|Amesos-KLU|Amesos-Superlu|Amesos-UMFPACK|Amesos-Superludist"
139  "|Amesos-MUMPS|user-defined|SuperLU|IFPACK-Chebyshev|self"
140  "|do-nothing|IC|ICT|ILU|ILUT|Block Chebyshev"
141  "|IFPACK-Block Chebyshev"));
142  }
143 
144  template <typename Matrix>
145  void
147  {
149 
150  data.elliptic = elliptic;
151  data.n_cycles = n_cycles;
152  data.w_cycle = w_cycle;
154  data.constant_modes = std::vector<std::vector<bool>>(0);
158  data.smoother_type = smoother_type.c_str();
159  data.coarse_type = coarse_type.c_str();
160  this->initialize(matrix, data);
161  }
162 } // namespace ParsedLAC
163 
164 template void
166  dealii::TrilinosWrappers::SparseMatrix>(
167  const dealii::TrilinosWrappers::SparseMatrix &);
168 
169 template void
171  dealii::SparseMatrix<double>>(const dealii::SparseMatrix<double> &);
172 
173 #endif
static void initialize(const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle)
static ParameterHandler prm
void add_parameter(const std::string &entry, ParameterType &parameter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern())
unsigned int smoother_overlap
Determines the overlap in the SSOR/Chebyshev error smoother when run in parallel.
Definition: amg_muelu.h:118
std::string smoother_type
Determines which smoother to use for the AMG cycle.
Definition: amg_muelu.h:138
void initialize_preconditioner(const Matrix &matrix)
Initialize the preconditioner using matrix.
Definition: amg_muelu.cc:146
unsigned int smoother_sweeps
Determines how many sweeps of the smoother should be performed.
Definition: amg_muelu.h:112
std::string coarse_type
Determines which solver to use on the coarsest level.
Definition: amg_muelu.h:144
void add_parameters()
Add all parameter options.
Definition: amg_muelu.cc:55
unsigned int n_cycles
Defines how many multigrid cycles should be performed by the preconditioner.
Definition: amg_muelu.h:83
bool output_details
If this flag is set to true, then internal information from the ML preconditioner is printed to scree...
Definition: amg_muelu.h:125
bool elliptic
Determines whether the AMG preconditioner should be optimized for elliptic problems (ML option smooth...
Definition: amg_muelu.h:77
double aggregation_threshold
This threshold tells the AMG setup how the coarsening should be performed.
Definition: amg_muelu.h:100
bool w_cycle
Defines whether a w-cycle should be used instead of the standard setting of a v-cycle.
Definition: amg_muelu.h:89
Definition: amg.h:28
std::vector< std::vector< bool > > constant_modes