Smith, Barry F. bsmith at mcs.anl.gov
Wed Sep 19 11:06:30 CDT 2018

```Nonlinear solve did not converge due to DIVERGED_FUNCTION_COUNT

> SNES Object: 1 MPI processes
>   type: newtonls
>   maximum iterations=50, maximum function evaluations=10000

You need to set a much higher count for number of function evaluations, say -snes_max_funcs  1.e12

Barry

We should probably increase the default in PETSc.

> On Sep 19, 2018, at 10:26 AM, Yingjie Wu <yjwu16 at gmail.com> wrote:
>
> Dear Petsc developer:
> Hi,
>
> I recently wrote an example of neutron diffusion, which shows that the nonlinear residuals are gradually decreasing, but the program terminates in the tenth step of the nonlinear step.The program output information is as follows.
>
> -snes_fd -pc_type lu -snes_view -snes_converged_reason -snes_monitor_cancel -ksp_converged_reason -ksp_monitor_true_residual
>
> iter = 0, SNES Function norm 0.999045
>     0 KSP preconditioned resid norm 1.143042621777e+02 true resid norm 9.990445435144e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 2.250033129078e-12 true resid norm 3.772661181818e-14 ||r(i)||/||b|| 3.776269242757e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 1, SNES Function norm 0.863398
>     0 KSP preconditioned resid norm 3.176569252473e+00 true resid norm 8.633978674995e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 7.360979829512e-14 true resid norm 1.835881897914e-14 ||r(i)||/||b|| 2.126345184557e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 2, SNES Function norm 0.217885
>     0 KSP preconditioned resid norm 5.796196387015e+01 true resid norm 2.178851605144e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 9.643306967470e-13 true resid norm 3.884638811957e-14 ||r(i)||/||b|| 1.782883608405e-13
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 3, SNES Function norm 0.217871
>     0 KSP preconditioned resid norm 3.792350832110e+01 true resid norm 2.178711262680e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 1.369102629758e-12 true resid norm 1.632695466260e-13 ||r(i)||/||b|| 7.493858843196e-13
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 4, SNES Function norm 0.217839
>     0 KSP preconditioned resid norm 2.467674567895e+01 true resid norm 2.178387732479e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 1.336018611676e-12 true resid norm 2.369440379931e-14 ||r(i)||/||b|| 1.087703692324e-13
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 5, SNES Function norm 0.217793
>     0 KSP preconditioned resid norm 1.325333377704e+01 true resid norm 2.177933144217e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 2.663121116220e-13 true resid norm 6.399802508715e-15 ||r(i)||/||b|| 2.938475189519e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 6, SNES Function norm 0.217546
>     0 KSP preconditioned resid norm 8.654271429945e+00 true resid norm 2.175456199462e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 2.103027422078e-12 true resid norm 1.896269373207e-14 ||r(i)||/||b|| 8.716651586351e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 7, SNES Function norm 0.217024
>     0 KSP preconditioned resid norm 5.238463146996e+00 true resid norm 2.170240974179e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 1.538914082201e-13 true resid norm 1.398699322805e-14 ||r(i)||/||b|| 6.444903305426e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 8, SNES Function norm 0.215661
>     0 KSP preconditioned resid norm 3.380654310210e+00 true resid norm 2.156611254980e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 5.676163043758e-14 true resid norm 2.209776803347e-15 ||r(i)||/||b|| 1.024652355979e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 9, SNES Function norm 0.213573
>     0 KSP preconditioned resid norm 1.833370627403e+00 true resid norm 2.135728351107e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 1.237094085371e-13 true resid norm 3.167085089319e-15 ||r(i)||/||b|| 1.482906329205e-14
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 10, SNES Function norm 0.206951
>     0 KSP preconditioned resid norm 1.011617991320e+00 true resid norm 2.069514796799e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 3.789650938118e-13 true resid norm 5.695302032970e-14 ||r(i)||/||b|| 2.751998701231e-13
>   Linear solve converged due to CONVERGED_RTOL iterations 1
> Nonlinear solve did not converge due to DIVERGED_FUNCTION_COUNT iterations 10
> SNES Object: 1 MPI processes
>   type: newtonls
>   maximum iterations=50, maximum function evaluations=10000
>   tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>   total number of linear solver iterations=11
>   total number of function evaluations=10623
>   norm schedule ALWAYS
>   Jacobian is built using finite differences one column at a time
>   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-05, absolute=1e-50, divergence=10000.
>     left preconditioning
>     using PRECONDITIONED norm type for convergence test
>   PC Object: 1 MPI processes
>     type: lu
>       out-of-place factorization
>       tolerance for zero pivot 2.22045e-14
>       matrix ordering: nd
>       factor fill ratio given 5., needed 5.81047
>         Factored matrix follows:
>           Mat Object: 1 MPI processes
>             type: seqaij
>             rows=961, cols=961
>             package used to perform factorization: petsc
>             total: nonzeros=38169, allocated nonzeros=38169
>             total number of mallocs used during MatSetValues calls =0
>               not using I-node routines
>     linear system matrix = precond matrix:
>     Mat Object: 1 MPI processes
>       type: seqaij
>       rows=961, cols=961
>       total: nonzeros=6569, allocated nonzeros=15485
>       total number of mallocs used during MatSetValues calls =712
>         not using I-node routines
>
>
>
> I don't know why the program was terminated. I really need your help.
>
> Thanks,
> Yingjie
>
>
>

```