<div class="gmail_quote">On Fri, Mar 18, 2011 at 12:41, Gianluca Meneghello <span dir="ltr"><<a href="mailto:gianmail@gmail.com">gianmail@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">One more thing: what does the three lines stand for then? I was<br>
thinking it was three Newton steps, but I understand it's not...<br></div></blockquote><div><br></div><div>It is your Jacobian evaluated at user-defined state, constant -1.0, and constant 1.0. I added this to the output for petsc-dev:</div>
<div><br></div><div><div>$ ./ex5 -snes_type test</div><div>Testing hand-coded Jacobian, if the ratio is</div><div>O(1.e-8), the hand-coded Jacobian is probably correct.</div><div>Run with -snes_test_display to show difference</div>
<div>of hand-coded and finite difference Jacobian.</div><div>Norm of matrix ratio 2.77166e-08 difference 2.17871e-07 (user-defined state)</div><div>Norm of matrix ratio 1.34123e-08 difference 1.23213e-07 (constant state -1.0)</div>
<div>Norm of matrix ratio 1.31875e-07 difference 9.05494e-07 (constant state 1.0)</div><div>[0]PETSC ERROR: SNESSolve() line 2360 in /home/jed/petsc/src/snes/interface/snes.c</div><div>[0]PETSC ERROR: main() line 220 in src/snes/examples/tutorials/ex5.c</div>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
<br>
The output I sent was actually the output of one of your examples. The<br>
one from my own code is<br>
<br>
</div>Testing hand-coded Jacobian, if the ratio is<br>
<div class="im">O(1.e-8), the hand-coded Jacobian is probably correct.<br>
Run with -snes_test_display to show difference<br>
of hand-coded and finite difference Jacobian.<br>
</div><div class="im">Norm of matrix ratio 9.17257e-08 difference 2.58876e-05<br></div></blockquote><div><br></div><div>Is your starting state zero?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
Norm of matrix ratio 1.45865e-06 difference 0.000430034<br>
Norm of matrix ratio 1.47148e-06 difference 0.000429436</div></blockquote></div><br><div>If your problem is ill-conditioned, this might come from differencing error. Try with -mat_fd_type ds to use a slightly more robust scheme. You can also run with -ksp_rtol 1e-12 -pc_type lu -snes_monitor and check if you see quadratic convergence.</div>