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. <br>
<br>I will appreciate any idea if there is a better way to do my job in this matter.<br><br>Thanks,<br><br><br><br><div class="gmail_quote">On Sat, Nov 12, 2011 at 9:27 PM, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Nov 12, 2011, at 2:08 AM, behzad baghapour wrote:<br>
<br>
&gt; Dear developers,<br>
&gt;<br>
&gt; 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.<br>

<br>
</div>   Why don&#39;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&#39;t see any benefit in computing in the monitor function, that is not really the right place either practically or philosophically.<br>

<font color="#888888"><br>
<br>
   Barry<br>
</font><div><div></div><div class="h5"><br>
&gt;<br>
&gt; Please let me know, am I in right way?<br>
&gt;<br>
&gt; Is there any better procedure in this matter?<br>
&gt;<br>
&gt; Thanks, BB.<br>
<br>
</div></div></blockquote></div><br>