From: Bruno Blais Date: Tue, 10 Jun 2025 16:15:43 +0000 (-0400) Subject: Indentation :) X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7bd7123a8bf26a592152b31d6ff415d251e7123;p=dealii.git Indentation :) --- diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h index 048bcdc9a1..e9f3720ca8 100644 --- a/include/deal.II/grid/grid_generator.h +++ b/include/deal.II/grid/grid_generator.h @@ -547,19 +547,20 @@ namespace GridGenerator const double skewness = 2.0, const bool colorize = false); - /** + /** * Generate a grid consisting of a channel with a cylinder where the length * and the height of the channel can be defined by the user. This generator is - * a generalized version of GridGenerator::channel_with_cylinder. It can be used - * for benchmarking Navier-Stokes solvers for various flows around a cylinder cases - * in 2D or 3D. The main limitation of this generator is that the diameter of the cylindre is - * fixed at one and that the dimensions of the channel must be an integer multiple of this diameter. - * Consequently, the length before the cylinder - * @length_pre, the length after the cylinder @length_post and the half height of the channel @half_height - * must be integer values. The geometry consists of a channel - * of size $[-L_{pre}, -H] \times [L_{post}, H] \times [0, W] $ (where the $z$ - * dimension is omitted in 2d) with a cylinder, parallel to the $z$ axis - * with diameter $1$, centered at $(0, 0, 0)$. The channel has three + * a generalized version of GridGenerator::channel_with_cylinder. It can be + * used for benchmarking Navier-Stokes solvers for various flows around a + * cylinder cases in 2D or 3D. The main limitation of this generator is that + * the diameter of the cylindre is fixed at one and that the dimensions of the + * channel must be an integer multiple of this diameter. Consequently, the + * length before the cylinder + * @length_pre, the length after the cylinder @length_post and the half height + * of the channel @half_height must be integer values. The geometry consists + * of a channel of size $[-L_{pre}, -H] \times [L_{post}, H] \times [0, W] $ + * (where the $z$ dimension is omitted in 2d) with a cylinder, parallel to the + * $z$ axis with diameter $1$, centered at $(0, 0, 0)$. The channel has three * distinct regions: *
    *
  1. If @p n_shells is greater than zero, then there are that many shells @@ -569,8 +570,8 @@ namespace GridGenerator *
  2. a bulk region consisting of Cartesian cells.
  3. *
* Here is an example of a grid (without additional global refinement) - * where the arguments were @length_pre=8, @length_post=16, @half_height=8 and the - * default arguments are used for the number of shells and skewness: + * where the arguments were @length_pre=8, @length_post=16, @half_height=8 and + * the default arguments are used for the number of shells and skewness: * * @image html custom_channel_with_cylinder.png * @@ -601,7 +602,8 @@ namespace GridGenerator * @param length_post The length of the channel from the cylinder (0) to the right side (x+) * * @param shell_region_radius Radius of the layer of shells around the cylinder. - * This value should be between larger than 0.5 (the radius of the cylinder) and smaller than 1 (the half-length of the box around the cylinder). + * This value should be between larger than 0.5 (the radius of the cylinder) + * and smaller than 1 (the half-length of the box around the cylinder). * * @param n_shells Number of shells to use in the shell layer. * @@ -616,23 +618,24 @@ namespace GridGenerator * The left boundary (at $x = -L_{pre}$) is assigned an id of $0$, the right * boundary (at $x = L_{post}$) is assigned an id of $1$; the boundary of * the obstacle in the middle (i.e., the circle in 2d or the cylinder - * walls in 3d) is assigned an id of $2$, the bottom wall (at $y=-H$) is assigned and id of $/$, the top wall (at $y=H$) - * is assigned an id of $4$. In 3D, the front wall ($z=0$) is assigned an id of $5$ and the back wall ($z=W$) is assigned - * an id of $6$. + * walls in 3d) is assigned an id of $2$, the bottom wall (at $y=-H$) is + * assigned and id of $/$, the top wall (at $y=H$) is assigned an id of $4$. + * In 3D, the front wall ($z=0$) is assigned an id of $5$ and the back wall + * ($z=W$) is assigned an id of $6$. */ template void custom_channel_with_cylinder(Triangulation &tria, - const unsigned int half_height, - const unsigned int length_pre, - const unsigned int length_post, - const double depth=1, - const unsigned int depth_division=1, - const double shell_region_radius = 0.75, - const unsigned int n_shells = 2, - const double skewness = 2.0, - const bool colorize = false); - + const unsigned int half_height, + const unsigned int length_pre, + const unsigned int length_post, + const double depth = 1, + const unsigned int depth_division = 1, + const double shell_region_radius = 0.75, + const unsigned int n_shells = 2, + const double skewness = 2.0, + const bool colorize = false); + /** * A general @p dim -dimensional cell (a segment if dim is 1, a quadrilateral * if @p dim is 2, or a hexahedron if @p dim is 3) immersed in a diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 9e81f59aa1..d91c74eb55 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -3831,38 +3831,39 @@ namespace GridGenerator template <> void - custom_channel_with_cylinder([[maybe_unused]] Triangulation<1> &tria, - [[maybe_unused]] const unsigned int half_height, - [[maybe_unused]] const unsigned int length_pre, - [[maybe_unused]] const unsigned int length_post, - [[maybe_unused]] const double depth, - [[maybe_unused]] unsigned int depth_division, - [[maybe_unused]] const double shell_region_radius, - [[maybe_unused]] const unsigned int n_shells, - [[maybe_unused]] const double skewness, - [[maybe_unused]] const bool colorize) + custom_channel_with_cylinder( + [[maybe_unused]] Triangulation<1> &tria, + [[maybe_unused]] const unsigned int half_height, + [[maybe_unused]] const unsigned int length_pre, + [[maybe_unused]] const unsigned int length_post, + [[maybe_unused]] const double depth, + [[maybe_unused]] unsigned int depth_division, + [[maybe_unused]] const double shell_region_radius, + [[maybe_unused]] const unsigned int n_shells, + [[maybe_unused]] const double skewness, + [[maybe_unused]] const bool colorize) { DEAL_II_NOT_IMPLEMENTED(); } template <> void - custom_channel_with_cylinder(Triangulation<2> &tria, - const unsigned int half_height, - const unsigned int length_pre, - const unsigned int length_post, - [[maybe_unused]] const double depth, - [[maybe_unused]] unsigned int depth_division, - const double shell_region_radius, - const unsigned int n_shells, - const double skewness, - const bool colorize) + custom_channel_with_cylinder(Triangulation<2> &tria, + const unsigned int half_height, + const unsigned int length_pre, + const unsigned int length_post, + [[maybe_unused]] const double depth, + [[maybe_unused]] unsigned int depth_division, + const double shell_region_radius, + const unsigned int n_shells, + const double skewness, + const bool colorize) { - const types::manifold_id polar_manifold_id = 0; + const types::manifold_id polar_manifold_id = 0; const types::manifold_id tfi_manifold_id = 1; // The radius of the cylinder is 0.5, so the diameter is 1. - const double radius = 0.5; + const double radius = 0.5; const double box_radius = 1; // We assume that the cylinder is centered at (0,0) and has a diameter of 1. @@ -3870,16 +3871,17 @@ namespace GridGenerator // The number of repetitions is chosen to ensure that the cylinder // occupies four cells. - const unsigned int length_repetitions =length_pre+length_post; - const unsigned int height_repetitions =2*half_height; + const unsigned int length_repetitions = length_pre + length_post; + const unsigned int height_repetitions = 2 * half_height; - // We begin by setting up a grid that is length_repetition by height_repetitions cells. - // These cells are all square + // We begin by setting up a grid that is length_repetition by + // height_repetitions cells. These cells are all square Triangulation<2> bulk_tria; - GridGenerator::subdivided_hyper_rectangle(bulk_tria, - {(length_repetitions), height_repetitions}, - Point<2>(-double(length_pre), -double(half_height)), - Point<2>(double(length_post), double(half_height))); + GridGenerator::subdivided_hyper_rectangle( + bulk_tria, + {(length_repetitions), height_repetitions}, + Point<2>(-double(length_pre), -double(half_height)), + Point<2>(double(length_post), double(half_height))); // bulk_tria now looks like this: // @@ -3894,12 +3896,13 @@ namespace GridGenerator // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ // // The next step is to remove the cells marked with XXs: we will place - // the grid around the cylinder there later. The following loop determines which cells need to be removed from the Triangulation + // the grid around the cylinder there later. The following loop determines + // which cells need to be removed from the Triangulation // (i.e., find the cells marked with XX in the picture). std::set::active_cell_iterator> cells_to_remove; for (const auto &cell : bulk_tria.active_cell_iterators()) { - if ((cell->center() - Point<2>(0., 0.)).norm() < 1.1*box_radius) + if ((cell->center() - Point<2>(0., 0.)).norm() < 1.1 * box_radius) cells_to_remove.insert(cell); } @@ -3924,8 +3927,9 @@ namespace GridGenerator cell->face(face_n)->set_manifold_id(tfi_manifold_id); } - // The shell region should have a radius that is larger than the radius of the cylinder - if (radius < shell_region_radius ) + // The shell region should have a radius that is larger than the radius of + // the cylinder + if (radius < shell_region_radius) { Assert(0 < n_shells, ExcMessage("If the shell region has positive width then " @@ -3934,7 +3938,7 @@ namespace GridGenerator GridGenerator::concentric_hyper_shells(shell_tria, Point<2>(), radius, - shell_region_radius, + shell_region_radius, n_shells, skewness, 8); @@ -4010,27 +4014,27 @@ namespace GridGenerator template <> void custom_channel_with_cylinder(Triangulation<3> &tria, - const unsigned int half_height, - const unsigned int length_pre, - const unsigned int length_post, - const double depth, - unsigned int depth_division, - const double shell_region_radius, - const unsigned int n_shells, - const double skewness, - const bool colorize) { - + const unsigned int half_height, + const unsigned int length_pre, + const unsigned int length_post, + const double depth, + unsigned int depth_division, + const double shell_region_radius, + const unsigned int n_shells, + const double skewness, + const bool colorize) + { Triangulation<2> tria_2; custom_channel_with_cylinder(tria_2, - half_height, - length_pre, - length_post, - depth, - depth_division, - shell_region_radius, - n_shells, - skewness, - colorize); + half_height, + length_pre, + length_post, + depth, + depth_division, + shell_region_radius, + n_shells, + skewness, + colorize); // extrude to 3d extrude_triangulation(tria_2, depth_division, depth, tria, true); diff --git a/source/grid/grid_generator_from_name.cc b/source/grid/grid_generator_from_name.cc index 859aaee9b7..dcbffcff36 100644 --- a/source/grid/grid_generator_from_name.cc +++ b/source/grid/grid_generator_from_name.cc @@ -120,8 +120,17 @@ namespace GridGenerator parse_and_create( channel_with_cylinder, arguments, tria); else if (name == "custom_channel_with_cylinder") - parse_and_create( - custom_channel_with_cylinder, arguments, tria); + parse_and_create(custom_channel_with_cylinder, arguments, tria); else if (name == "enclosed_hyper_cube") parse_and_create( enclosed_hyper_cube, arguments, tria); diff --git a/tests/grid/grid_generator_custom_channel_with_cylinder.cc b/tests/grid/grid_generator_custom_channel_with_cylinder.cc index 46ea527a8f..d2ad0f266d 100644 --- a/tests/grid/grid_generator_custom_channel_with_cylinder.cc +++ b/tests/grid/grid_generator_custom_channel_with_cylinder.cc @@ -30,7 +30,8 @@ dim_2(std::ostream &os) const unsigned int d = 2; Triangulation tr; - GridGenerator::custom_channel_with_cylinder(tr, 4,3,5,1,2,0.75,4,2,true); + GridGenerator::custom_channel_with_cylinder( + tr, 4, 3, 5, 1, 2, 0.75, 4, 2, true); GridOut gout; gout.write_vtk(tr, os); @@ -41,7 +42,8 @@ dim_3(std::ostream &os) { const unsigned int d = 3; Triangulation tr; - GridGenerator::custom_channel_with_cylinder(tr, 4,3,5,1,2,0.75,4,2,true); + GridGenerator::custom_channel_with_cylinder( + tr, 4, 3, 5, 1, 2, 0.75, 4, 2, true); GridOut gout; gout.write_vtk(tr, os); }