Skip to content

Commit

Permalink
LA: keep backwards compatibility with system solver options
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-iob committed Jun 7, 2024
1 parent f135fc1 commit d9831a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/LA/system_solvers_large.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/LA/system_solvers_large.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
};
Expand Down

0 comments on commit d9831a5

Please sign in to comment.