geodynamics / pylith

PyLith is a finite element code for the solution of dynamic and quasi-static tectonic deformation problems.
Other
154 stars 98 forks source link

Bug when reading Gmsh with surfaces in different order than material id #496

Closed baagaard-usgs closed 2 years ago

baagaard-usgs commented 2 years ago

Describe the bug

When meshing a 2D domain, the label values for material-id are getting swapped. The physical group tag for surfaces 1 and 2 is 2 and the physical group tag for surface 3 is 1. However, in the DMPlex mesh surfaces 1 and 2 end up with material-id=1 and surface 3 ends up with material-id=2. If I switch the ordering of the surface creation, so that surface 1 has physical group tag 1 and surfaces 2 and 3 have physical group tag 2, the the label values are assigned correctly.

baagaard-usgs commented 2 years ago

@knepley I can't get the failure to show up when I stop after reading the mesh. I do get a PETSc error when I read the mesh and then try to reorder it. I temporarily modified the MeshIOPetsc libtest so that it tries to reorder the mesh after reading it. The data it is checking against is not reordered, so it won't pass the test, but it crashes before that. Once we figure out what the problem is, I should be able to design a better test.

Error message

[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Petsc has generated inconsistent data
[0]PETSC ERROR: Inconsistent strata hash map lookup
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.17.1-527-ge1a1509ab60  GIT Date: 2022-06-02 16:46:16 -0400
[0]PETSC ERROR: /Users/baagaard/scratch/build/clang-13.0/cig/pylith-debug/tests/libtests/meshio/.libs/test_meshio on a arch-clang-13.0_debug named IGSKCICGLTGM067 by baagaard Mon Jun 27 20:33:42 2022
[0]PETSC ERROR: Configure options --PETSC_ARCH=arch-clang-13.0_debug --with-debugging=1 --with-clanguage=c --with-mpi-compilers=1 --with-shared-libraries=1 --with-64-bit-points=1 --with-large-file-io=1 --with-lgrind=0 --download-chaco=1 --download-parmetis=1 --download-metis=1 --download-triangle --download-ml=1 --download-superlu=1 --with-fc=0 --download-f2cblaslapack=f2cblaslapack-3.4.2.q4.tar.gz --with-hdf5=1 --with-hdf5-include=/Users/baagaard/software/unix/hdf5-1.12.1/clang-13.0/include --with-hdf5-lib=/Users/baagaard/software/unix/hdf5-1.12.1/clang-13.0/lib/libhdf5.dylib --with-zlib=1
[0]PETSC ERROR: #1 DMLabelLookupStratum() at /Users/baagaard/software/unix/petsc-dev/src/dm/label/dmlabel.c:187
[0]PETSC ERROR: #2 DMLabelGetStratumSize() at /Users/baagaard/software/unix/petsc-dev/src/dm/label/dmlabel.c:1280
[0]PETSC ERROR: #3 DMPlexGetOrdering() at /Users/baagaard/software/unix/petsc-dev/src/dm/impls/plex/plexreorder.c:105
[0]PETSC ERROR: #4 static void pylith::topology::ReverseCuthillMcKee::reorder(topology::Mesh *)() at /Users/baagaard/src/cig/pylith/libsrc/pylith/topology/ReverseCuthillMcKee.cc:40

To reproduce

PETSc branch: knepley/pylith PyLith branch: baagaard/fix-gmsh-libtests

cd $BUILD_DIR/tests/libtests/meshio
make check
# test_meshio should fail
knepley commented 2 years ago

@baagaard-usgs I just pushed to knepley/pylith. The error is now gone (I was doing something illegal in reordering). Now the tests fail, but it is because the output does not match.

baagaard-usgs commented 2 years ago

@knepley Now I can't duplicate the error I was seeing with v3.0.1. I will do some additional checks. Perhaps this issue is resolved as a result of other fixes.

knepley commented 2 years ago

That is possible. They looked like knock-on errors.