Skip to content

Suppress warning "The linear system solution has not converged" if no linear solver iterations are needed #573

Description

@michelebucelli

Problem

It sometimes happen that the linear solver does not need to run any iteration, because the residual for the initial guess is already below the tolerance. This is checked by an if statement in gmres_s and gmres_v. If this early termination condition is verified, the flag ls.suc is not set to true, so that the caller interprets this behavior as a linear solver failure, and a warning is printed.

The warning is a bit annoying, but more importantly it might be misleading, since the linear solver actually did reach convergence (or better, it was already at convergence for the provided initial guess).

Solution

I propose setting ls.suc = true in the early termination branch of gmres_s and gmres_v, to suppress the unnecessary/incorrect warning.

Additional context

  • This behavior appeared for me due to inconsistent setting of non-linear and linear solver tolerances. The linear solver tolerance was accidentally higher than the non-linear one, so that the linear solver would run no iterations and the non-linear solver would stagnate. I found the warning slightly misleading in this context, as I thought something was wrong with the linear system while in fact I had just set the tolerances incorrectly.
  • I have encountered this behavior for the GMRES solver, but I haven't checked if the same might happen for other solvers.

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions