[petsc-users] Error when using DMSTAG_UP for array indexing

Zhang, Sijie zhangsijie at gatech.edu
Wed May 18 22:49:38 CDT 2022


Hi,

I got an error when using  DMSTAG_UP for DMStagVec array indexing in a 2D DMStag Mesh.

I used the following code for accessing the getting the index for local vector data stored at the left and up locations (edge).

PetscInt idFup[4], dFleft[4];
for (ii = 0; ii < 4; ii++)
        DMStagGetLocationSlot(ctx->dmF, LEFT, ii, &idFleft[ii]);
for (ii = 0; ii < 4; ii++)
        DMStagGetLocationSlot(ctx->dmF, RIGHT, ii, &idFright[ii]);

And I used the following sample code for getting the data:

a = UArr[ey][ex][idFright[ii]])

However, after the calculation, I found there are weird fluctuations at the boundary of the mesh blocks assigned to each processor as shown in the Figure below.(The yellow lines, 5 processors were used in this case.) There seemed to be a communication error when using DMSTAG_UP. And I also found the value of idFright[ii] was much larger than the index for the locations of left, right, or elements. It's on a level of 400+, while the other was only like 1 to 10.

Was there any I did wrong when setting up the 2D DMStag?

Thank you and best regards.

Sijie Zhang

[cid:94a295bd-6851-489d-83d8-44d2a6d80314]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220519/96fbd23a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 20901 bytes
Desc: image.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220519/96fbd23a/attachment-0001.png>


More information about the petsc-users mailing list