[petsc-users] -snes_mf and -snes_fd

Juha Jaykka juhaj at iki.fi
Fri May 6 05:21:43 CDT 2016


> the analytic Jacobian gets used.  That said, our options scheme is lame

You said that, I did refrain from calling it confusing! ;) That said, you're 
doing a terrific job, so just having a small weirdness in something as 
peripheral as command line options is just a testament to how good PETSc is!

> to use separate options when only one can possibly be used.  We should
> have -snes_jacobian <analytic,mf,mf_operator,fd,fd_color> or similar.

So there are five different cases? I think my misunderstanding was related to 
mf_operator and fd_color: I did not realise they were distinct from md and fd, 
hence my perception that there should only be 3 different possibilities. Yet I 
only found four!

I would imagine the one I missed is fd_color, correct? It seems to me

-snes_fd == -snes_fd 1 and this uses the fd approx Jacobian [1]
-snes_mf == -snes_mf 1 uses mf
-snes_mf_operator uses, well, mf_operator (and calls RHS 16 times, btw)
-snes_fd_color uses FD with colouring (this is the case which calls RHS 3 
times; the hand-written Jacobian needs 7)
-NOTHING AT ALL is the same as -snes_fd_color (this is what confused me most)
-there is no way to tell PETSc "yes, I want hand-written Jacobian"? Even 
setting them all to explicitly to zero seems to cause fd_color to be used. (I 
do not get any errors and I get the right result after 3 calls to the RHS even 
if I never call SetJacobian.)

Cheers,
Juha

By the way Matthew, all the tests converged with CONVERGED_FNORM_RELATIVE.

[1] If I so both SNESSetJacobian and SNESSetUseFD (or jt SetFromOptions and 
call but -snes_fd 1), which one takes precedence? The last one called?


More information about the petsc-users mailing list