<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 3 May 2022, at 6:54 PM, Randall Mackie <<a href="mailto:rlmackie862@gmail.com" class="">rlmackie862@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Pierre,<div class=""><br class=""></div><div class="">Here is how I create the matrix, and how I’ve done it for many years:</div><div class=""><br class=""></div><div class=""><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> ! Create global matrix to hold system of equations resulting from finite discretization<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> ! of the Maxwell equations. <o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> ngrow3=ginfo%nx*ginfo%ny*ginfo%nz*3<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatCreate(comm,A,ierr)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatSetSizes(A,mloc3,mloc3,ngrow3,ngrow3,ierr)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatSetBlockSize(A,i3,ierr)</div></div></div></div></blockquote><div><br class=""></div><div>I don’t know enough about your discretization stencil, but again, since a simple call to MatConvert(A,MATBAIJ,MAT_INITIAL_MATRIX,C,ierr) fails in your MWE, I doubt that this line is correct.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatSetType(A,MATAIJ,ierr)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatSeqAIJSetPreallocation(A,i15,PETSC_NULL_INTEGER,ierr)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatMPIAIJSetPreallocation(A,i15,PETSC_NULL_INTEGER,i7,PETSC_NULL_INTEGER,ierr)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""> call MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE,ierr)</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><br class=""></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">This is a staggered grid formulation (but derived many years before PETSc had a DMStag class) and so I use regular DMDA….for those locations that are not involved, I put a 1 on the diagonal.</div></div></div></div></blockquote><div><br class=""></div><div>If you want to use a block size of dimension 3, you also need to explicitly MatSetValue (or MatSetValues or MatSetValuesBlocked) zeros for all 3x3 dense blocks.</div><div><br class=""></div><div>Thanks,</div><div>Pierre </div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Randy</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On May 3, 2022, at 9:37 AM, Pierre Jolivet <<a href="mailto:pierre@joliv.et" class="">pierre@joliv.et</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks for the reproducer.<div class="">My guess is that your AIJ matrix has not a block size of 3.</div><div class="">A simple call such as: call MatConvert(A,MATBAIJ,MAT_INITIAL_MATRIX,C,ierr) is also failing, while it shouldn’t if your AIJ Mat is truly made of 3x3 dense blocks.</div><div class="">How did you determine the block size of your Mat?</div><div class="">Are you allocating 3x3 dense blocks everywhere or are you skipping zero coefficients in your AIJ Mat?</div><div class="">In the meantime, you can bypass the issue by not setting a block size of 3 on your Mat, or by setting different block size for the column and row distributions, see MatSetBlockSizes().</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre</div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 3 May 2022, at 5:39 PM, Randall Mackie <<a href="mailto:rlmackie862@gmail.com" class="">rlmackie862@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear PETSc team:<div class=""><br class=""></div><div class="">A part of our code that has worked for years and previous versions is now failing with the latest version 3.17.1, on the KSP solve with the following error:</div><div class=""><br class=""></div><div class=""><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: Invalid argument<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: Block size 3 is incompatible with the indices: non consecutive indices 153055 153124<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: See <a href="https://fra01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpetsc.org%2Frelease%2Ffaq%2F&data=05%7C01%7CRandall.Mackie%40CGG.com%7C323fb230ca4f45d45c7408da2d18c44e%7C307ea68275e14701a1146c42f9ff0d24%7C0%7C0%7C637871881639501468%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3iAxFsi8wDXPcxKRBVFotn7DpoVNc9%2Fq60r%2F57nn7Lw%3D&reserved=0" style="color: rgb(5, 99, 193);" class="">https://petsc.org/release/faq/</a> for trouble shooting.<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: Petsc Release Version 3.17.1, Apr 28, 2022 <o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: ./test on a linux-gfortran-complex-debug named rmackie-VirtualBox by rmackie Tue May 3 08:12:15 2022<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: Configure options --with-clean=1 --with-scalar-type=complex --with-debugging=1 --with-fortran=1 --download-mpich=../external/mpich-4.0.1.tar.gz<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #1 ISSetBlockSize() at /home/rmackie/PETSc/petsc-3.17.1/src/vec/is/is/interface/index.c:1898<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #2 MatIncreaseOverlap() at /home/rmackie/PETSc/petsc-3.17.1/src/mat/interface/matrix.c:7086<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #3 PCSetUp_ASM() at /home/rmackie/PETSc/petsc-3.17.1/src/ksp/pc/impls/asm/asm.c:238<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #4 PCSetUp() at /home/rmackie/PETSc/petsc-3.17.1/src/ksp/pc/interface/precon.c:990<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #5 KSPSetUp() at /home/rmackie/PETSc/petsc-3.17.1/src/ksp/ksp/interface/itfunc.c:407<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #6 KSPSolve_Private() at /home/rmackie/PETSc/petsc-3.17.1/src/ksp/ksp/interface/itfunc.c:843<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">[0]PETSC ERROR: #7 KSPSolve() at /home/rmackie/PETSc/petsc-3.17.1/src/ksp/ksp/interface/itfunc.c:1078</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I have a small test program with binary matrix and right hand side that will show the problem and I can send it as a zip file, please advise what email address to use or where to send it.</div><div class=""><br class=""></div><div class="">Thanks, </div><div class=""><br class=""></div><div class="">Randy M.</div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>