[petsc-users] same_nonzero_pattern in SNESSetJacobian()

Barry Smith bsmith at mcs.anl.gov
Wed Sep 9 16:35:52 CDT 2015


> On Sep 9, 2015, at 4:07 PM, Xiangdong <epscodes at gmail.com> wrote:
> 
> Each time I call my Jacobian function, it generates the Jacoiban matrix from scratch by inserting entries.

    You mean you create a new matrix? With MatCreate or MatCreateXXX()? 

    Why do this? Why not just reuse the one that is passed in? It will be more efficient.

> The result of this assembling process gives the same nonzero pattern as in the previous iteration. Can SNES/KSP track this too?

  If you are creating a new matrix, no.

  Barry

> 
> Thanks.
> 
> Xiangdong 
> 
> On Wed, Sep 9, 2015 at 5:01 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>   Mat now keeps track of its nonzero pattern. If you do not change the pattern by inserting values then SNES/KSP will automatically keep the same pattern and optimize for it.
> 
>   Barry
> 
> > On Sep 9, 2015, at 3:57 PM, Xiangdong <epscodes at gmail.com> wrote:
> >
> > Hello everyone,
> >
> > As mentioned in the 3.5 changes, MatStructure argument is removed from SNESSetJacobian(). If each time, my Jacobian always has same_nonzero_pattern. How do I pass this information to SNES or the KSP? I only find reuse same preconditioner, but not reuse same pattern.
> >
> > Thank you.
> >
> > Xiangdong
> 
> 



More information about the petsc-users mailing list