[petsc-users] A number of questions about DMDA with SNES and Quasi-Newton methods

Barry Smith bsmith at mcs.anl.gov
Tue Aug 29 22:26:30 CDT 2017

> On Aug 29, 2017, at 9:49 PM, zakaryah . <zakaryah at gmail.com> wrote:
> I figured out the cause of my problems with the debugger and the Jacobian evaluation - I had a silly memory corruption issue which is now fixed.
> I am still having trouble with convergence.  I am using a test problem of intermediate size, which has nearly identical Jacobians when comparing finite difference to hand-coded.  If I run with -snes_type newtonls -snes_monitor -ksp_monitor -ksp_ksp_monitor -ksp_monitor_true_residual -ksp_converged_reason -snes_converged_reason, the very first SNES iteration fails to converge, due to the KSP failing to converge after 10,000 iterations.
> Following the "Why is my iterative solver not converging?" FAQ, I ran the problem on an even smaller grid, with -snes_type newtonls -snes_monitor -ksp_monitor -ksp_ksp_monitor -ksp_monitor_true_residual -ksp_converged_reason -snes_converged_reason -pc_type svd -pc_svd_monitor, and the linear system was not close to singular.  I don't have any reason to suspect that the linear system becomes more singular as the grid size increases.  Next, I ran with -snes_type newtonls -snes_monitor -ksp_monitor -ksp_ksp_monitor -ksp_monitor_true_residual -ksp_converged_reason -snes_converged_reason -ksp_gmres_restart 1000 -pc_type none, and the KSP seemed to converge better, but the SNES only ran for a few iterations before it stopped with "Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 7".
> ​Can I conclude from this that running the KSP without a pre-conditioner ​is a good idea?  

  -pc_type none is almost always a bad idea.

> At that point, should I go back to asking why the SNES doesn't converge, ala the "Why is Newton's method not converging?" FAQ?

  Use -pc_type lu and send all the output with -snes_monitor -snes_linesearch_monitor -ksp_monitor

   Step one is to get Newton converging well, step 2 is to optimize the linear solver, but never do step 2 before step 1, hence stick to LU until Newton is converging well.

> Thanks for the continuing help!

More information about the petsc-users mailing list