# [petsc-users] Snes behavior

Ryan Yan vyan2000 at gmail.com
Sun Jan 10 15:28:05 CST 2010

```Hi Matt,
Thank you very much for the suggestion.  I was using
so the Jacobian is calculated by automatic differentiation, right? For this
instance, is there any way to check the correctness of the set up of the
residual?

After I tried the -snes_mf the linear solver failed( ):

0 SNES Function norm 1.578681107621e+08
1 SNES Function norm 1.343502549866e+08
2 SNES Function norm 1.211729760183e+08
3 SNES Function norm 1.211728837635e+08
4 SNES Function norm 1.211728837178e+08
5 SNES Function norm 1.211728837177e+08
0 SNES Function norm 1.999574234301e+08
0 SNES Function norm 1.677632378801e+08
Number of Newton iterations = 0
Converged reason is -3

Might it be helpful to call DMMGGetSNES and then setup the analytical
jacobian for the preconditioner matrix? My residual is pretty
straightforward though.

Yan

On Sun, Jan 10, 2010 at 3:59 PM, Matthew Knepley <knepley at gmail.com> wrote:

> It is possible for the radius of quadratic convergence to be very small.
> However, I
> would check your Jacobian, and maybe try -snes_mf.
>
>   Matt
>
>
> On Sun, Jan 10, 2010 at 2:55 PM, Ryan Yan <vyan2000 at gmail.com> wrote:
>
>> Hi All,
>> I am solving a nonlinear system using snes. The -snes_monitor option has
>> the following output:
>>
>>   0 SNES Function norm 2.640163923729e+09
>>   1 SNES Function norm 1.047643565314e+08
>>   2 SNES Function norm 1.712732074788e+06
>>   3 SNES Function norm 1.002169173269e+04
>>   4 SNES Function norm 1.655878303433e+03
>>   5 SNES Function norm 3.746498305706e+02
>>   6 SNES Function norm 8.317435704773e+01
>>   7 SNES Function norm 1.857639969641e+01
>>   8 SNES Function norm 4.149691057773e+00
>>   9 SNES Function norm 9.265604042412e-01
>>  10 SNES Function norm 2.069527103214e-01
>>  11 SNES Function norm 4.624186491082e-02
>>  12 SNES Function norm 1.035558432688e-02
>>  13 SNES Function norm 2.341362958811e-03
>>  14 SNES Function norm 5.507445427277e-04
>>  15 SNES Function norm 1.485123568354e-04
>>  16 SNES Function norm 5.180043781814e-05
>>  17 SNES Function norm 2.341966514486e-05
>>  18 SNES Function norm 1.344936158651e-05
>>  19 SNES Function norm 1.054812641176e-05
>> Number of Newton iterations = 19
>> Converged reason is 4
>>
>> It looks like the iterate never falls into a quadratic convergence region
>> before it converges. Is there any hint to understand this behavior?
>>
>> Thanks a lot,
>>
>> Yan
>>
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their