<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 2, 2015 at 12:26 PM, Italo Tasso <span dir="ltr"><<a href="mailto:italo@tasso.com.br" target="_blank">italo@tasso.com.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">I made a code to solve the Navier-Stokes equations, incompressible, non-linear, all coupled, finite differences, staggered grid.</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">I am running the code with:</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div><font face="arial, helvetica, sans-serif">-ts_monitor -snes_monitor -ksp_monitor_true_residual -snes_converged_reason -ksp_converged_reason -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_detect_saddle_point</font><br></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">It works very well most of the time. But in some cases, the solver halts for a long time then KSP does not converge. </font></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">See output1.txt. It seems that the residual is already very small, close to machine zero, but KSP doesn't stop.</span></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">So I added </span><font face="arial, helvetica, sans-serif">-ksp_atol 1e-10. </font><span style="font-family:arial,helvetica,sans-serif">See output2.txt. Now it fails on a different time step.</span></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">I also tried </span><font face="arial, helvetica, sans-serif">-ksp_norm_type unpreconditioned. It works for this case (grid size), but fail for other cases.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I also tried building the Jacobian and including null space. It fixes some cases but causes others that worked before to fail. Seems really random.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">It feels like this is related to the PC, because the code halts for a long time at the first KSP step, then diverges.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Any suggestions?</font></div></div>
</blockquote></div><br>Yes, this is related to your preconditioner. If you have a null space, you have to project it out. However,</div><div class="gmail_extra"><br></div><div class="gmail_extra"><pre class="">      0 KSP preconditioned resid norm 1.044238592402e-03 true resid norm 9.729564145362e-11 ||r(i)||/||b|| 1.000000000000e+00
      1 KSP preconditioned resid norm 1.044238592401e-03 true resid norm 6.820544672134e-10 ||r(i)||/||b|| 7.010123547399e+00
      2 KSP preconditioned resid norm 1.044238592401e-03 true resid norm 8.445969119028e-10 ||r(i)||/||b|| 8.680727104362e+00
</pre><div>this is something strange. Your preconditioner has changed the solution to your problem. It appears ILU (which I assume you are using.</div><div>you should ways send -ksp_view) has broken down completely. It is unreliable in the extreme.</div><div><br></div><div>   Matt</div><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>