On Thu, Dec 13, 2012 at 3:05 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><br>
On Dec 13, 2012, at 4:59 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>> wrote:<br>
<br>
> Surely you were aware of the -snes_compare_* options that can be activated in SNESComputeJacobian().<br>
<br>
</div>   Absolutely not. And why in hell would someone put them in a computational routine SNESComputeJacobian() (and not tell anyone about them?).<br></blockquote><div><br></div><div>It's in the man page and has been discussed on the mailing list a few times.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><br>
><br>
> Can we settle on one common way to do this testing and perhaps remove -snes_type test.<br>
><br>
<br>
<br>
</div>What an absolutely horrendous piece of code. It is pretty clear what to do, remove all that sludge from SNESComputeJacobian().  Yes probably -snes_type test could go fairly soon as well.<br></blockquote><div><br></div>
<div>Sounds like Peter's already on it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><font color="#888888"><br>
  Barry<br>
</font></span><div><div><br>
<br>
<br>
><br>
> On Thu, Dec 13, 2012 at 2:55 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
>    I got sick of -snes_type test only checking the Jacobian at the initial solution and not being able to test later Jacobians so I added -snes_check_jacobian that allows the regular running of SNESSolve() (also inside TS) and compares every Jacobian computed with a finite difference version.<br>


><br>
>   For example, (already found one bug in one example :-(). This may be the best thing I've added to PETSc in a decade.<br>
><br>
>    Barry<br>
><br>
><br>
> Barrys-MacBook-Pro:advection-diffusion-reaction barrysmith$ ./ex1 -snes_check_jacobian -snes_monitor  -ts_type arkimex | more<br>
>     0 SNES Function norm 2.182384017537e+00<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.68322e-09 = ||J - Jfd||//J|| 6.69028e-06  = ||J - Jfd||<br>
>     1 SNES Function norm 4.695397453383e-07<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       2.45109e-09 = ||J - Jfd||//J|| 9.74235e-06  = ||J - Jfd||<br>
>     2 SNES Function norm 4.020379099215e-13<br>
>     0 SNES Function norm 6.799718390407e-01<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.65487e-09 = ||J - Jfd||//J|| 6.5776e-06  = ||J - Jfd||<br>
>     1 SNES Function norm 4.558192078678e-08<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       2.93714e-09 = ||J - Jfd||//J|| 1.16742e-05  = ||J - Jfd||<br>
>     2 SNES Function norm 9.907308296870e-14<br>
>     0 SNES Function norm 1.000842117652e+00<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.24476e-09 = ||J - Jfd||//J|| 4.94755e-06  = ||J - Jfd||<br>
>     1 SNES Function norm 9.875108391772e-08<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.10818e-10 = ||J - Jfd||//J|| 4.40468e-07  = ||J - Jfd||<br>
>     2 SNES Function norm 7.677760150017e-14<br>
>     0 SNES Function norm 2.179048757949e+00<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.32338e-09 = ||J - Jfd||//J|| 5.27058e-07  = ||J - Jfd||<br>
>     1 SNES Function norm 4.625448863612e-05<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
>         Run with -snes_check_jacobian_display to show difference of hand-coded and finite difference Jacobian.<br>
>       1.57582e-09 = ||J - Jfd||//J|| 6.27588e-07  = ||J - Jfd||<br>
>     2 SNES Function norm 4.391784647745e-14<br>
>     0 SNES Function norm 6.761591873515e-01<br>
>         Testing hand-coded Jacobian, if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct.<br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>