[petsc-users] -snes_mf and -snes_fd

Matthew Knepley knepley at gmail.com
Thu May 5 12:37:42 CDT 2016


On Thu, May 5, 2016 at 12:01 PM, Juha Jaykka <juhaj at iki.fi> wrote:

> 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
>

It would help to have -snes_monitor -snes_converged_reason here:


> -snes_fd 0 -snes_mf 0 and my RHS code gets called 7 times
>

This looks like 7 iterates with your assembled Jacobian. Judging from
below, it appears there might be a different PC here.


> -snes_fd 0 -snes_mf 1 and RHS called 44 times
>

Here each action of the Jacobian takes one RHS evaluation, and one at the
beginning of each Newton iterate.


> -snes_fd 1 -snes_mf 0 and RHS called 775 times
>

Here we have one RHS for each column of the Jacobian  at each Newton
iterate since we form it explicitly (actually for each color in the
graph, but that is a detail).


> -snes_fd 1 -snes_mf 1 and RHS called 44 times
>

The second option overrides the first.


> without -snes_mf AT ALL but with -snes_fd 0 I get RHS called 3 times [1]
>

I need to see the output of -snes_view for these cases. Its possible that we
have a bug related to the argument.


> 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]
>

Yes.


> 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
>

These two are the same since we assume a 1 argument.

  Thanks,

    Matt


> 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.
>
>
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160505/5c224991/attachment.html>


More information about the petsc-users mailing list