Fluid structure interaction suite
amg.h
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 //
3 // Copyright (C) 2015 by the deal2lkit authors
4 //
5 // This file is part of the deal2lkit library.
6 //
7 // The deal2lkit library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal2lkit distribution.
13 //
14 //-----------------------------------------------------------
15 
16 #ifndef amg_preconditioner_h
17 #define amg_preconditioner_h
18 
19 #include <deal.II/base/config.h>
20 
21 #ifdef DEAL_II_WITH_TRILINOS
22 
24 
26 
27 namespace ParsedLAC
28 {
35  class AMGPreconditioner : public dealii::ParameterAcceptor,
36  public dealii::TrilinosWrappers::PreconditionAMG
37  {
38  public:
42  AMGPreconditioner(const std::string &name = "",
43  const bool &elliptic = true,
44  const bool &higher_order_elements = false,
45  const unsigned int &n_cycles = 1,
46  const bool &w_cycle = false,
47  const double &aggregation_threshold = 1e-4,
48  const unsigned int &smoother_sweeps = 2,
49  const unsigned int &smoother_overlap = 0,
50  const bool &output_details = false,
51  const std::string &smoother_type = "Chebyshev",
52  const std::string &coarse_type = "Amesos-KLU");
53 
57  template <typename Matrix>
58  void
59  initialize(const Matrix &matrix);
60 
61  using dealii::TrilinosWrappers::PreconditionAMG::initialize;
62 
66  void
67  set_constant_modes(const std::vector<std::vector<bool>> &constant_modes);
68 
69  private:
73  void
75 
83  bool elliptic;
84 
90 
95  unsigned int n_cycles;
96 
101  bool w_cycle;
102 
113 
119  std::string var_const_modes;
120 
131  unsigned int smoother_sweeps;
132 
137  unsigned int smoother_overlap;
138 
145 
157  std::string smoother_type;
158 
163  std::string coarse_type;
164 
168  std::vector<std::vector<bool>> constant_modes;
169  };
170 
171 
172 } // namespace ParsedLAC
173 
174 #endif // DEAL_II_WITH_TRILINOS
175 
176 #endif
A parsed AMG preconditioner which uses parameter files to choose between different options.
Definition: amg.h:37
bool elliptic
Determines whether the AMG preconditioner should be optimized for elliptic problems (ML option smooth...
Definition: amg.h:83
double aggregation_threshold
This threshold tells the AMG setup how the coarsening should be performed.
Definition: amg.h:112
void add_parameters()
Declare preconditioner options.
Definition: amg.cc:56
unsigned int n_cycles
Defines how many multigrid cycles should be performed by the preconditioner.
Definition: amg.h:95
std::string smoother_type
Determines which smoother to use for the AMG cycle.
Definition: amg.h:157
std::string coarse_type
Determines which solver to use on the coarsest level.
Definition: amg.h:163
bool w_cycle
Defines whether a w-cycle should be used instead of the standard setting of a v-cycle.
Definition: amg.h:101
std::vector< std::vector< bool > > constant_modes
Constant modes of the matrix.
Definition: amg.h:168
bool output_details
If this flag is set to true, then internal information from the ML preconditioner is printed to scree...
Definition: amg.h:144
AMGPreconditioner(const std::string &name="", const bool &elliptic=true, const bool &higher_order_elements=false, const unsigned int &n_cycles=1, const bool &w_cycle=false, const double &aggregation_threshold=1e-4, const unsigned int &smoother_sweeps=2, const unsigned int &smoother_overlap=0, const bool &output_details=false, const std::string &smoother_type="Chebyshev", const std::string &coarse_type="Amesos-KLU")
Constructor.
Definition: amg.cc:28
unsigned int smoother_overlap
Determines the overlap in the SSOR/Chebyshev error smoother when run in parallel.
Definition: amg.h:137
void set_constant_modes(const std::vector< std::vector< bool >> &constant_modes)
Set the constant modes of the AMG preconditioner.
Definition: amg.cc:154
void initialize(const Matrix &matrix)
Initialize the preconditioner using matrix.
Definition: amg.cc:164
std::string var_const_modes
Specifies the variable associated to the constant modes (near null space) of the matrix.
Definition: amg.h:119
bool higher_order_elements
Determines whether the matrix that the preconditioner is built upon is generated from linear or highe...
Definition: amg.h:89
unsigned int smoother_sweeps
Determines how many sweeps of the smoother should be performed.
Definition: amg.h:131
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
Definition: amg.h:28