[petsc-users] help needed for -snes_mf_operator

Jed Brown jedbrown at mcs.anl.gov
Wed Apr 25 06:25:05 CDT 2012


On Wed, Apr 25, 2012 at 05:18, Dominik Szczerba <dominik at itis.ethz.ch>wrote:

> I am successfully solving a couple (unstructured FEM) benchmark
> problems with SNES, providing both FormFunction and FormJacobian. I am
> using a simple (polynomial) form for the nonlinear part so I am fairly
> sure I compute the Jacobian correctly and exactly. I am also getting
> the expected results.
>
> Now I want to reproduce the same results without providing the
> Jacobian, preparing for future real life cases where it will not be
> known. I am under the impression that Petsc can approximate the
> Jacobian itself using some sort of secant method. How exactly am I
> supposed to use it? If I change nothing in the code, just pass
> -snes_mf_operator to the options, the solver stagnates. The same if I
> fill the Jacobian with zeros. The same if only with A. What am I
> supposed to do without the known Jacobian to trigger its
> approximation?
>

Run with -ksp_monitor_true_residual -ksp_converged_reason -snes_monitor
-snes_converged_reason -snes_ls_monitor -snes_view and send the output.

Your SNES callback gets two Mat arguments, into which are you assembling
your approximate Jacobian? Are you still calling MatAssemblyBegin/End on
the first argument, as in the examples?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120425/72983ed2/attachment.htm>


More information about the petsc-users mailing list