[petsc-users] snessetjacobian question

Jed Brown jedbrown at mcs.anl.gov
Thu Sep 22 10:17:52 CDT 2011


On Thu, Sep 22, 2011 at 17:14, Milan Mitrovic <milan.v.mitrovic at gmail.com>wrote:

> I use snes for an implicit time stepping scheme... I call it in a loop
> for every time step...
>
> the jacobian is recomputed at every step, and the preallocation can
> change from time to time... what is the proper way to do it then?
> destroy the matrix, then recreate it?
>

Don't destroy the matrix, just call the preallocation routines when the
nonzero pattern changes.

You can actually destroy the matrices from C, but I don't think there is a
pure Fortran way to do it (it needs another pointer indirection) and you
should never need to anyway.


> what should I do with the
> preconditioner matrix? (petsc complains if I dont do P = J)
>

What do you mean "complains"? You can certainly use a different
preconditioning matrix.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110922/89317558/attachment-0001.htm>


More information about the petsc-users mailing list