[petsc-users] Solving with SNES

Jed Brown jedbrown at mcs.anl.gov
Sat Nov 12 12:27:37 CST 2011


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

> So, after a line-search update in newton iteration, I should in some way
> pass the updated values into my objects (elements) so that the FormJacobian
> and FormFunctions use these objects for the next newton iteration.


No. It's very simple. Put work arrays in a context and set that context for
both FormFunction() and FormJacobian().

In FormFunction(): do NOT assume that anything useful is in the work array.
You can't possibly put something semantically meaningful, so treat them as
uninitialized memory. THIS function puts the useful stuff into the work
arrays. You can do it at the start of the function or you can do it "while"
computing the residual.

In FormJacobian(): use the values that were placed in the work arrays by
FormFunction().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111112/5a6e3617/attachment.htm>


More information about the petsc-users mailing list