Fluid structure interaction suite
jacobi.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/jacobi.h"
17 
18 #ifdef DEAL_II_WITH_TRILINOS
19 
20 using namespace dealii;
21 
22 namespace ParsedLAC
23 {
24  JacobiPreconditioner::JacobiPreconditioner(const std::string &name,
25  const double &omega,
26  const double &min_diagonal,
27  const unsigned int &n_sweeps)
28  : ParameterAcceptor(name)
30  , omega(omega)
31  , min_diagonal(min_diagonal)
32  , n_sweeps(n_sweeps)
33  {
35  }
36 
37  void
39  {
41  "Omega",
42  omega,
43  "This specifies the relaxation parameter in the Jacobi preconditioner.");
45  "Min Diagonal",
47  "This specifies the minimum value the diagonal elements should "
48  "have. This might be necessary when the Jacobi preconditioner is used "
49  "on matrices with zero diagonal elements. In that case, a straight- "
50  "forward application would not be possible since we would divide by "
51  "zero.");
53  "Number of sweeps",
54  n_sweeps,
55  "Sets how many times the given operation should be applied during the "
56  "vmult() operation.");
57  }
58 
59  template <typename Matrix>
60  void
62  {
64 
65  data.omega = omega;
67  data.n_sweeps = n_sweeps;
68  this->initialize(matrix, data);
69  }
70 } // namespace ParsedLAC
71 
72 template void
74  dealii::TrilinosWrappers::SparseMatrix>(
75  const dealii::TrilinosWrappers::SparseMatrix &);
76 
77 #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)
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())
double min_diagonal
This specifies the minimum value the diagonal elements should have.
Definition: jacobi.h:78
double omega
This specifies the relaxation parameter in the Jacobi preconditioner.
Definition: jacobi.h:69
void initialize_preconditioner(const Matrix &matrix)
Initialize the preconditioner using matrix.
Definition: jacobi.cc:61
unsigned int n_sweeps
Sets how many times the given operation should be applied during the vmult() operation.
Definition: jacobi.h:84
void add_parameters()
Declare preconditioner options.
Definition: jacobi.cc:38
Definition: amg.h:28