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

Reply via email to