Assertion with mixed-dimension refinement
While trying to adaptively refine a mixed-dimension mesh, I hit the following assert in find_neighbors()
Stack frames: 8
0: libMesh::print_trace(std::ostream&)
1: libMesh::MacroFunctions::report_error(char const*, int, char const*, char const*)
2: libMesh::UnstructuredMesh::find_neighbors(bool, bool)
3: libMesh::MeshBase::prepare_for_use()
4: libMesh::MeshRefinement::refine_elements()
5: main
6: __libc_start_main
7: ./test_mixed_dimension_refinement-dbg(+0xe52a) [0x55f51ee4b52a]
[0] ../src/mesh/unstructured_mesh.C, line 865, compiled Aug 10 2022 at 15:15:18
The check on that line is related to setting the interior parents of refined elements:
// We should have found *some* interior_parent at this
// point, whether semilocal or remote.
libmesh_assert(current_elem->interior_parent());
I wrote a small test code which reproduces the error (note that you have to compile and run in debug mode to see the error since it's an assert). For some background on the test, we start with build_square() and then create an Edge3 element whose vertices match the vertices of one of the Quad4 elements. Then during prepare_for_use(), this Edge3 is identified as having an interior_parent() corresponding to one of the neighboring Quads. Then we flag the 1D element for refinement and the error is triggered while finding neighbors on the refined mesh.