Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
petsc_precondition.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2004 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_petsc_precondition_h
17 # define dealii_petsc_precondition_h
18 
19 
20 # include <deal.II/base/config.h>
21 
22 # ifdef DEAL_II_WITH_PETSC
23 
24 # include <deal.II/lac/exceptions.h>
25 
26 # include <petscpc.h>
27 
29 
30 
31 
32 namespace PETScWrappers
33 {
34  // forward declarations
35 # ifndef DOXYGEN
36  class MatrixBase;
37  class VectorBase;
38  class SolverBase;
39 # endif
40 
58  {
59  public:
64 
68  virtual ~PreconditionerBase();
69 
74  void
75  clear();
76 
80  void
81  vmult(VectorBase &dst, const VectorBase &src) const;
82 
86  void
87  Tvmult(VectorBase &dst, const VectorBase &src) const;
88 
89 
93  const PC &
94  get_pc() const;
95 
96  protected:
100  PC pc;
101 
105  Mat matrix;
106 
111  void
112  create_pc();
113 
119  operator Mat() const;
120 
121  // Make the solver class a friend, since it needs to call the conversion
122  // operator.
123  friend class SolverBase;
124  };
125 
126 
127 
140  {
141  public:
147  {};
148 
153  PreconditionJacobi() = default;
154 
155 
161  const MatrixBase & matrix,
163 
169  const MPI_Comm communicator,
171 
178  void
179  initialize(const MatrixBase & matrix,
181 
182  protected:
187 
193  void
194  initialize();
195  };
196 
197 
198 
224  {
225  public:
231  {};
232 
237  PreconditionBlockJacobi() = default;
238 
244  const MatrixBase & matrix,
246 
252  const MPI_Comm communicator,
254 
255 
262  void
263  initialize(const MatrixBase & matrix,
265 
266  protected:
271 
277  void
278  initialize();
279  };
280 
281 
282 
293  {
294  public:
300  {
304  AdditionalData(const double omega = 1);
305 
309  double omega;
310  };
311 
316  PreconditionSOR() = default;
317 
324 
331  void
332  initialize(const MatrixBase & matrix,
334 
335  protected:
340  };
341 
342 
343 
354  {
355  public:
361  {
365  AdditionalData(const double omega = 1);
366 
370  double omega;
371  };
372 
377  PreconditionSSOR() = default;
378 
385 
392  void
393  initialize(const MatrixBase & matrix,
395 
396  protected:
401  };
402 
403 
404 
418  {
419  public:
425  {
429  AdditionalData(const double omega = 1);
430 
434  double omega;
435  };
436 
441  PreconditionEisenstat() = default;
442 
448  const MatrixBase & matrix,
450 
457  void
458  initialize(const MatrixBase & matrix,
460 
461  protected:
466  };
467 
468 
469 
480  {
481  public:
487  {
491  AdditionalData(const unsigned int levels = 0);
492 
496  unsigned int levels;
497  };
498 
503  PreconditionICC() = default;
504 
511 
518  void
519  initialize(const MatrixBase & matrix,
521 
522  protected:
527  };
528 
529 
530 
541  {
542  public:
548  {
552  AdditionalData(const unsigned int levels = 0);
553 
557  unsigned int levels;
558  };
559 
564  PreconditionILU() = default;
565 
572 
579  void
580  initialize(const MatrixBase & matrix,
582 
583  protected:
588  };
589 
590 
591 
607  {
608  public:
614  {
619  AdditionalData(const double pivoting = 1.e-6,
620  const double zero_pivot = 1.e-12,
621  const double damping = 0.0);
622 
628  double pivoting;
629 
634  double zero_pivot;
635 
640  double damping;
641  };
642 
647  PreconditionLU() = default;
648 
655 
662  void
663  initialize(const MatrixBase & matrix,
665 
666  protected:
671  };
672 
673 
674 
687  {
688  public:
694  {
699  AdditionalData(const bool symmetric_operator = false,
700  const double strong_threshold = 0.25,
701  const double max_row_sum = 0.9,
702  const unsigned int aggressive_coarsening_num_levels = 0,
703  const bool output_details = false);
704 
712 
719 
731  double max_row_sum;
732 
739 
745  };
746 
751  PreconditionBoomerAMG() = default;
752 
758  const MatrixBase & matrix,
760 
766  const MPI_Comm communicator,
768 
769 
776  void
777  initialize(const MatrixBase & matrix,
779 
780  protected:
785 
791  void
792  initialize();
793  };
794 
795 
796 
818  {
819  public:
825  {
829  AdditionalData(const unsigned int symmetric = 1,
830  const unsigned int n_levels = 1,
831  const double threshold = 0.1,
832  const double filter = 0.05,
833  const bool output_details = false);
834 
846  unsigned int symmetric;
847 
854  unsigned int n_levels;
855 
866  double threshold;
867 
878  double filter;
879 
885  };
886 
887 
888 
893  PreconditionParaSails() = default;
894 
900  const MatrixBase & matrix,
902 
909  void
910  initialize(const MatrixBase & matrix,
912 
913  private:
918  };
919 
920 
921 
929  {
930  public:
936  {};
937 
942  PreconditionNone() = default;
943 
951 
959  void
960  initialize(const MatrixBase & matrix,
962 
963  private:
968  };
969 } // namespace PETScWrappers
970 
971 
972 
974 
975 
976 # endif // DEAL_II_WITH_PETSC
977 
978 #endif
979 /*--------------------------- petsc_precondition.h --------------------------*/
PETScWrappers::PreconditionSOR::AdditionalData::AdditionalData
AdditionalData(const double omega=1)
Definition: petsc_precondition.cc:226
PETScWrappers::PreconditionParaSails::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:584
PETScWrappers::PreconditionILU::AdditionalData::levels
unsigned int levels
Definition: petsc_precondition.h:557
PETScWrappers::PreconditionNone::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:678
PETScWrappers::PreconditionEisenstat::AdditionalData::AdditionalData
AdditionalData(const double omega=1)
Definition: petsc_precondition.cc:312
PETScWrappers::PreconditionBlockJacobi::PreconditionBlockJacobi
PreconditionBlockJacobi()=default
PETScWrappers::PreconditionSSOR
Definition: petsc_precondition.h:353
PETScWrappers::PreconditionerBase::vmult
void vmult(VectorBase &dst, const VectorBase &src) const
Definition: petsc_precondition.cc:66
PETScWrappers::PreconditionParaSails::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:917
PETScWrappers::PreconditionSSOR::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:400
PETScWrappers::SolverBase
Definition: petsc_solver.h:113
PETScWrappers::PreconditionParaSails::AdditionalData::AdditionalData
AdditionalData(const unsigned int symmetric=1, const unsigned int n_levels=1, const double threshold=0.1, const double filter=0.05, const bool output_details=false)
Definition: petsc_precondition.cc:560
PETScWrappers
Definition: petsc_block_sparse_matrix.h:36
PETScWrappers::PreconditionILU::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:410
PETScWrappers::PreconditionILU::PreconditionILU
PreconditionILU()=default
PETScWrappers::PreconditionBoomerAMG::AdditionalData::AdditionalData
AdditionalData(const bool symmetric_operator=false, const double strong_threshold=0.25, const double max_row_sum=0.9, const unsigned int aggressive_coarsening_num_levels=0, const bool output_details=false)
Definition: petsc_precondition.cc:437
PETScWrappers::PreconditionICC::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:526
PETScWrappers::PreconditionBlockJacobi
Definition: petsc_precondition.h:223
PETScWrappers::PreconditionILU::AdditionalData::AdditionalData
AdditionalData(const unsigned int levels=0)
Definition: petsc_precondition.cc:396
PETScWrappers::PreconditionSOR::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:240
PETScWrappers::PreconditionICC::AdditionalData
Definition: petsc_precondition.h:486
PETScWrappers::PreconditionEisenstat::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:327
PETScWrappers::PreconditionSOR::PreconditionSOR
PreconditionSOR()=default
PETScWrappers::PreconditionLU::AdditionalData
Definition: petsc_precondition.h:613
PETScWrappers::PreconditionSSOR::AdditionalData::AdditionalData
AdditionalData(const double omega=1)
Definition: petsc_precondition.cc:267
PETScWrappers::PreconditionLU::AdditionalData::pivoting
double pivoting
Definition: petsc_precondition.h:628
PETScWrappers::PreconditionLU::AdditionalData::zero_pivot
double zero_pivot
Definition: petsc_precondition.h:634
PETScWrappers::PreconditionSOR
Definition: petsc_precondition.h:292
PETScWrappers::PreconditionEisenstat
Definition: petsc_precondition.h:417
PETScWrappers::PreconditionNone::AdditionalData
Definition: petsc_precondition.h:935
MPI_Comm
Physics::Elasticity::Kinematics::e
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
PETScWrappers::PreconditionLU::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:719
PETScWrappers::PreconditionParaSails
Definition: petsc_precondition.h:817
exceptions.h
PETScWrappers::PreconditionEisenstat::PreconditionEisenstat
PreconditionEisenstat()=default
PETScWrappers::PreconditionNone::PreconditionNone
PreconditionNone()=default
PETScWrappers::PreconditionLU::AdditionalData::AdditionalData
AdditionalData(const double pivoting=1.e-6, const double zero_pivot=1.e-12, const double damping=0.0)
Definition: petsc_precondition.cc:701
PETScWrappers::PreconditionLU::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:670
PETScWrappers::PreconditionILU
Definition: petsc_precondition.h:540
PETScWrappers::PreconditionICC::AdditionalData::levels
unsigned int levels
Definition: petsc_precondition.h:496
PETScWrappers::PreconditionICC::PreconditionICC
PreconditionICC()=default
PETScWrappers::PreconditionJacobi::AdditionalData
Definition: petsc_precondition.h:146
PETScWrappers::PreconditionBoomerAMG::AdditionalData::aggressive_coarsening_num_levels
unsigned int aggressive_coarsening_num_levels
Definition: petsc_precondition.h:738
PETScWrappers::PreconditionSSOR::PreconditionSSOR
PreconditionSSOR()=default
SolverBase
Definition: solver.h:333
PETScWrappers::PreconditionParaSails::AdditionalData::n_levels
unsigned int n_levels
Definition: petsc_precondition.h:854
PETScWrappers::PreconditionerBase::create_pc
void create_pc()
Definition: petsc_precondition.cc:86
PETScWrappers::PreconditionJacobi::initialize
void initialize()
Definition: petsc_precondition.cc:146
PETScWrappers::PreconditionLU::PreconditionLU
PreconditionLU()=default
PETScWrappers::PreconditionBoomerAMG::AdditionalData::output_details
bool output_details
Definition: petsc_precondition.h:744
PETScWrappers::PreconditionParaSails::PreconditionParaSails
PreconditionParaSails()=default
PETScWrappers::PreconditionLU::AdditionalData::damping
double damping
Definition: petsc_precondition.h:640
PETScWrappers::PreconditionBoomerAMG::initialize
void initialize()
Definition: petsc_precondition.cc:480
PETScWrappers::PreconditionSSOR::AdditionalData
Definition: petsc_precondition.h:360
PETScWrappers::PreconditionParaSails::AdditionalData::threshold
double threshold
Definition: petsc_precondition.h:866
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
PETScWrappers::PreconditionBoomerAMG::AdditionalData
Definition: petsc_precondition.h:693
PETScWrappers::PreconditionBoomerAMG::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:784
PETScWrappers::MatrixBase
Definition: petsc_matrix_base.h:284
PETScWrappers::PreconditionILU::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:587
PETScWrappers::PreconditionJacobi::PreconditionJacobi
PreconditionJacobi()=default
PETScWrappers::PreconditionJacobi::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:186
PETScWrappers::PreconditionJacobi
Definition: petsc_precondition.h:139
PETScWrappers::PreconditionSOR::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:339
PETScWrappers::PreconditionLU
Definition: petsc_precondition.h:606
PETScWrappers::PreconditionSSOR::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:281
PETScWrappers::PreconditionerBase::clear
void clear()
Definition: petsc_precondition.cc:52
PETScWrappers::PreconditionEisenstat::AdditionalData::omega
double omega
Definition: petsc_precondition.h:434
PETScWrappers::PreconditionNone::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:967
PETScWrappers::PreconditionSOR::AdditionalData
Definition: petsc_precondition.h:299
PETScWrappers::PreconditionNone
Definition: petsc_precondition.h:928
PETScWrappers::PreconditionParaSails::AdditionalData::output_details
bool output_details
Definition: petsc_precondition.h:884
PETScWrappers::PreconditionBlockJacobi::initialize
void initialize()
Definition: petsc_precondition.cc:197
PETScWrappers::PreconditionEisenstat::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:465
PETScWrappers::PreconditionSSOR::AdditionalData::omega
double omega
Definition: petsc_precondition.h:370
PETScWrappers::PreconditionBoomerAMG
Definition: petsc_precondition.h:686
PETScWrappers::PreconditionParaSails::AdditionalData::symmetric
unsigned int symmetric
Definition: petsc_precondition.h:846
PETScWrappers::PreconditionBoomerAMG::AdditionalData::max_row_sum
double max_row_sum
Definition: petsc_precondition.h:731
PETScWrappers::PreconditionEisenstat::AdditionalData
Definition: petsc_precondition.h:424
PETScWrappers::PreconditionSOR::AdditionalData::omega
double omega
Definition: petsc_precondition.h:309
PETScWrappers::PreconditionICC
Definition: petsc_precondition.h:479
PETScWrappers::PreconditionerBase::matrix
Mat matrix
Definition: petsc_precondition.h:105
PETScWrappers::PreconditionerBase::~PreconditionerBase
virtual ~PreconditionerBase()
Definition: petsc_precondition.cc:41
PETScWrappers::PreconditionerBase::Tvmult
void Tvmult(VectorBase &dst, const VectorBase &src) const
Definition: petsc_precondition.cc:76
config.h
PETScWrappers::PreconditionBoomerAMG::AdditionalData::symmetric_operator
bool symmetric_operator
Definition: petsc_precondition.h:711
PETScWrappers::PreconditionerBase
Definition: petsc_precondition.h:57
PETScWrappers::PreconditionerBase::get_pc
const PC & get_pc() const
Definition: petsc_precondition.cc:113
PETScWrappers::PreconditionerBase::pc
PC pc
Definition: petsc_precondition.h:100
PETScWrappers::PreconditionParaSails::AdditionalData
Definition: petsc_precondition.h:824
PETScWrappers::PreconditionILU::AdditionalData
Definition: petsc_precondition.h:547
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
PETScWrappers::PreconditionParaSails::AdditionalData::filter
double filter
Definition: petsc_precondition.h:878
PETScWrappers::VectorBase
Definition: petsc_vector_base.h:240
PETScWrappers::PreconditionBoomerAMG::AdditionalData::strong_threshold
double strong_threshold
Definition: petsc_precondition.h:718
PETScWrappers::PreconditionICC::AdditionalData::AdditionalData
AdditionalData(const unsigned int levels=0)
Definition: petsc_precondition.cc:355
PETScWrappers::PreconditionerBase::PreconditionerBase
PreconditionerBase()
Definition: petsc_precondition.cc:36
PETScWrappers::PreconditionICC::initialize
void initialize(const MatrixBase &matrix, const AdditionalData &additional_data=AdditionalData())
Definition: petsc_precondition.cc:369
PETScWrappers::PreconditionBoomerAMG::PreconditionBoomerAMG
PreconditionBoomerAMG()=default
PETScWrappers::PreconditionBlockJacobi::AdditionalData
Definition: petsc_precondition.h:230
PETScWrappers::PreconditionBlockJacobi::additional_data
AdditionalData additional_data
Definition: petsc_precondition.h:270