Morpho-lang / morpho

The Morpho language 🦋. Morpho is a small embeddable language for scientific computing applications.
MIT License
33 stars 11 forks source link

Inconsistent elements in 3D mesh refinement #238

Open softmattertheory opened 1 year ago

softmattertheory commented 1 year ago

Describe the bug When refining a 3D mesh that has multiple grades present, elements in grades 1 and 2 may not be generated consistently.

To Reproduce Import the attached mesh using VTKImporter, use a MeshRefiner to globally refine. A number of elements are generated that are inconsistent. A paradigmatic example is volume element 4 in the original mesh; this is split into 8 tetrahedra. An example of an inconsistent element is facet 56 (attached to pt 6) in the refined mesh, which doesn't belong any tetrahedra in the body. Rather, the tetrahedra attached to 56 are connected differently, and there's a missing facet as a result.

initial.vtk.zip

Expected behavior Grade 2 elements should correspond to the facets of the tetrahedra generated.

Additional context A workaround exists, which is to delete and regenerate lower grade elements after refinement as below. Obviously, selections etc will also need to be regenerated:

mesh.removegrade(2)
mesh.removegrade(1)
mesh.addgrade(1)
mesh.addgrade(2)