[petsc-users] Convergence Error Debugging with KSP solvers in SNES

Barry Smith bsmith at petsc.dev
Thu Oct 8 13:17:46 CDT 2020


  When you get a huge change at restart this means something is seriously wrong with either the linear operator or the linear preconditioner. 

  How are you doing the matrix vector product?   Note both the operator and preconditioner must be linear operators for GMRES.

  FGMRES allows the preconditioner to be nonlinear. You can try

  -ksp_type fgmres -ksp_monitor_true_residual

   Barry


> On Oct 8, 2020, at 2:43 AM, Yang Juntao <Y.Juntao at hotmail.com> wrote:
> 
> Hello, 
>  
> I’m working on a nonlinear solver with SNES with handcoded jacobian and function. Each linear solver is solved with KSP solver.
> But sometimes I got issues with ksp solver convergence. I tried with finite difference approximated jacobian, but get the same error.
>  
> From the iterations, the convergence seems ok at the beginning but suddenly diverged in the last iteration.
> Hope anyone with experience on ksp solvers could direct me to a direction I can debug the problem.
>  
> iter = 0, SNES Function norm 2.94934e-06
> iteration 0 KSP Residual norm 1.094600281831e-06
> iteration 1 KSP Residual norm 1.264284474186e-08
> iteration 2 KSP Residual norm 6.593269221816e-09
> iteration 3 KSP Residual norm 1.689570779457e-09
> iteration 4 KSP Residual norm 1.040661505932e-09
> iteration 5 KSP Residual norm 5.422761817348e-10
> iteration 6 KSP Residual norm 2.492867371369e-10
> iteration 7 KSP Residual norm 8.261522376775e-11
> iteration 8 KSP Residual norm 4.246401544245e-11
> iteration 9 KSP Residual norm 2.514366787388e-11
> iteration 10 KSP Residual norm 1.982940267051e-11
> iteration 11 KSP Residual norm 1.586470414676e-11
> iteration 12 KSP Residual norm 9.866392216207e-12
> iteration 13 KSP Residual norm 4.951342176999e-12
> iteration 14 KSP Residual norm 2.418292660318e-12
> iteration 15 KSP Residual norm 1.747418526086e-12
> iteration 16 KSP Residual norm 1.094150535809e-12
> iteration 17 KSP Residual norm 4.464287492066e-13
> iteration 18 KSP Residual norm 3.530090494462e-13
> iteration 19 KSP Residual norm 2.825698091454e-13
> iteration 20 KSP Residual norm 1.950568425807e-13
> iteration 21 KSP Residual norm 1.227898091813e-13
> iteration 22 KSP Residual norm 5.411106347374e-14
> iteration 23 KSP Residual norm 4.511115848564e-14
> iteration 24 KSP Residual norm 4.063546606691e-14
> iteration 25 KSP Residual norm 3.677694771949e-14
> iteration 26 KSP Residual norm 3.459244943466e-14
> iteration 27 KSP Residual norm 3.263954971093e-14
> iteration 28 KSP Residual norm 3.087344619079e-14
> iteration 29 KSP Residual norm 2.809426925625e-14
> iteration 30 KSP Residual norm 4.366149884754e-01
>   Linear solve did not converge due to DIVERGED_DTOL iterations 30
>  
>  
> SNES Object: 1 MPI processes
>   type: newtonls
>   SNES has not been set up so information may be incomplete
>   maximum iterations=50, maximum function evaluations=10000
>   tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>   total number of linear solver iterations=0
>   total number of function evaluations=0
>   norm schedule ALWAYS
>   SNESLineSearch Object: 1 MPI processes
>     type: bt
>       interpolation: cubic
>       alpha=1.000000e-04
>     maxstep=1.000000e+08, minlambda=1.000000e-12
>     tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08
>     maximum iterations=40
>   KSP Object: 1 MPI processes
>     type: gmres
>       restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
>       happy breakdown tolerance 1e-30
>     maximum iterations=10000, initial guess is zero
>     tolerances:  relative=1e-08, absolute=1e-50, divergence=10000.
>     left preconditioning
>     using DEFAULT norm type for convergence test
>   PC Object: 1 MPI processes
>     type: fieldsplit
>     PC has not been set up so information may be incomplete
>       FieldSplit with Schur preconditioner, factorization FULL
>       Preconditioner for the Schur complement formed from S itself
>       Split info:
>       KSP solver for A00 block
>           not yet available
>       KSP solver for S = A11 - A10 inv(A00) A01
>           not yet available
>     linear system matrix = precond matrix:
>     Mat Object: 1 MPI processes
>       type: seqaij
>       rows=659, cols=659
>       total: nonzeros=659, allocated nonzeros=7908
>       total number of mallocs used during MatSetValues calls=0
>         not using I-node routines
>  
> Regards
> Juntao

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201008/2330e7b5/attachment.html>


More information about the petsc-users mailing list