<div dir="ltr"><div dir="ltr">On Mon, Apr 1, 2019 at 12:36 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com">fdkong.jd@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"><div dir="ltr"><div dir="ltr">On Mon, Apr 1, 2019 at 10:24 AM Matthew Knepley via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</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"><div dir="ltr">On Mon, Apr 1, 2019 at 10:22 AM Yingjie Wu via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</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">Dear PETSc developers:<div>Hi,</div><div><p style="margin:0px;white-space:pre-wrap">I've been using -snes_mf_operator and I've customized a precondition matrix to solve my problem.I have two questions about the residuals of linear steps(KSP residual).</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">1.Since I'm using a matrix-free method, how do we get KSP residuals in PETSc? </p><p style="margin:0px;white-space:pre-wrap"> r_m = b - A*x_m</p><p style="margin:0px;white-space:pre-wrap"> Is finite difference used to approximate "A*x_m" ?</p></div></div></blockquote><div><br></div><div>Yes.</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><p style="margin:0px;white-space:pre-wrap">2.What is the difference between instruction ' -ksp_monitor ' and ' -ksp_monitor_true_residual ' in how they are calculated? </p></div></div></blockquote><div><br></div><div>The true residual is the unpreconditioned residual.</div></div></div></blockquote><div><br></div><div>I actually have some specific understanding on "<span style="white-space:pre-wrap"> -ksp_monitor_true_residual</span>", but not sure it is right or not. If I am wrong, please correct me.</div><div><br></div><div>When the preconditioning matrix is super ill-conditioned, the ``true residual" is not necessary ``true" for the right preconditioning since an unwind process is applied. That is, <span style="white-space:pre-wrap"> "-ksp_monitor_true_residual" does not print ||b-Ax||, instead, it prints </span> the unpreconditioned residual by unpreconditioning the preconditioned residual.</div></div></div></div></blockquote><div><br></div><div>This calls KSPBuildResidual(). Everything but GCR calls KSPBuildResidualDefault(). This just computes b - Ax.</div><div>What you may be talking about is how you get x when you are right preconditioning. This calls KSPBuildSolution().</div><div>With right preconditioning, you must apply the preconditioner to get back to the original space, but this IS EXACTLY</div><div>the true residual.</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 dir="ltr"><div class="gmail_quote"><div>Thanks,</div><div><br></div><div>Fande,</div><div><br></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 class="gmail_quote"><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><p style="margin:0px;white-space:pre-wrap">Thanks,</p><p style="margin:0px;white-space:pre-wrap">Yingjie</p><p style="margin:0px;white-space:pre-wrap"><br></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;font-size:10.5pt;font-family:等线"><span lang="EN-US"></span></p><p style="margin:0px;white-space:pre-wrap"> <br></p></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-8910557435759134479gmail-m_-7239521809844990676gmail_signature"><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></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><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>