Adjust NewtonSolver error message when maximum iterations reached

Issue #461 resolved
Jack Hale created an issue

I have a colleague who is new to FEniCS attempting to solve the Navier Stokes' equations using the built in NewtonSolver method. By default the maximum number of iterations is set to 10, and when the maximum number of iterations is reached the NewtonSolver gives the error:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to solve nonlinear system with NewtonSolver.
*** Reason:  Newton solver did not converge.
*** Where:   This error was encountered inside NewtonSolver.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.5.0
*** Git changeset:  f8384b60ebe3988167d77d08e356d253649766bd
*** -------------------------------------------------------------------------

which doesn't hint to the user that the NewtonSolver terminated due to the implicit choice of maximum_iterations being set to 10.

Perhaps this should be changed to:

'Newton solver did not converge. Maximum iterations exceeded. Try increasing parameters["newton_solver"]["maximum_iterations"].'

Can do this if we decide on wording of error message.

Comments (2)

  1. Prof Garth Wells

    Could you make a pull request that bumps up the default max iteration count (say to 50) and improves the error message?

  2. Log in to comment