On Tue, Dec 12, 2017 at 10: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. 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. > They should give the same answer. Maybe I do not understand what you are doing. First, use -pc_type lu so that the linear solver is not a factor. Matt > 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 > > > > -- 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 https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
