From d9831a55ba01f3ca88b2664ffd9e83ec127bec24 Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Fri, 7 Jun 2024 13:43:40 +0200 Subject: [PATCH] LA: keep backwards compatibility with system solver options --- src/LA/system_solvers_large.cpp | 14 +++++++++++++- src/LA/system_solvers_large.hpp | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/LA/system_solvers_large.cpp b/src/LA/system_solvers_large.cpp index 504820f919..c475e4d747 100644 --- a/src/LA/system_solvers_large.cpp +++ b/src/LA/system_solvers_large.cpp @@ -3291,9 +3291,21 @@ void SystemSolver::setupPreconditioner(PC pc, const KSPOptions &options) const PC subPC; KSPGetPC(subKSP, &subPC); PCSetType(subPC, PCILU); - if (options.levels != PETSC_DEFAULT) { + if (options.sublevels != PETSC_DEFAULT) { + log::warning() << " Setting ASM ILU levels using the member \"sublevels\" is deprecated." + << " ASM ILU levels should be set using the member \"levels\"." << std::endl; + + PCFactorSetLevels(subPC, options.sublevels); + } else if (options.levels != PETSC_DEFAULT) { PCFactorSetLevels(subPC, options.levels); } + + if (options.subrtol != PETSC_DEFAULT) { + log::warning() << " The member \"subrtol\" is deprecated. Since ASM is only use a a preconditioner" + << " setting the tolerance of the Krylov subspace doens't have any effect on the" + << " solution of the system." + << std::endl; + } } } } diff --git a/src/LA/system_solvers_large.hpp b/src/LA/system_solvers_large.hpp index a40d08cade..70e1a592b2 100644 --- a/src/LA/system_solvers_large.hpp +++ b/src/LA/system_solvers_large.hpp @@ -47,10 +47,14 @@ struct KSPOptions { PetscScalar rtol; //! Relative convergence tolerance, relative decrease in the preconditioned residual norm PetscScalar atol; //! Absolute convergence tolerance, absolute size of the preconditioned residual norm + PetscInt sublevels; //! Deprecated, ASM ILU levels should be set using the "levels" member + PetscScalar subrtol; //! Deprecated, it has never had any effect on the solution of the system + KSPOptions() : overlap(PETSC_DEFAULT), levels(PETSC_DEFAULT), initial_non_zero(PETSC_TRUE), restart(PETSC_DEFAULT), - maxits(PETSC_DEFAULT), rtol(PETSC_DEFAULT), atol(PETSC_DEFAULT) + maxits(PETSC_DEFAULT), rtol(PETSC_DEFAULT), atol(PETSC_DEFAULT), + sublevels(PETSC_DEFAULT), subrtol(PETSC_DEFAULT) { } };