# Something weird with SNES convergence reason

Matthew Knepley knepley at gmail.com
Fri May 16 09:42:50 CDT 2008

```On Thu, May 15, 2008 at 9:21 PM, Rafael Santos Coelho
<rafaelsantoscoelho at gmail.com> wrote:
> Hi people,
>
> thank you very much for the help. I couldn't fix the problem though...
>
> Matthew:
>
> 1) I guess so because for the vast majority of the tests carried out, the
> method converges and you can actually observe norm(F(x)) decreasing with few
> Newton iterations. For example:
>
> \$ mpirun -np 2 ./bratu_problem -N 16 -M 16 -P 16 -ksp_converged_reason
> -snes_converged_reason -ksp_type lcd -pc_type jacobi -ksp_monitor
>
>   0 KSP Residual norm 5.960419091967e-01
>   1 KSP Residual norm 1.235318806330e+00
> (...)
> Linear solve converged due to CONVERGED_RTOL iterations 56
>   0 KSP Residual norm 2.990541631546e-02
>   1 KSP Residual norm 1.332572441021e-02
> (...)
>  29 KSP Residual norm 3.225505605549e-07
>  30 KSP Residual norm 1.658059885118e-07
> Linear solve converged due to CONVERGED_RTOL iterations 30
>   0 KSP Residual norm 7.629434752036e-05
>   1 KSP Residual norm 1.413056976255e-05
> (...)
>  21 KSP Residual norm 1.183900079277e-09
>  22 KSP Residual norm 6.010910804534e-10
>
> Linear solve converged due to CONVERGED_RTOL iterations 22
> Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE
>
> 2) The governing PDE is  -Laplacian(u) + d * u_x -lambda * exp(u) = 0 and u
> = 0 in all domain boundaries. u_x stands for the partial derivative of u
> with respect to the x variable, where u = u(x, y, z). For all the tests I
> made, d = 16 and lambda = 32. I tried setting d = 0, but the error
> continued.

There is a real problem with d past the birfurcation point. Make d < 6
and run again.
Also, your code is wrong if d == 0 is a problem.

Matt

> Barry:
>
> Consider
>
> \$ mpirun -np 8 ./bratu_problem -x 16 -y 16 -z 16 -ksp_converged_reason
> -snes_converged_reason -ksp_type lcd -pc_type jacobi -ksp_monitor
>
> Here's the output:
>
>   0 KSP Residual norm 5.960419091967e-01
>   1 KSP Residual norm 1.235318806330e+00
> (...)
>  55 KSP Residual norm 7.533575286046e-06
>  56 KSP Residual norm 4.924747432423e-06
> Linear solve converged due to CONVERGED_RTOL iterations 56
>   0 KSP Residual norm 5.899667305071e-01
>   1 KSP Residual norm 1.233037780509e+00
> (...)
>  56 KSP Residual norm 9.299650766487e-06
>  57 KSP Residual norm 5.541388445894e-06
> Linear solve converged due to CONVERGED_RTOL iterations 57
>   0 KSP Residual norm 5.898541843665e-01
>   1 KSP Residual norm 1.230515227262e+00
> (...)
>  57 KSP Residual norm 6.065473514455e-06
>  58 KSP Residual norm 3.255910272791e-06
>
> Linear solve converged due to CONVERGED_RTOL iterations 58
> Nonlinear solve did not converge due to DIVERGED_LS_FAILURE
>
> Now, if I use -ksp_rtol 1.e-10, same thing occurs, the only difference is
> that the number of linear iterations per nonlinear iteration gets bigger (as
> one might have expected).
>
> I'm using the classic 7-point stencil finite difference approximation to
> discretize the PDE...
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which