From 26312c3d191d352b91b9b91444c5c077eb6e39a5 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 11 Jun 2021 12:59:28 -0400 Subject: [PATCH] Remove, without deprecation, the Eisenstat preconditioner. This has never worked in parallel and has suffered from a variety of other issues over the years. --- .../incompatibilities/20210611DavidWells | 4 ++ include/deal.II/lac/petsc_precondition.h | 66 ----------------- source/lac/petsc_precondition.cc | 42 ----------- tests/petsc/reinit_preconditioner_01.cc | 1 - tests/petsc/reinit_preconditioner_02.cc | 1 - .../petsc/solver_03_precondition_eisenstat.cc | 70 ------------------- .../solver_03_precondition_eisenstat.output | 4 -- 7 files changed, 4 insertions(+), 184 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20210611DavidWells delete mode 100644 tests/petsc/solver_03_precondition_eisenstat.cc delete mode 100644 tests/petsc/solver_03_precondition_eisenstat.output diff --git a/doc/news/changes/incompatibilities/20210611DavidWells b/doc/news/changes/incompatibilities/20210611DavidWells new file mode 100644 index 0000000000..50782776a0 --- /dev/null +++ b/doc/news/changes/incompatibilities/20210611DavidWells @@ -0,0 +1,4 @@ +Removed: The PETSc Eisenstat preconditioner wrapper, which has never worked +correctly in parallel, has been removed. +
+(David Wells, 2021/06/11) diff --git a/include/deal.II/lac/petsc_precondition.h b/include/deal.II/lac/petsc_precondition.h index 9e5585ecd1..b17c5e2a9f 100644 --- a/include/deal.II/lac/petsc_precondition.h +++ b/include/deal.II/lac/petsc_precondition.h @@ -397,72 +397,6 @@ namespace PETScWrappers AdditionalData additional_data; }; - - - /** - * A class that implements the interface to use the PETSc Eisenstat - * preconditioner, which implements SSOR on the diagonal block owned by - * each processor. - * - * See the comment in the base class - * @ref PreconditionBase - * for when this preconditioner may or may not work. - * - * @ingroup PETScWrappers - */ - class PreconditionEisenstat : public PreconditionBase - { - public: - /** - * Standardized data struct to pipe additional flags to the - * preconditioner. - */ - struct AdditionalData - { - /** - * Constructor. By default, set the damping parameter to one. - */ - AdditionalData(const double omega = 1); - - /** - * Relaxation parameter. - */ - double omega; - }; - - /** - * Empty Constructor. You need to call initialize() before using this - * object. - */ - PreconditionEisenstat() = default; - - /** - * Constructor. Take the matrix which is used to form the preconditioner, - * and additional flags if there are any. - */ - PreconditionEisenstat( - const MatrixBase & matrix, - const AdditionalData &additional_data = AdditionalData()); - - /** - * Initialize the preconditioner object and calculate all data that is - * necessary for applying it in a solver. This function is automatically - * called when calling the constructor with the same arguments and is only - * used if you create the preconditioner without arguments. - */ - void - initialize(const MatrixBase & matrix, - const AdditionalData &additional_data = AdditionalData()); - - protected: - /** - * Store a copy of the flags for this particular preconditioner. - */ - AdditionalData additional_data; - }; - - - /** * A class that implements the interface to use the PETSc Incomplete * Cholesky preconditioner. diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 267d2c63c3..cdcc9caac6 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -307,48 +307,6 @@ namespace PETScWrappers } - /* ----------------- PreconditionEisenstat -------------------- */ - - PreconditionEisenstat::AdditionalData::AdditionalData(const double omega) - : omega(omega) - {} - - - - PreconditionEisenstat::PreconditionEisenstat( - const MatrixBase & matrix, - const AdditionalData &additional_data) - { - initialize(matrix, additional_data); - } - - - void - PreconditionEisenstat::initialize(const MatrixBase & matrix_, - const AdditionalData &additional_data_) - { - clear(); - - matrix = static_cast(matrix_); - additional_data = additional_data_; - - create_pc(); - - PetscErrorCode ierr = PCSetType(pc, const_cast(PCEISENSTAT)); - AssertThrow(ierr == 0, ExcPETScError(ierr)); - - // then set flags as given - ierr = PCEisenstatSetOmega(pc, additional_data.omega); - AssertThrow(ierr == 0, ExcPETScError(ierr)); - - ierr = PCSetFromOptions(pc); - AssertThrow(ierr == 0, ExcPETScError(ierr)); - - ierr = PCSetUp(pc); - AssertThrow(ierr == 0, ExcPETScError(ierr)); - } - - /* ----------------- PreconditionICC -------------------- */ diff --git a/tests/petsc/reinit_preconditioner_01.cc b/tests/petsc/reinit_preconditioner_01.cc index ae4252f561..11ba3928af 100644 --- a/tests/petsc/reinit_preconditioner_01.cc +++ b/tests/petsc/reinit_preconditioner_01.cc @@ -98,7 +98,6 @@ main(int argc, char **argv) test(); test(); - test(); test(); test(); test(); diff --git a/tests/petsc/reinit_preconditioner_02.cc b/tests/petsc/reinit_preconditioner_02.cc index 6be1876317..9c063b4ba9 100644 --- a/tests/petsc/reinit_preconditioner_02.cc +++ b/tests/petsc/reinit_preconditioner_02.cc @@ -89,7 +89,6 @@ main(int argc, char **argv) test(); test(); test(); - // todo: this crashes test (); test(); test(); test(); diff --git a/tests/petsc/solver_03_precondition_eisenstat.cc b/tests/petsc/solver_03_precondition_eisenstat.cc deleted file mode 100644 index 2865a210a4..0000000000 --- a/tests/petsc/solver_03_precondition_eisenstat.cc +++ /dev/null @@ -1,70 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 2020 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - -// test the PETSc CG solver - - -#include -#include -#include -#include -#include - -#include -#include - -#include "../tests.h" - -#include "../testmatrix.h" - - -int -main(int argc, char **argv) -{ - initlog(); - deallog << std::setprecision(4); - - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - { - SolverControl control(100, 1.e-3); - - const unsigned int size = 32; - unsigned int dim = (size - 1) * (size - 1); - - deallog << "Size " << size << " Unknowns " << dim << std::endl; - - // Make matrix - FDMatrix testproblem(size, size); - PETScWrappers::SparseMatrix A(dim, dim, 5); - testproblem.five_point(A); - - IndexSet indices(dim); - indices.add_range(0, dim); - PETScWrappers::MPI::Vector f(indices, MPI_COMM_WORLD); - PETScWrappers::MPI::Vector u(indices, MPI_COMM_WORLD); - f = 1.; - A.compress(VectorOperation::insert); - - PETScWrappers::SolverCG solver(control); - PETScWrappers::PreconditionEisenstat preconditioner(A); - deallog << "Solver type: " << typeid(solver).name() << std::endl; - - check_solver_within_range(solver.solve(A, u, f, preconditioner), - control.last_step(), - 19, - 21); - } -} diff --git a/tests/petsc/solver_03_precondition_eisenstat.output b/tests/petsc/solver_03_precondition_eisenstat.output deleted file mode 100644 index 1587b4f891..0000000000 --- a/tests/petsc/solver_03_precondition_eisenstat.output +++ /dev/null @@ -1,4 +0,0 @@ - -DEAL::Size 32 Unknowns 961 -DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Solver stopped within 19 - 21 iterations -- 2.39.5