]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tolerance to subdivided_cylinder generator 12697/head
authorBruno <blais.bruno@gmail.com>
Sun, 22 Aug 2021 19:16:47 +0000 (15:16 -0400)
committerBruno <blais.bruno@gmail.com>
Sun, 22 Aug 2021 19:16:47 +0000 (15:16 -0400)
source/grid/grid_generator.cc

index 592a28569cf472d14f91b77c9af09765e6f91e1f..2b6f26803221548e0e92af6220ae363f27623793 100644 (file)
@@ -5602,11 +5602,15 @@ namespace GridGenerator
     // above
     tria.set_all_manifold_ids_on_boundary(0);
 
+    // Tolerance is calculated using the minimal length defining
+    // the cylinder
+    const double tolerance = 1e-5 * std::min(radius, half_length);
+
     for (const auto &cell : tria.cell_iterators())
       for (unsigned int i : GeometryInfo<3>::face_indices())
         if (cell->at_boundary(i))
           {
-            if (cell->face(i)->center()(0) > half_length - 1.e-5)
+            if (cell->face(i)->center()(0) > half_length - tolerance)
               {
                 cell->face(i)->set_boundary_id(2);
                 cell->face(i)->set_manifold_id(numbers::flat_manifold_id);
@@ -5623,7 +5627,7 @@ namespace GridGenerator
                         numbers::flat_manifold_id);
                     }
               }
-            else if (cell->face(i)->center()(0) < -half_length + 1.e-5)
+            else if (cell->face(i)->center()(0) < -half_length + tolerance)
               {
                 cell->face(i)->set_boundary_id(1);
                 cell->face(i)->set_manifold_id(numbers::flat_manifold_id);

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.