[petsc-dev] -snes_check_jacobian
Peter Brune
prbrune at gmail.com
Thu Dec 13 17:04:47 CST 2012
Dangit Barry! I already started a patch moving all Jed's -snes_compare_*
garbage in SNESComputeJacobian() over to a SNESJacobianMonitor registration
type deal where it has functions you can register to run after computing
the Jacobian. This will allow you to do all sorts of nice comparisons.
Dangit Jed! -snes_compare_* is a seeerious mess and shouldn't be in
SNESComputeJacobian(). Barry's recent holy war against string comparisons
will find this some day and there will be a lot of explaining to do.
- Peter
On Thu, Dec 13, 2012 at 4:59 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> Surely you were aware of the -snes_compare_* options that can be activated
> in SNESComputeJacobian().
>
> Can we settle on one common way to do this testing and perhaps remove
> -snes_type test.
>
>
> On Thu, Dec 13, 2012 at 2:55 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>>
>> 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.
>>
>> For example, (already found one bug in one example :-(). This may be
>> the best thing I've added to PETSc in a decade.
>>
>> Barry
>>
>>
>> Barrys-MacBook-Pro:advection-diffusion-reaction barrysmith$ ./ex1
>> -snes_check_jacobian -snes_monitor -ts_type arkimex | more
>> 0 SNES Function norm 2.182384017537e+00
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.68322e-09 = ||J - Jfd||//J|| 6.69028e-06 = ||J - Jfd||
>> 1 SNES Function norm 4.695397453383e-07
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 2.45109e-09 = ||J - Jfd||//J|| 9.74235e-06 = ||J - Jfd||
>> 2 SNES Function norm 4.020379099215e-13
>> 0 SNES Function norm 6.799718390407e-01
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.65487e-09 = ||J - Jfd||//J|| 6.5776e-06 = ||J - Jfd||
>> 1 SNES Function norm 4.558192078678e-08
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 2.93714e-09 = ||J - Jfd||//J|| 1.16742e-05 = ||J - Jfd||
>> 2 SNES Function norm 9.907308296870e-14
>> 0 SNES Function norm 1.000842117652e+00
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.24476e-09 = ||J - Jfd||//J|| 4.94755e-06 = ||J - Jfd||
>> 1 SNES Function norm 9.875108391772e-08
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.10818e-10 = ||J - Jfd||//J|| 4.40468e-07 = ||J - Jfd||
>> 2 SNES Function norm 7.677760150017e-14
>> 0 SNES Function norm 2.179048757949e+00
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.32338e-09 = ||J - Jfd||//J|| 5.27058e-07 = ||J - Jfd||
>> 1 SNES Function norm 4.625448863612e-05
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>> Run with -snes_check_jacobian_display to show difference of
>> hand-coded and finite difference Jacobian.
>> 1.57582e-09 = ||J - Jfd||//J|| 6.27588e-07 = ||J - Jfd||
>> 2 SNES Function norm 4.391784647745e-14
>> 0 SNES Function norm 6.761591873515e-01
>> Testing hand-coded Jacobian, if the ratio is O(1.e-8), the
>> hand-coded Jacobian is probably correct.
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20121213/0fd37597/attachment.html>
More information about the petsc-dev
mailing list