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

Xiangdong epscodes at gmail.com
Tue Apr 8 15:18:33 CDT 2014


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?

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

Any suggestions?

Thank you.

Xiangdong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140408/b771f3b4/attachment.html>


More information about the petsc-users mailing list