> On Dec 12, 2017, at 9:54 AM, Alexander Lindsay <[email protected]> 
> wrote:
> 
> I'm working with a relatively new set of physics (new to me) and the 
> Jacobians are bad. While debugging the Jacobians, I've been running with 
> different finite difference approximations. I've found in general that 
> matrix-free approximation of the Jacobian action leads to much better 
> convergence than explicitly forming the Jacobian matrix using finite 
> differences.


   How are you forming the Jacobian matrix using finite differences? Are you 
using PETSc routines (which?) or your own?

   The behavior you report is almost always due to incorrect Jacobian entries.  
If you are using your own computed Jacobian you can run with -snes_type test to 
compare with sample Jacobians that PETSc produces.

  Barry


> Should I be surprised by this or is this something that's known? It would be 
> great if anyone has a reference they could point me to.
> 
> Just to illustrate the different solves:
> 
> Matrix-free (preconditioner formed from finite-differenced approximation of 
> Jacobian):
> 
>  0 Nonlinear |R| = 2.259203e-02
>       0 Linear |R| = 2.259203e-02
>       1 Linear |R| = 2.259203e-02
>       2 Linear |R| = 1.682777e-02
>       3 Linear |R| = 9.274378e-09
>  1 Nonlinear |R| = 1.744830e-02
>       0 Linear |R| = 1.744830e-02
>       1 Linear |R| = 2.335817e-08
>  2 Nonlinear |R| = 2.704512e-08
>       0 Linear |R| = 2.704512e-08
>       1 Linear |R| = 1.265577e-14
>  3 Nonlinear |R| = 1.478929e-10
>  Solve Converged!
> 
> Explicit formation of Jacobian using finite-differences (preconditioner 
> formed from same matrix):
> 
>  0 Nonlinear |R| = 2.259203e-02
>       0 Linear |R| = 2.259203e-02
>       1 Linear |R| = 2.259203e-02
>       2 Linear |R| = 1.481452e-12
>  1 Nonlinear |R| = 2.258733e-02
>       0 Linear |R| = 2.258733e-02
>       1 Linear |R| = 2.258520e-02
>       2 Linear |R| = 1.594456e-07
>  2 Nonlinear |R| = 2.258733e-02
>       0 Linear |R| = 2.258733e-02
>       1 Linear |R| = 2.258520e-02
>       2 Linear |R| = 1.869913e-07
> Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 2
> 
> 
> 

Reply via email to