]> https://gitweb.dealii.org/ - dealii.git/commitdiff
examples/step-69: Fix mesh generation 11806/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 25 Feb 2021 02:15:29 +0000 (20:15 -0600)
committerMatthias Maier <tamiko@43-1.org>
Thu, 25 Feb 2021 02:16:14 +0000 (20:16 -0600)
It turns out that this piece of code only ever worked for a precise
ratio of height and disk ratio of 4. If this ratio was violated the
merge_triangulations() call would fail to properly glue the mesh
together due to unmatched vertices.

examples/step-69/step-69.cc

index 29b9deb1b5e4800e697030bcc81fd325487f44eb..db5cb11c42331bf36b5a4992550a283636537d4b 100644 (file)
@@ -592,7 +592,7 @@ namespace Step69
 
     triangulation.clear();
 
-    Triangulation<dim> tria1, tria2, tria3, tria4;
+    Triangulation<dim> tria1, tria2, tria3, tria4, tria5, tria6;
 
     GridGenerator::hyper_cube_with_cylindrical_hole(
       tria1, disk_diameter / 2., disk_diameter, 0.5, 1, false);
@@ -611,14 +611,27 @@ namespace Step69
 
     GridGenerator::subdivided_hyper_rectangle(
       tria4,
-      {6, 4},
-      Point<2>(disk_diameter, -height / 2.),
+      {6, 2},
+      Point<2>(disk_diameter, -disk_diameter),
+      Point<2>(length - disk_position, disk_diameter));
+
+    GridGenerator::subdivided_hyper_rectangle(
+      tria5,
+      {6, 1},
+      Point<2>(disk_diameter, disk_diameter),
       Point<2>(length - disk_position, height / 2.));
 
-    GridGenerator::merge_triangulations({&tria1, &tria2, &tria3, &tria4},
-                                        triangulation,
-                                        1.e-12,
-                                        true);
+    GridGenerator::subdivided_hyper_rectangle(
+      tria6,
+      {6, 1},
+      Point<2>(disk_diameter, -height / 2.),
+      Point<2>(length - disk_position, -disk_diameter));
+
+    GridGenerator::merge_triangulations(
+      {&tria1, &tria2, &tria3, &tria4, &tria5, &tria6},
+      triangulation,
+      1.e-12,
+      true);
 
     triangulation.set_manifold(0, PolarManifold<2>(Point<2>()));
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.