[petsc-users] SNESGetJacobian issue when added to snes/ex3.c

Matthew Knepley knepley at gmail.com
Tue Apr 8 15:44:51 CDT 2014


On Tue, Apr 8, 2014 at 3:18 PM, Xiangdong <epscodes at gmail.com> wrote:

> Hello everyone,
>
> I have a question about the usage of SNESGetJacobian().
>
> When I added the following three lines to the snes Monitor function in ex3
> for viewing the Jacobian matrix:
>
> Mat Jmat;
> ierr = SNESGetJacobian(snes,&Jmat,NULL,NULL,NULL); CHKERRQ(ierr);
> ierr = MatView(Jamt, PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(ierr);
>
>  I got error message complaining:
> Operation done in wrong order!
> Must call MatAssemblyBegin/End() before viewing matrix!
>  MatView() line 812 in matrix.c
>
>
> Is the Jmat returned by SNESGetJacobian supposed to be assembled?
>

We do not control assembly. You have put values in the Jacobian without
assembling.


> Even if I add MatAssemblyBegin/End(), it still crashes by reporting
> argument out of range in MatSetValues_SeqAIJ() or MatSetValues_MPIAIJ().
>

Always always always send the full error log.

   Matt


> Any suggestions?
>
> Thank you.
>
> Xiangdong
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140408/68f55efb/attachment.html>


More information about the petsc-users mailing list