[petsc-users] Solving with SNES

Barry Smith bsmith at mcs.anl.gov
Sat Nov 12 11:57:27 CST 2011

On Nov 12, 2011, at 2:08 AM, behzad baghapour wrote:

> Dear developers,
> I should pass a user-defined context, containing element and face local data obtained from PDE solution, to RHS and Jacobian evaluation of SNES process. Here I need to update my context each Newton Iteration. I may pass my context into a monitor function set by SNESMonitorSet. In the monitor function, I cast into my context and update my field (elements and faces) for next evaluations in RHS and Jacobian routines in Newton process. 

   Why don't you simply pass them in the SNESSetFunction() context and compute them inside your compute function, then use them. Also pass the same context into SNESSetJacobian() and you can reuse that information in computing in the Jacobian. I don't see any benefit in computing in the monitor function, that is not really the right place either practically or philosophically.


> Please let me know, am I in right way?
> Is there any better procedure in this matter?
> Thanks, BB.

More information about the petsc-users mailing list