<div dir="ltr">Barry,<div>Hi. I am sorry for too late to reply you.</div><div>I read the code you send to me which create a VecScatter for ghost points on rotation boundary.</div><div>But I am still not clear to how to use it to assemble the matrix.</div><div><br></div><div>I studied the example "$SLEPC_DIR/src/eps/examples/tutorials/ex19.c", which is a 3D eigenvalue problem.</div><div><br></div><div>The example uses DMCreateMatrix and MatSetValuesStencil. <br></div><div>In addition, I use MatSetValues to insert value about rotation boundary condtion.</div><div><br></div><div>I run it with command "mpirun -n 1 ./step-2 -eps_nev 3 -eps_ncv 9"</div><div>Error message is listed below:</div><div><div>"</div><div>3-D Laplacian Eigenproblem</div><div><br></div><div> Grid partitioning: 1 1 1</div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: Argument out of range</div><div>[0]PETSC ERROR: Inserting a new nonzero at (91,100) in the matrix</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Release Version 3.7.4, Oct, 02, 2016 </div><div>[0]PETSC ERROR: ./step-2 on a arch-linux2-c-debug named ubuntu by zhaowenbo Mon Apr  3 09:39:08 2017</div><div>[0]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --with-shared-libraries=1 --with-hypre=1 --with-hypre-dir=/usr/local/hypre  </div><div>[0]PETSC ERROR: #1 MatSetValues_SeqAIJ() line 484 in /home/zhaowenbo/research/petsc/petsc-3.7.4/src/mat/impls/aij/seq/aij.c</div><div>[0]PETSC ERROR: #2 MatSetValues() line 1190 in /home/zhaowenbo/research/petsc/petsc-3.7.4/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #3 FillMatrix() line 107 in /home/zhaowenbo/test_slepc/step-2/step-2.c</div><div>[0]PETSC ERROR: #4 main() line 152 in /home/zhaowenbo/test_slepc/step-2/step-2.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -eps_ncv 9</div><div>[0]PETSC ERROR: -eps_nev 3</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div></div><div>"</div><div>I think the reason is Mat Prellocation. If so, I need to create matrix using MatCreate by myself  according to the src code of DMCreateMatrix_DA? Is it correct?</div><div><br></div><div>Could you give some explanation about how to use VecScatter?</div><div>In the $PETSC_DIR/src/ksp/ksp/examples/tutorials/ex2.c, I did not find the VecScatter.</div><div>I found VecScatter is created in the src code of dm/impls/da/da1.c but i am not clear about it.</div><div><br></div><div>BEST,</div><div>Wenbo<br></div><div><br></div></div>