I am going to do this, however, for the next newton evaluation I should update my context. I can,t find any command in petsc to do it for me. Upon the previous discussion in this forum about SNES, I understood that a monitor function is called after each newton iteration and when it is called it may be a good chance to update my context within it.
I will appreciate any idea if there is a better way to do my job in this matter. Thanks, On Sat, Nov 12, 2011 at 9:27 PM, Barry Smith <bsmith at mcs.anl.gov> wrote: > > 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. > > > Barry > > > > > Please let me know, am I in right way? > > > > Is there any better procedure in this matter? > > > > Thanks, BB. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111112/7fc965b9/attachment.htm>
