<div dir="ltr"><font face="times new roman, serif">Barry,</font><div><font face="times new roman, serif"><br></font></div><div><font face="times new roman, serif">It said that "No support for this operation for this object type! Matrix format mpiaij does not have a built-in PETSc LU!".</font></div>
<div><font face="times new roman, serif"><br></font></div><div><font face="times new roman, serif">I run it with optio<span style="background-color:rgb(255,255,255)">n "<code style="color:rgb(0,0,0)">-snes_monitor -ksp_monitor_true_residual -snes_converged_reason -ksp_converged_reason</code><span style="color:rgb(0,0,0)">." and received : </span></span></font></div>
<div><span style="color:rgb(0,0,0);background-color:rgb(213,234,255)"><font face="times new roman, serif"><div>    0 SNES Function norm 1.414213647226e-01 </div><div>    0 KSP preconditioned resid norm 8.424084241999e+08 true resid norm 1.414213647226e-01 ||r(i)||/||b|| 1.000000000000e+00</div>
<div>    1 KSP preconditioned resid norm 1.354908290122e-02 true resid norm 1.424694873074e-01 ||r(i)||/||b|| 1.007411345428e+00</div><div>Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 0</div><div>
<br></div><div>It looks like that the preconditioned residual converges, but the true residual does not.</div></font></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 8:30 AM, 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>
  Run with<br>
<br>
   -snes_mf_operator -pc_type lu<br>
<br>
   I’m sorry I sent the wrong instructions before.<br>
<span class="HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Dec 20, 2013, at 7:54 AM, Que Cat <<a href="mailto:quecat001@gmail.com">quecat001@gmail.com</a>> wrote:<br>
<br>
> Hi Barry,<br>
><br>
> Thanks for your exlanation. I used -snes_mf -pc_type lu and now it failed with reason -3 (/* the linear solve failed */). So, something is wrong with the function.<br>
><br>
><br>
> On Thu, Dec 19, 2013 at 5:01 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><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>
><br>
><br>
>    Barry<br>
><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>
><br>
<br>
</div></div></blockquote></div><br></div>