[petsc-users] MatSetValues dropping non-local entries

Randall Mackie rlmackie862 at gmail.com
Wed Aug 24 16:27:10 CDT 2016


I’ve run into a situation where MatSetValues seems to be dropping non-local entries. Most of the entries that are set are local, but a few are possibly non-local, and are only maximum a few grid points off the local part of the grid.

Specifically, I get the local to global mapping, and the indices like so:

call DMGetLocalToGlobalMapping(da,ltogm,ierr)
call ISLocalToGlobalMappingGetIndices(ltogm,ltog,idltog,ierr)

then set the row using ltog(idltog + row +1) etc

When run on 1 process, everything worked fine, but for > 1 I was not getting the right result (I know what the right answer should be for a simple case).

I found that when I increased the stencil width on the DA (in the call to DACreate3d) that was used in the DMGetLocalToGlobalMapping to be large enough that the non-local points would be in the ghost region, everything was fine even for > 1 process.


So, in conclusion, it seems like if I use a local to global mapping from DMGetLocalToGlobalMapping, then MatSetValues will drop any non-local entries that are not included in the ghost region.


Is this the correct behavior and if so, is there another way to set these non-local values so they don’t get dropped?


Thanks, 

Randy


More information about the petsc-users mailing list