[petsc-users] Bug in DMLocalizeCoordinates/Periodic for PETSc versions >= 3.18?

Berend van Wachem berend.vanwachem at ovgu.de
Thu Jan 26 04:00:33 CST 2023


Dear Petsc-Team,

Since Petsc-3.18 our code no longer runs successfully with periodic 
geometries. Since this version, the call to DMGetPeriodicity has changed 
arguments, but even after adapting our code, for some reason calling 
DMLocalizeCoordinates, at least the way we do, no longer works. To 
illustrate, I have made the following example, please find it attached.

The example creates a box mesh (10 x 10 x 10 cells) with unit size, 
partitions this and distributes this. Then, the co-ordinates are 
localized. The vertices of cell 9 (which on a 1 processor execution of 
the code lies on a periodic domain) are printed before the partitioning 
and after.

For PETSc versions <3.18, the output is:

Before partitioning/distributing/localizing:
Cell 9 has Vecclosuresize 24 and vertices:
9.000000e-01 0.000000e+00 0.000000e+00
9.000000e-01 1.000000e-01 0.000000e+00
0.000000e+00 1.000000e-01 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
9.000000e-01 0.000000e+00 1.000000e-01
0.000000e+00 0.000000e+00 1.000000e-01
0.000000e+00 1.000000e-01 1.000000e-01
9.000000e-01 1.000000e-01 1.000000e-01
After partitioning/distributing/localizing:
Cell 9 has Vecclosuresize 48 and vertices:
9.000000e-01 0.000000e+00 0.000000e+00
9.000000e-01 1.000000e-01 0.000000e+00
1.000000e+00 1.000000e-01 0.000000e+00
1.000000e+00 0.000000e+00 0.000000e+00
9.000000e-01 0.000000e+00 1.000000e-01
1.000000e+00 0.000000e+00 1.000000e-01
1.000000e+00 1.000000e-01 1.000000e-01
9.000000e-01 1.000000e-01 1.000000e-01

(the 'far away' X vertices are correctly put to 1.0)

But, with PETSc versions >= 3.18, we get the following output:

Before partitioning/distributing/localizing:
Cell 9 has Vecclosuresize 24 and vertices:
9.000000e-01 0.000000e+00 0.000000e+00
9.000000e-01 1.000000e-01 0.000000e+00
0.000000e+00 1.000000e-01 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
9.000000e-01 0.000000e+00 1.000000e-01
0.000000e+00 0.000000e+00 1.000000e-01
0.000000e+00 1.000000e-01 1.000000e-01
9.000000e-01 1.000000e-01 1.000000e-01
After partitioning/distributing/localizing:
Cell 9 has Vecclosuresize 24 and vertices:
9.000000e-01 0.000000e+00 0.000000e+00
9.000000e-01 1.000000e-01 0.000000e+00
0.000000e+00 1.000000e-01 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
9.000000e-01 0.000000e+00 1.000000e-01
0.000000e+00 0.000000e+00 1.000000e-01
0.000000e+00 1.000000e-01 1.000000e-01
9.000000e-01 1.000000e-01 1.000000e-01

and both the vertices as well as the Vecclosuresize seem to be different 
from the earlier PETSc versions. Is this a bug? Or are we calling 
functions in the incorrect order?

Thanks, best regards, Berend.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: examplecode.c
Type: text/x-csrc
Size: 3712 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230126/868a3284/attachment.bin>


More information about the petsc-users mailing list