[petsc-users] SNESSolve_KSPONLY not working for my linear problem

Yaqi Wang yaqiwang at gmail.com
Wed Oct 14 10:23:35 CDT 2015

Sorry for my dumb question. I confirmed that I need to set either -snes_mf
or -snes_mf_operator. Thanks.

On Wed, Oct 14, 2015 at 1:18 AM, Yaqi Wang <yaqiwang at gmail.com> wrote:

> 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.
> Thanks,
> Yaqi
> On Wed, Oct 14, 2015 at 1:08 AM, Yaqi Wang <yaqiwang at gmail.com> wrote:
>> Hello All,
>> 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.
>> The sequence of setting up the SNES is as the following:
>> SNESCreate()
>> SNESSetFunction()
>> SNESSetJacobian()
>> SNESSetFromOptions()
>> 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.
>> 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.
>> 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.
>> Did I do something wrongly or I had some misunderstanding?
>> Many thanks,
>> Yaqi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151014/f194e77e/attachment.html>

More information about the petsc-users mailing list