[petsc-dev] DMPlex: fix bug for natural Point SF

Alexis Marboeuf alexis.marboeuf at hotmail.fr
Mon Aug 15 15:34:26 CDT 2022


Dear Petsc Team,
Following my recent MR !5502, I noticed a bug in DMPlexDistribute related to the natural point SF. The section passed as an argument to DMPlexCreateGlobalToNaturalSF should be the natural section, instead of the section before distribution. In case of multiple call of DMPlexDistribute, the natural section and the section before distribution do not match. This bug is fixed by simply passing NULL to DMPlexCreateGlobalToNaturalSF in DMPlexDistribute: line 1929 of plexdistribute.c. Now, the natural section is constructed in DMPlexCreateGlobalToNaturalSF, thanks to PetscSFDistributeSection using the natural point SF (migrationSF) and the section after distribution. It raises however an error


# [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------

# [0]PETSC ERROR: Invalid argument

# [0]PETSC ERROR: Unknown discretization type for field 0

# [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.

# [0]PETSC ERROR: Petsc Development GIT revision: v3.17.4-1073-g78daca0807b  GIT Date: 2022-08-15 16:17:10 +0000

# [0]PETSC ERROR: ../ex26 on a arch-darwin-c-debug named Alexiss-MacBook-Pro.local by alexismarboeuf Mon Aug 15 14:24:41 2022

# [0]PETSC ERROR: Configure options --download-bison=1 --download-chaco=1 --download-exodusii=1 --download-hdf5=1 --download-hypre=1 --download-metis=1 --download-ml=1 --download-netcdf=1 --download-parmetis=1 --download-pnetcdf=1 --download-sowing=1 --download-triangle --download-yaml=1 --download-zlib=1 --with-boost-dir=/opt/homebrew/Cellar/boost/1.78.0_1/ --with-boost=1 --with-c2html=0 --with-clib-autodetect=0 --with-cmake=1 --with-debugging=1 --with-exodusii-fortran-bindings --with-fortran-datatypes=1 --with-fortranlib-autodetect=0 --with-mpi-dir=/opt/homebrew/Cellar/mpich/4.0.2/ --with-ranlib=ranlib --with-shared-libraries=1 --with-sieve=1 --with-x11=1 PETSC_ARCH=arch-darwin-c-debug

# [0]PETSC ERROR: #1 DMCreateLocalSection_Plex() at /Users/alexismarboeuf/Documents/mypetsc/src/dm/impls/plex/plexsection.c:458

# [0]PETSC ERROR: #2 DMGetLocalSection() at /Users/alexismarboeuf/Documents/mypetsc/src/dm/interface/dm.c:4310

# [0]PETSC ERROR: #3 DMPlexCreateGlobalToNaturalSF() at /Users/alexismarboeuf/Documents/mypetsc/src/dm/impls/plex/plexnatural.c:121

# [0]PETSC ERROR: #4 DMPlexDistribute() at /Users/alexismarboeuf/Documents/mypetsc/src/dm/impls/plex/plexdistribute.c:1926

# [0]PETSC ERROR: #5 main() at /Users/alexismarboeuf/Documents/mypetsc/src/dm/impls/plex/tests/ex26.c:272

in all the following tests:


dm_impls_plex_tests-ex15_0 dm_impls_plex_tests-ex64_4 dm_impls_plex_tests-ex64_8 dm_impls_plex_tests-ex26f90_10 dm_impls_plex_tests-ex26_8 dm_impls_plex_tests-ex26_6 dm_impls_plex_tests-ex26f90_16 dm_impls_plex_tests-ex26_19 dm_impls_plex_tests-ex26f90_6 dm_impls_plex_tests-ex47_0 dm_impls_plex_tests-ex26_17 dm_impls_plex_tests-ex26f90_8 dm_impls_plex_tests-ex26f90_18 dm_impls_plex_tests-ex26_9 dm_impls_plex_tests-ex64_5 dm_impls_plex_tests-ex64_9 dm_impls_plex_tests-ex26_10 dm_impls_plex_tests-ex26_7 dm_impls_plex_tests-ex47_1 dm_impls_plex_tests-ex26_18 dm_impls_plex_tests-ex64_3 dm_impls_plex_tests-ex26f90_7 dm_impls_plex_tests-ex26f90_17 dm_impls_plex_tests-ex26f90_19 dm_impls_plex_tests-ex26_16 dm_impls_plex_tests-ex26f90_9


At this point of DMPlexDistribute, it seems that the distributed DM does not have a section. The distributed section, also computed with PetscSFDistributeSection, is set to the distributed DM later in DMPlexCreateGlobalToNaturalSF: line 134 in plexnatural.c. DMCreateLocalSection_Plex is then called by DMGetLocalSection (line 121 in plexnatural.c) which raises the error. Wouldn't it be more convenient to

  *   compute the distributed section in DMPlexDistribute before the call of DMPlexCreateGlobalToNaturalSF. On that subject, it means that the distributed section is never set to the distributed DM if useNatural = PETSC_FALSE? Where one distributes the section in DMPlexDistribute?
  *   in DMPlexCreateGlobalToNaturalSF, compute the remoteOffsets calling PetscSFCreateRemoteOffsets instead of PetscSFDistributeSection, and get the distributed section thanks to DMGetLocalSection on the distributed DM.

Thanks a lot for your help.
Best,
Alexis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20220815/6fe16768/attachment.html>


More information about the petsc-dev mailing list