[petsc-users] Joining SNES with user-defined object

Matthew Knepley knepley at gmail.com
Thu Oct 27 08:45:17 CDT 2011


On Thu, Oct 27, 2011 at 10:05 AM, behzad baghapour <
behzad.baghapour at gmail.com> wrote:

> Dear All,
>
> I want to use SNES for nonlinear Newton Iterations. All of my RHS and
> Jacobian Matrix are calculated with my own defined object called "element".
> How should I pass my object into SNES functions to calculate required RHS
> and Jacobian?
>

Define functions CalculateRHS() and CalculateJacobian() and pass them to
SNES, and pass 'element' as the user context. Then
inside that function, you can get 'element' back from the 'ctx' argument.

   Matt


> Thanks,
> B. B.
>
-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111027/b8b61aff/attachment.htm>


More information about the petsc-users mailing list