<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""></div><div class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="">Giovane</div></div></blockquote></div> <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 25, 2022, at 11:06 AM, Giovane Avancini via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear PETSc users,<div class=""><br class=""></div><div class="">I'm working on an inhouse code that solves the Navier-Stokes equation in a Lagrangian fashion for free surface flows. Because of the large distortions and pressure gradients, it is quite common to encounter some issues with iterative solvers for some time steps, and because of that, I implemented a function that changes the solver type based on the flag KSPConvergedReason. If this flag is negative after a call to KSPSolve, I solve the same linear system again using a direct method.</div><div class=""><br class=""></div><div class="">The problem is that, sometimes, KSP keeps converging even though the residual is NaN, and because of that, I'm not able to identify the problem and change the solver, which leads to a solution vector equals to INF and obviously the code ends up crashing. Is it normal to observe this kind of behaviour?</div><div class=""><br class=""></div><div class="">Please find attached the log produced with the options -ksp_monitor_lg_residualnorm -ksp_log -ksp_view -ksp_monitor_true_residual -ksp_converged_reason and the function that changes the solver. I'm currently using FGMRES and BJACOBI preconditioner with LU for each block. The problem still happens with ILU for example. We can see in the log file that for the time step 921, the true residual is NaN and within just one iteration, the solver fails and it gives the reason DIVERGED_PC_FAILED. I simply changed the solver to MUMPS and it converged for that time step. However, when solving time step 922 we can see that FGMRES converges while the true residual is NaN. Why is that possible? I would appreciate it if someone could clarify this issue to me.</div><div class=""><br class=""></div><div class="">Kind regards,</div><div class="">Giovane</div><div class=""><br class=""></div><div class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><font size="1" face="tahoma, sans-serif" class="">Giovane Avancini</font><div class=""><font size="1" face="tahoma, sans-serif" class="">Doutorando em Engenharia de Estruturas - Escola de Engenharia de São Carlos, USP</font></div><div class=""><font size="1" face="tahoma, sans-serif" class=""><br class=""></font></div><div class=""><font size="1" face="tahoma, sans-serif" class="">PhD researcher in Structural Engineering - School of Engineering of São Carlos. USP</font></div></div></div></div></div></div></div>
<span id="cid:f_l02lsct61"><function.txt></span><span id="cid:f_l02lscsb0"><log.txt></span></div></blockquote></div><br class=""></body></html>