[petsc-users] KSP "randomly" not converging

Matthew Knepley knepley at gmail.com
Tue Jun 2 12:36:45 CDT 2015

On Tue, Jun 2, 2015 at 12:26 PM, Italo Tasso <italo at tasso.com.br> wrote:

> I made a code to solve the Navier-Stokes equations, incompressible,
> non-linear, all coupled, finite differences, staggered grid.
> I am running the code with:
> -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
> It works very well most of the time. But in some cases, the solver halts
> for a long time then KSP does not converge.
> See output1.txt. It seems that the residual is already very small, close
> to machine zero, but KSP doesn't stop.
> So I added -ksp_atol 1e-10. See output2.txt. Now it fails on a different
> time step.
> I also tried -ksp_norm_type unpreconditioned. It works for this case
> (grid size), but fail for other cases.
> 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.
> It feels like this is related to the PC, because the code halts for a long
> time at the first KSP step, then diverges.
> Any suggestions?

Yes, this is related to your preconditioner. If you have a null space, you
have to project it out. However,

      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

this is something strange. Your preconditioner has changed the solution to
your problem. It appears ILU (which I assume you are using.
you should ways send -ksp_view) has broken down completely. It is
unreliable in the extreme.


What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150602/1c18b275/attachment.html>

More information about the petsc-users mailing list