<div dir="ltr">Sorry for my dumb question. I confirmed that I need to set either -snes_mf or -snes_mf_operator. Thanks.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 14, 2015 at 1:18 AM, Yaqi Wang <span dir="ltr"><<a href="mailto:yaqiwang@gmail.com" target="_blank">yaqiwang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">While reading my post again, I realized I did not have -snes_mf or -snes_mf_operator set with -ksp_only. This possibly explains the behavior I observed. I was not thinking this combination. I will confirm this tomorrow.<div><br></div><div>Thanks,</div><div>Yaqi</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 14, 2015 at 1:08 AM, Yaqi Wang <span dir="ltr"><<a href="mailto:yaqiwang@gmail.com" target="_blank">yaqiwang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello All,<div><br></div><div>This is possibly a newbie question but I cannot figure out why. A SNES is set up in my code but I would like to use it for solving a simple linear problem.</div><div><br></div><div>The sequence of setting up the SNES is as the following:</div><div>SNESCreate()</div><div>SNESSetFunction()</div><div>SNESSetJacobian()</div><div>SNESSetFromOptions()</div><div><br></div><div>I do not list all calls but just list those I think matters. Note that my Jacobian is not exact, i.e. it is not consistent with my function.</div><div><br></div><div>Then SNESSolve() is called. If I use -snes_type newtonls and -snes_mf_operator, SNES can solve the linear problem properly, i.e. the residual norm dropped bellow the tolerance I specified. I know I donot have to by playing with tolerances, but I tried -snes_type ksponly. I saw my residual function is only called at the beginning and the end of solve. Most likely KSP is trying to solve the linear problem with the Jacobian I specified, which is not exact. I cannot make the solution converge probably because of this.</div><div><br></div><div>My question is why KSPONLY is not using my function for evaluating (b-Ax) at each linear iteration? I am using the default KSP type, which I guess should be GMRES. I do not think it matters anyway.</div><div>Did I do something wrongly or I had some misunderstanding?</div><div><br></div><div>Many thanks,</div><div>Yaqi</div><div><br></div><div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>