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

Barry Smith bsmith at mcs.anl.gov
Tue Aug 31 12:14:27 CDT 2010


On Aug 31, 2010, at 1:03 PM, Jeremy Roberts wrote:

> 
> Hi Barry,
> 
> Thanks for the quick response.
> 
> I have the unknown vector u globally accessible and so forgo use of the user-defined context (I tried to get it to work---can it be used in Fortran?).
> 
> I used 
> 
> call SNESSetJacobian( snes, Jshell, Jshell, FOO, PETSC_NULL_OBJECT, ierr )
> 
> where FOO is an empty function having the correct argument types.  It seems to work now, and I get the exact same answer using an explicit Jacobian matrix and the shell version.  Is there a way to get around needing FOO at all?
> 

   If it works great. But I how you know what the "unknown vector u " that is "globally accessible"  in SNES is? How do you know it is the same each time a new Jacobian is needed? The only save way is to copy the vector passed into the FOO funcion.

   Barry



> Jeremy
> 
> 



More information about the petsc-users mailing list