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

Yaqi Wang yaqiwang at gmail.com
Wed Oct 14 02:08:14 CDT 2015


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/a2c60fbc/attachment.html>


More information about the petsc-users mailing list