<div dir="ltr"><div><div><div>Hi all<br><br></div>I want to use Petsc to solve some linear systems via the built-in Krylov subspace methods as well as by means of UMFPACK.<br><br></div>The considered matrix is block sparse with blocks of size 6x6. <br><br></div><div>Here is what I came up with after taking a look at some of the examples<br></div><div><br>MPI_Comm comm;<br>Mat A;<br>PetscInt n = 10000; /* dimension of matrix */<br>comm = PETSC_COMM_SELF;<br>MatCreate(comm,&A);<br>MatSetSizes(Amat,n,n,n,n);<br>MatSetBlockSize(A,6);<br>MatSetType(A,MATAIJ); /* UMFPACK compatible format due to comm = PETSC_COMM_SELF */<br><br></div><div>Questions:<br></div><div>1. <br>I work on a single node with 2-8 cores. Hence, comm = PETSC_COMM_SELF; I guess. Is it correct in this contect to set MatSetSizes(Amat,n,n,n,n); with 4-times n?<br><br></div><div>2. <br>After the above sequence of commands do I have to use something like<br>  MatSeqAIJSetPreallocation(A,0,d_nnz); /* d_nnz <-> number of nonzeros per row */<br>or is it possible to use<br>  MatSeqBAIJSetPreallocation(A,6,0,db_nnz); /* db_nnz <-> number of block nonzeros per block row */<br><br>In any case, is something like<br>  MatSetValuesBlocked(A,1,idx_r,1,idx_c,myblockvals,INSERT_VALUES);<br>to fill values of one block into the matrix A ok?<br><br><br></div><div>Regards<br></div><div>Tim<br></div></div>