Using petsc4py.PETSc.SNES directly

@niewiarowski Hi, sorry for the intrusion but were you able to figure this out? I’m getting the exact same problem:

Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 1

Apparently, SNES is not picking up the residual function correctly for some reason, these are the linesearch iterations:

      Line search: gnorm after quadratic fit 2.031122937974e-01
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000002e-02
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000002e-03
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000003e-04
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000004e-05
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000004e-06
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000005e-07
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000005e-08
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000005e-09
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000006e-10
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000006e-11
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000006e-12
      Line search: Cubic step no good, shrinking lambda, current gnorm 2.031122937974e-01 lambda=1.0000000000000007e-13

Best!
Nicolas