From 281aaf3ecffa7f9b126ad61ea00ff6390c89205b Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 22 Aug 2021 15:16:47 -0400 Subject: [PATCH] Add tolerance to subdivided_cylinder generator --- source/grid/grid_generator.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 592a28569c..2b6f268032 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -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); -- 2.39.5