craffael / lehrfempp

Simple Finite Element Framework for research and education
MIT License
28 stars 17 forks source link

MeshHierarchy: Triangle is sometimes refined strangely #193

Closed craffael closed 3 years ago

craffael commented 3 years ago

While I was working on the hp-fem example, I noticed that MeshHierarchy refines triangles in an unexpected way when all three edges are marked for refinement.

E.g. this triangle grafik

is refined to

grafik

Interestingly this only happens when we do local refinement. If we refine the mesh globally, we get the expected refinement for this triangle:

grafik

To reproduce the problem, just run the example in examples/fe/hp_fem_L_shape (currently only available in branch convergencestudies) and check the generated vtk files.

hiptmair commented 3 years ago

The "strange" refinemen pattern probably arises from a 2-stage longest edge bisection in response to hanging nodes. Since the algorithm never reverts local refinements, this is inevitable. It also complies with the specification of longest-edge bisection.

craffael commented 3 years ago

I see.

Just for your information: after a few refinement steps one ends up with quite ill-conditioned triangles:

grafik

hiptmair commented 3 years ago

Which example/test code generates this sequence of meshes. I will take a look and try to understand how such bad triangles can emerge.

craffael commented 3 years ago

It's the file examples/fe/hp_fem_L_shape/main.cc. Tip: if paraview crashes or shows wiggly mesh lines, set the degree of the vtk output to 1 on line 133 of main.cc

hiptmair commented 3 years ago

I have found the problem. An exotic case of bisection refinement (rp_quadsetc) is triggered when all three edges of a triangle are marked.

hiptmair commented 3 years ago

Corrected the local refinemen algorithm in mesh_hierarchy.cc. Created a pull request.