[petsc-users] -snes_mf and -snes_fd

Juha Jaykka juhaj at iki.fi
Thu May 5 12:01:36 CDT 2016


Dear list,

I am a bit confused by some SNES options. How do -snes_mf, -snes_fd, 
SNESSetJacobian exactly interact?

I run my code (it's basically the Bratu3D example in python) with 

-snes_fd 0 -snes_mf 0 and my RHS code gets called 7 times
-snes_fd 0 -snes_mf 1 and RHS called 44 times
-snes_fd 1 -snes_mf 0 and RHS called 775 times
-snes_fd 1 -snes_mf 1 and RHS called 44 times
without -snes_mf AT ALL but with -snes_fd 0 I get RHS called 3 times [1]
without -snes_mf AT ALL but with -snes_fd 1 I get RHS called 775 times
without -snes_mf OR -snes_fd, I get RHS called 3 times [1]
without -snes_fd at all and -snes_mf, I get 44 calls
without -snes_fd at all and -snes_mf 1, I get 44 calls
without -snes_fd at all and -snes_mf 0, I get 3 calls [1]

I would have expected -snes_mf 0 and no snes_mf at all to behave in the same 
way. I am also puzzled by the fact that there seem to be four different ways 
to solve the problem: with Jacobian (3 calls), with fd (775 calls) and with mf 
(44 calls). What is the 7 calls case all about?

I guess in all the years I've used PETSc I should have learnt better, but I 
had never taught it to anyone before, so hand't noticed my lack of knowledge.

Cheers,
Juha

[1] This causes my Jacobian routine to be called as intended.






More information about the petsc-users mailing list