[petsc-users] Object is in wrong state, Matrix is missing diagonal entry 0

Matthew Knepley knepley at gmail.com
Wed Oct 14 14:53:47 CDT 2020


On Wed, Oct 14, 2020 at 2:59 PM baikadi pranay <pranayreddy865 at gmail.com>
wrote:

> Hello everyone,
> I am trying to solve the Poisson equation using SNES class. I am running
> into a problem where PETSc complains that an object is in wrong state. I
> opened the matrix object in matlab to see if any diagonal entry is missing
> but I see that it is not the case. Could you please let me know what I am
> missing here?  The complete error is as follows:
>

You are missing the diagonal entry. You can look at the entire structure
using

  MatView(A, PETSC_VIEWER_STDOUT_WORLD);


> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Object is in wrong state
> [0]PETSC ERROR: Matrix is missing diagonal entry 0
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
> [0]PETSC ERROR: ./a.out on a linux-gnu-c-debug named
> cg17-9.agave.rc.asu.edu by pbaikadi Wed Oct 14 11:33:45 2020
> [0]PETSC ERROR: Configure options
> [0]PETSC ERROR: #1 MatILUFactorSymbolic_SeqAIJ() line 1687 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/mat/impls/aij/seq/aijfact.c
> [0]PETSC ERROR: #2 MatILUFactorSymbolic() line 6737 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/mat/interface/matrix.c
> [0]PETSC ERROR: #3 PCSetUp_ILU() line 144 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/ksp/pc/impls/factor/ilu/ilu.c
> [0]PETSC ERROR: #4 PCSetUp() line 932 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/ksp/pc/interface/precon.c
> [0]PETSC ERROR: #5 KSPSetUp() line 391 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/ksp/ksp/interface/itfunc.c
> [0]PETSC ERROR: #6 KSPSolve() line 725 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/ksp/ksp/interface/itfunc.c
> [0]PETSC ERROR: #7 SNESSolve_NEWTONLS() line 225 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/snes/impls/ls/ls.c
> [0]PETSC ERROR: #8 SNESSolve() line 4560 in
> /packages/7x/petsc/3.11.1/petsc-3.11.1/src/snes/interface/snes.c
> [0]PETSC ERROR: #9 User provided function() line 0 in User file
>
> On a different note, I have two more questions.
> 1) When a matrix is being filled using MatSetValues, does the nnz vector
> also have a 0-based indexing?
>

We always use 0-based indices. However, MatSetValues() does not take an nnz
vector.


> 2) If I explicitly have nnz 1-based indexing, then does nnz(i) indicate
> the number of nonzeros in the (i-1)^th row or the i^th row?
>

I do not understand.

  Thanks,

     Matt


> Thank you in advance for your help.
> Best Regards,
> Pranay.
>>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201014/b6c65aa7/attachment.html>


More information about the petsc-users mailing list