Yaqi Wang
2015-10-14 07:08:14 UTC
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
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