On Tue, Apr 8, 2014 at 3:18 PM, Xiangdong <epsco...@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

Reply via email to