[petsc-users] SNESSetFunction and MatMFFDSetFunction

Jed Brown jedbrown at mcs.anl.gov
Wed Jan 1 12:16:03 CST 2014


Song Gao <song.gao2 at mail.mcgill.ca> writes:

> Dear all,
>
> Happy new year!
>
> I'm using the matrix-free method to solve NS equations. I call
> the SNESSetFunction to set the RHS function. I think SNES also uses that
> RHS function to evaluate the matrix vector product.
>
> But I want to set one function to evaluate the residual, and another
> different function to evaluate the matrix vector product. How can I do
> that? Does MatMFFDSetFunction do this job?

Yes, you can look at src/snes/examples/tutorials/ex22.c for an example
of similar (replace SNESComputeFunction with your desired function).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140101/93f8a7fc/attachment.pgp>


More information about the petsc-users mailing list