<div dir="ltr">Hi Barry,<div><br></div><div>Thanks for your exlanation. I used -snes_mf -pc_type lu and now it failed with reason -3 (<span style="color:rgb(0,0,0)">/* the linear solve failed */). So, something is wrong with the function.</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 19, 2013 at 5:01 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
ratio is || A - Afd || /||A|| where |||| is the frobenus norm and difference is || A - Afd ||.<br>
<br>
Try using -snes_mf -pc_type lu<br>
<br>
This can often converge even if the A you provide is wrong, so if this convergence sine then likely the Jacobian is wrong.<br>
<br>
It is also possible that the function evaluation has a bug.<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#newton" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html#newton</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Dec 19, 2013, at 4:26 PM, Que Cat <<a href="mailto:quecat001@gmail.com">quecat001@gmail.com</a>> wrote:<br>
<br>
> Hello,<br>
><br>
> I use SNES to solve the non linear coupled equations. I have checked the hand-coded jacobian with -snes_type test and received the result:<br>
> Norm of matrix ratio 1.39606e-23 difference 1.53372e-14 (user-defined state)<br>
> Norm of matrix ratio 3.03157e-10 difference 0.33305 (constant state -1.0)<br>
> Norm of matrix ratio 3.03157e-10 difference 0.33305 (constant state 1.0)<br>
> It said that " if the ratio is O(1.e-8), the hand-coded Jacobian is probably correct." What is the second paramenter "difference 1.53372e-14 ...."? Does it play any role in checking the accuracy of hand-coded jacobian?<br>
><br>
> The SNES solver for failed with the reason -6 "the line search failed". I tried with all other line search method stated in the PETSC manual, but they all failed.<br>
><br>
> I tried to figure out what is wrong with my code? Could you please give me any recommendation to direct me how to check my code? I appreciate your help.<br>
><br>
> QUe<br>
><br>
<br>
</div></div></blockquote></div><br></div>