I may have exaggerated when I described the preconditioner as "good". All I know about the preconditioner is that it helps. It is a very rough approximation of the Jacobian. So I don't think I can just use the preconditioner as a stand-in for the Jacobian.
As for using -snes_mf_operator, I doubt that would work. I'm minimizing the energy of a large lattice with defects, and when I use a simplified form of the energy, I still have to resort to Kahan summation to preserve enough accuracy in the Jacobian to get the system to converge. For this reason, I don't think a finite difference approximation of the Jacobian will work due to the loss of precision already inherent in the calculation. Best, Michael On Wed, Jul 1, 2015 at 5:43 AM, Matthew Knepley <knep...@gmail.com> wrote: > On Wed, Jul 1, 2015 at 7:19 AM, Michael White <mrwh...@umn.edu> wrote: > >> Hello, >> >> I am not quite sure how to use the L-BFGS implementation in PETSc with a >> preconditioner that approximates the Jacobian. As far as I understand it, >> L-BFGS is like Newton's Method but doesn't require the user to input the >> Jacobian matrix. However, for my application, I do have a good >> preconditioner that approximates the Jacobian matrix. My question is where >> to input such a preconditioner. I have 3 possible guesses about the correct >> way to do it. >> >> 1. Use SNESSetJacobian to provide a function which computes the >> preconditioner. I'm unsure if this information is even used though, since >> L-BFGS builds its own approximation to the inverse Jacobian as it goes. >> >> 2. Use SNESQNSetScaleType with SNES_QN_SCALE_JACOBIAN to set my >> preconditioner as an initial approximation to the Jacobian somehow? >> > > This is the intent, but we have no tests of this in PETSc, so let me know > if this works. Jed Brown and Peter Brune have a paper > where they do this and it has the options they used. > > >> 3. Use an SNESSetNPC with my preconditioner as a linear preconditioner? >> >> Anyone that could point me in the right direction would be greatly >> appreciated. >> > > Why are you using L-BFGS if you have a good Jacobian preconditioner? You > could do Newton with that > preconditioning matrix and MF application of the Jacobian. > > Thanks, > > Matt > > >> Best regards, >> Michael White >> >> >> > > > -- > 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 >