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:
* <ol>
* <li>If @p n_shells is greater than zero, then there are that many shells
* <li>a bulk region consisting of Cartesian cells.</li>
* </ol>
* 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
*
* @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.
*
* 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 <int dim>
void
custom_channel_with_cylinder(Triangulation<dim> &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
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.
// 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:
//
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
//
// 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<Triangulation<2>::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);
}
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 "
GridGenerator::concentric_hyper_shells(shell_tria,
Point<2>(),
radius,
- shell_region_radius,
+ shell_region_radius,
n_shells,
skewness,
8);
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);
parse_and_create<dim, dim, double, unsigned int, double, bool>(
channel_with_cylinder, arguments, tria);
else if (name == "custom_channel_with_cylinder")
- parse_and_create<dim, dim, unsigned int, unsigned int, unsigned int, double, unsigned int, double, unsigned int, double, bool>(
- custom_channel_with_cylinder, arguments, tria);
+ parse_and_create<dim,
+ dim,
+ unsigned int,
+ unsigned int,
+ unsigned int,
+ double,
+ unsigned int,
+ double,
+ unsigned int,
+ double,
+ bool>(custom_channel_with_cylinder, arguments, tria);
else if (name == "enclosed_hyper_cube")
parse_and_create<dim, dim, double, double, double, bool>(
enclosed_hyper_cube, arguments, tria);
const unsigned int d = 2;
Triangulation<d> 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);
{
const unsigned int d = 3;
Triangulation<d> 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);
}