<div class="gmail_quote">On Wed, Apr 25, 2012 at 05:18, Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":bd3">I am successfully solving a couple (unstructured FEM) benchmark<br>
problems with SNES, providing both FormFunction and FormJacobian. I am<br>
using a simple (polynomial) form for the nonlinear part so I am fairly<br>
sure I compute the Jacobian correctly and exactly. I am also getting<br>
the expected results.<br>
<br>
Now I want to reproduce the same results without providing the<br>
Jacobian, preparing for future real life cases where it will not be<br>
known. I am under the impression that Petsc can approximate the<br>
Jacobian itself using some sort of secant method. How exactly am I<br>
supposed to use it? If I change nothing in the code, just pass<br>
-snes_mf_operator to the options, the solver stagnates. The same if I<br>
fill the Jacobian with zeros. The same if only with A. What am I<br>
supposed to do without the known Jacobian to trigger its<br>
approximation?</div></blockquote></div><br><div>Run with -ksp_monitor_true_residual -ksp_converged_reason -snes_monitor -snes_converged_reason -snes_ls_monitor -snes_view and send the output.</div><div><br></div><div>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?</div>