[petsc-users] Solving with SNES

Jed Brown jedbrown at mcs.anl.gov
Sat Nov 12 12:20:16 CST 2011


On Sat, Nov 12, 2011 at 12:15, behzad baghapour
<behzad.baghapour at gmail.com>wrote:

> I am going to do this, however, for the next newton evaluation I should
> update my context.
>

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).


> 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.
>

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


More information about the petsc-users mailing list