[petsc-users] A matrix-free Jacobian for SNES using MatShell

Jed Brown jed at 59A2.org
Tue Aug 31 13:29:17 CDT 2010


On Tue, 31 Aug 2010 14:17:00 -0400, Jeremy Roberts <j.alyn.roberts at gmail.com> wrote:
> To implement the safe method---i.e. copying the unknown vector u within
> FOO---what is proper generic form of FOO?
> 
> I guess I'm not clear exactly how FOO and jac_shell (the J*x routine) are
> linked.  It appears they aren't, given I can use an empty subroutine, but
> how then is a local copy of u within FOO used in for J(u) in J(U)*x of
> jac_shell?

FOO is the function called to *update* the Jacobian.  It has the same
prototype as the FormJacobian routines you see in the examples:

  FormJacobian(snes,X,J,Jpre,matstructure,user,ierr)

It sounds like you just need to save the vector.

Jed


More information about the petsc-users mailing list