<div class="gmail_quote">On Sat, Nov 12, 2011 at 12:15, behzad baghapour <span dir="ltr"><<a href="mailto:behzad.baghapour@gmail.com">behzad.baghapour@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":2fi">I am going to do this, however, for the next newton evaluation I should update my context.</div></blockquote><div><br></div><div>I don't understand. You have some work space in your context. Use that work space during residual evaluation and leave the partial evaluations there. Use the same context for Jacobian evaluation, and use the partially evaluation quantities (instead of recomputing them).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2fi"> 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>
</div></blockquote><div><br></div><div>The first time SNESSolve() is called, the residual is evaluated before the monitor is called. If a line search is done, the residual may be called multiple times before the monitor is called. Don't use the monitor for this, just put the code in your residual evaluation.</div>
</div>