<div><br></div><div dir="auto">While trying to use -fp_trap with a debugger on a local system we used the debug build of our and PETSc code and all solvers are working fine (left and right PC and fgmres also) and no NaNs either. Interrogating the optimized version of the code now…</div><div dir="auto"><br></div><div dir="auto"> <br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, May 2, 2022 at 11:11 AM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, May 2, 2022 at 1:56 PM Amneet Bhalla <<a href="mailto:mail2amneet@gmail.com" target="_blank">mail2amneet@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks Matt and Barry. Since we are using MATSHELL, we printed max norm of || b || and || A*x ||, the two things that have all the physics of the problem. Both are coming out to be finite (no NANs). Perhaps there is a NaN in PCSHELL. But this is counter-intuitive because the true residual norm || b - A*x || has a NaN where there is no PC application. We checked the velocity and pressure field in VisIt and they seem to be reasonable and matching the analytical solution well. Need to try it in a debugger or -fp_trap next. </div></blockquote><div><br></div><div>I would recommend -fp_trap. It will just fail at the first NaN so it is really easy to find. You can also send the code and I can run it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The behavior is similar to what is discussed in this thread: <a href="https://www.mail-archive.com/petsc-users@mcs.anl.gov/msg34602.html" target="_blank">https://www.mail-archive.com/petsc-users@mcs.anl.gov/msg34602.html</a> </div></div></blockquote><div><br></div><div>That turned out to be a bug in their code.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 2, 2022 at 7:56 AM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote type="cite"><div>On May 2, 2022, at 8:12 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div dir="ltr">On Mon, May 2, 2022 at 12:23 AM Ramakrishnan Thirumalaisamy <<a href="mailto:rthirumalaisam1857@sdsu.edu" target="_blank">rthirumalaisam1857@sdsu.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you. I have a couple of questions. <span style="font-family:"Helvetica Neue";font-size:13px">I am solving the low Mach Navier-Stokes system using a projection preconditioner (pc_shell type) with GMRES being the outer solver and Richardson being the Krylov preconditioner. The solver diverges when ksp_pc_type is "right”: </span><div><font face="Helvetica Neue"><br></font></div><div>Linear stokes_ solve did not converge due to DIVERGED_NANORINF iterations 0</div></div></blockquote><div><br></div><div>NaN can always be tracked back. I recommend tracing it back to the first NaN produced. My guess is that your equation of state if producing a NaN.</div></div></div></div></blockquote><div><br></div> You can run in the debugger with -ksp_error_if_not_converged or -fp_trap to see when the Nan first appears. If the problem does not appear on one rank or you need to use mpiexec to start the program you can use the option -start_in_debugger to have the program started up in the debugger <a href="https://petsc.org/main/docs/manualpages/Sys/PetscAttachDebugger.html" target="_blank">https://petsc.org/main/docs/manualpages/Sys/PetscAttachDebugger.html</a></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Also, we have an example of low Mach flow in TS ex76.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><span style="font-family:"Helvetica Neue";font-size:13px">and it converges when ksp_pc_type is "left":</span></div><div><font face="Helvetica Neue"><br></font></div><div>Residual norms for stokes_ solve.<br> 0 KSP preconditioned resid norm 8.829128536017e+04 true resid norm -nan ||r(i)||/||b|| -nan<br> 1 KSP preconditioned resid norm 1.219313641627e+00 true resid norm -nan ||r(i)||/||b|| -nan<br> 2 KSP preconditioned resid norm 8.547033285706e-12 true resid norm -nan ||r(i)||/||b|| -nan<br>Linear stokes_ solve converged due to CONVERGED_RTOL iterations 2<font face="Helvetica Neue"><br></font><div><br></div><div><span style="font-family:"Helvetica Neue";font-size:13px"> I am curious to know why this is happening. The solver also diverges with "FGMRES" as the outer solver (which supports only right preconditioning). </span></div></div></div><div><span style="font-family:"Helvetica Neue";font-size:13px"><br></span></div><div><span style="font-family:"Helvetica Neue";font-size:13px">2. Is it also possible to not get "-nan" when || b || = 0?</span></div><div><span style="font-family:"Helvetica Neue";font-size:13px"><br></span></div><div><span style="font-family:"Helvetica Neue";font-size:13px"><br></span></div><div><span style="font-family:"Helvetica Neue";font-size:13px">Regards,</span></div><div><span style="font-family:"Helvetica Neue";font-size:13px">Rama </span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 1, 2022 at 12:12 AM Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Sun 1. May 2022 at 07:03, Amneet Bhalla <<a href="mailto:mail2amneet@gmail.com" target="_blank">mail2amneet@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">How about using a fixed number of Richardson iterations as a Krylov preconditioner to a GMRES solver? </div></blockquote><div dir="auto"><br></div><div dir="auto">That is fine.</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Would that lead to a linear operation? </div></blockquote><div dir="auto"><br></div><div dir="auto">Yes.</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 30, 2022 at 8:21 PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In general, no. A fixed number of Krylov iterations (CG, GMRES, etc.) is a nonlinear operation.<br>
<br>
A fixed number of iterations of a method with a fixed polynomial, such as Chebyshev, is a linear operation so you don't need a flexible outer method. <br>
<br>
Ramakrishnan Thirumalaisamy <<a href="mailto:rthirumalaisam1857@sdsu.edu" target="_blank">rthirumalaisam1857@sdsu.edu</a>> writes:<br>
<br>
> Hi,<br>
><br>
> I have a Krylov solver with a preconditioner that is also a Krylov solver.<br>
> I know I can use "fgmres" for the outer solver but can I use gmres for the<br>
> outer solver with a fixed number of iterations in the Krylov<br>
> preconditioners?<br>
><br>
><br>
> Thanks,<br>
> Rama<br>
</blockquote></div></div>-- <br><div dir="ltr"><div dir="ltr"><div>--Amneet <br><br></div><div><br></div><div><br></div></div></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</div></blockquote></div><br></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>--Amneet <br><br></div><div><br></div><div><br></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>--Amneet <br><br></div><div><br></div><div><br></div></div></div>