[petsc-dev] is there a bug in private_DMDALocatePointsIS_3D_Regular?

Matteo Semplice matteo.semplice at uninsubria.it
Wed Dec 21 12:34:07 CST 2022

Dear Matt,

     I am trying to translate the local nCell numbers returned by swarm 
particle location routines into the global (i,j,k) indices in the dmda 
and I have run into some oddities in the 3d case. I have dug into the 
private_DMDALocatePointsIS_2D_Regular and 
private_DMDALocatePointsIS_3D_Regular routines and, using 14 points per 
direction and 1 ghost for the DMDA, on 2 cpus:

- the 2d routine thinks to have 13x6 Q1 elements on cpu0 and 13x7 on cpu 
1 (which looks correct to me as 6+7 makes 13 elements in the y direction)

- the 2d routine thinks to have 13x13x6 elements on cpu0 and 13x13x8 on 
cpu1 (which looks one too many)

Removing lines 155-157 from src/dm/impls/da/dageometry.c (patch 
attached) seems to fix some things in my code. I have not studied in 
depth the code of private_DMDALocatePointsIS_3D_Regular, but I have seen 
that the left shift of xs,ys,zs are already performed at lines 137-139.

Could you have a look, please?

(This looked more appropriate for petsc-dev than petsc-users, but I am 
not a subscriber, so could you please reply to me directly as well?)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmda_locate3d.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20221221/3be1f3c9/attachment.bin>

More information about the petsc-dev mailing list