[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Something weird with SNES convergence reason




DIVERGED_LS_FAILURE means that the direction computed by solving - J(u^n)^{-1} F(u^n) is NOT a descent direction
that is F(u^n - lambda * J(u^n)^{-1} F(u^n)) is not smaller than F(u^n) for 0 < lambda < 1. Since you are solving the
linear system (in your last test) very accurately this almost always indicates the Jacobian is wrong. Please run with
-snes_type test and see what it says. Also recheck your Jacobian code. If this does not help then take a look at
src/snes/examples/tuturials/ex5.c and see how it can be run with fd_jacobian; you can try that with you code to
track down any errors in the Jacobian.


  Barry



On May 15, 2008, at 9:21 PM, Rafael Santos Coelho 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.

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...