[petsc-users] help needed for -snes_mf_operator

Jed Brown jedbrown at mcs.anl.gov
Fri Apr 27 01:12:43 CDT 2012


On Fri, Apr 27, 2012 at 01:00, Dominik Szczerba <dominik at itis.ethz.ch>wrote:

> I have
> properly converging non-trivial cases with the Newton solver using
> analytically derived Jacobian. I want to reproduce these results
> WITHOUT using my Jacobian at all with the secant method (i.e. F'(x)
> approximated with finite differences)). You say my Jacobian is wrong,
> and maybe you are right and maybe not. But it does not matter: I do
> not want to use my Jacobian anyway, hoping for the petsc's secant
> method to approximate it. Does petsc have a secant method and does
> -snes_mf_operator option enables it? Or it only works as a
> preconditioner, requiring the Jacobian in any case?
>

-snes_mf_operator is NOT the secant method. Secant is actually only a 1D
method, the generalizations to multiple dimensions are usually referred to
as quasi-Newton, of which BFGS is perhaps the most popular. Those are
-snes_type qn, most of that work is new in petsc-dev.

-snes_mf_operator is Newton, but with the *operator* applied using
matrix-free finite differences. It uses whatever you provide as the
preconditioning matrix.

As for what is going wrong, some of the symptoms you report often occur
when the original system is poorly scaled. What units are you using for
state variables and residuals? This has lots of useful tips

http://scicomp.stackexchange.com/questions/30/why-is-newtons-method-not-converging

See these entries relating to inaccurate finite differencing

* Run with -snes_type test -snes_test_display to see if the Jacobian you
are using is wrong. Compare the output when you add -mat_fd_type ds to see
if the result is sensitive to the choice of differencing parameter.
* Run with -snes_mf_operator -pc_type lu to see if the Jacobian you are
using is wrong. If the problem is too large for a direct solve, try
-snes_mf_operator -pc_type ksp -ksp_ksp_rtol 1e-12. Compare the output when
you add -mat_mffd_type ds to see if the result is sensitive to choice of
differencing parameter.
* Run with quad precision (./configure --with-precision=__float128
--download-f2cblaslapack with PETSc 3.2 and later, needs version 4.6 or
later GNU compilers)
* Change the units (nondimensionalization), boundary condition scaling, or
formulation so that the Jacobian is better conditioned.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120427/09a8a72d/attachment.htm>


More information about the petsc-users mailing list