[petsc-users] snessetjacobian question
Jed Brown
jedbrown at mcs.anl.gov
Thu Sep 22 10:08:58 CDT 2011
On Thu, Sep 22, 2011 at 17:05, Milan Mitrovic <milan.v.mitrovic at gmail.com>wrote:
> The J is not initialized when I call SNESSetJacobian...
>
> I will try that, but I dont know nmax at that point... can I set it later?
>
Yes, create the matrix and set the sizes outside, but skip preallocation.
Then, inside the jacobian routine (only on the first time unless it
changes), call MatMPIAIJSetPreallocation() and MatSeqAIJSetPreallocation().
You can also arrange to do this in a setup stage before calling SNESSolve(),
but there is no problem calling it from your Jacobian evaluation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110922/11f61490/attachment.htm>
More information about the petsc-users
mailing list