Help: The SNES test result of my jacobian matrix

Barry Smith bsmith at
Fri Nov 30 08:10:36 CST 2007

    The testing of the Jacobian is done for three different input  
Since the first number is fairly large this indicates the Jacobian  
is not correct. You can run with -snes_test_display ALSO and it will  
you both your Jacobian and the one computed with differencing so you
can see exactly what entries are wrong.

    Good luck,


On Nov 30, 2007, at 3:09 AM, Gong Ding wrote:

> Hi all,
> I use -snes_type test to check the Jacobian matrix of my  
> semiconductor code.
> And get the result as follows:
> Testing hand-coded Jacobian, if the ratio is
> O(1.e-8), the hand-coded Jacobian is probably correct.
> Run with -snes_test_display to show difference
> of hand-coded and finite difference Jacobian.
> Norm of matrix ratio 0.00277812 difference 0.0152703
> Norm of matrix ratio 1.82658e-09 difference 1.01895e-08
> Norm of matrix ratio 1.82964e-09 difference 1.02066e-08
> [0]PETSC ERROR: SNESSolve() line 1871 in src/snes/interface/snes.c
> It seems PETSC check hand writing Jacobian for 3 times.
> The Norm is something large in the first time check but keeps small  
> in other two.
> Dose this mean my Jacobian implementation correct or not?
> However, my code seems work well.
> Yours
> Last mail seems lost. I send it again.

More information about the petsc-users mailing list