Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
GridUniformChannelWithMeshedCylinder< dim, spacedim > Class Template Reference

#include <grid_uniform_channel_with_meshed_cylinder.h>

Public Member Functions

 GridUniformChannelWithMeshedCylinder (const std::string &grid_arguments)
void make_grid (Triangulation< dim, spacedim > &triangulation)
void make_grid (Triangulation< 2, 2 > &triangulation)
void make_grid (Triangulation< 3, 3 > &triangulation)

Private Member Functions

void generate_2d_channel_mesh (Triangulation< 2 > &triangulation, const Point< 2 > &bottom_left, const Point< 2 > &top_right, const Point< 2 > &center, const double inner_radius, const double outer_radius, const unsigned int pad_bottom, const unsigned int pad_top, const unsigned int pad_left, const unsigned int pad_right, const bool colorize)

Private Attributes

Point< dim > bottom_left
Point< dim > top_right
Point< dim > center
double inner_radius
double outer_radius
unsigned int pad_bottom
unsigned int pad_top
unsigned int pad_left
unsigned int pad_right
double height
unsigned int n_slices
bool use_transfinite_region
bool mesh_obstacle
bool colorize

Detailed Description

template<int dim, int spacedim>
class GridUniformChannelWithMeshedCylinder< dim, spacedim >

Generates a rectangular channel mesh with a meshed cylinder obstacle. By default, this geometry defines two material IDs. The obstacle is assigned the material_id = 1 and the remaining domain is assigned material_id = 0. The obstacle can be optionally removed by setting mesh_obstacle to false, in which case the entire domain is assigned material_id = 0.

The mesh consists of three concentric regions around the cylinder:

  1. An inner balanced disk of radius inner_radius (hyper_ball_balanced).
  2. A transition shell between inner_radius and outer_radius, whose diagonal vertices are adjusted to form a square.
  3. Rectangular padding regions that fill the gap between the transition square and the channel boundary defined by bottom_left / top_right.

The number of subdivisions in each padding direction (bottom, top, left, right) can be controlled independently. In 3D, the 2D cross-section is extruded along the z-axis with a configurable height and number of slices. The slices refer to the number of layers in the z direction, so the total number of cells in the z direction will be n_slices - 1. It follows that the minimum number of slices is 2, which corresponds to a single layer of cells in the z direction. Note that it is always assumed that the channel bottom is at z=0 and the channel top is at z=height.

The manifold objects attached for proper mesh refinement are:

  • PolarManifold (2D) or CylindricalManifold (3D) on the inner cylinder boundary faces (manifold_id = 1).
  • TransfiniteInterpolationManifold on the remaining domain (manifold_id = 0).

Definition at line 44 of file grid_uniform_channel_with_meshed_cylinder.h.

Constructor & Destructor Documentation

◆ GridUniformChannelWithMeshedCylinder()

template<int dim, int spacedim>
GridUniformChannelWithMeshedCylinder< dim, spacedim >::GridUniformChannelWithMeshedCylinder ( const std::string & grid_arguments)

Constructor that parses geometry parameters from a colon-separated string.

Parameters
[in]grid_argumentsA colon-separated string with the following fields (coordinates are comma-separated):
# Field Format Required Description
0 bottom_left x,y yes Bottom-left corner of the channel before extrusion
1 top_right x,y yes Top-right corner of the channel before extrusion
2 center x,y yes Center of the cylinder
3 inner_radius double yes Radius of the cylinder
4 outer_radius double yes Radius of the transition region
5 pad_bottom int no N cells below the transition (default: 0)
6 pad_top int no N cells above the transition (default: 0)
7 pad_left int no N cells left of the transition (default: 0)
8 pad_right int no N cells right of the transition (default: 0)
9 height double no Extrusion height in z, 3D only (default: 1.0)
10 n_slices int no Number of z-layers, 3D only (default and min: 2)
11 use_transfinite_region true/false no Use transfinite interpolation (default: false)
12 mesh_obstacle true/false no Keep obstacle meshed (default: false)
13 colorize true/false no Assign distinct boundary IDs (default: false)

Example:

"0,0 : 10,2 : 5,1 : 0.1 : 0.3 : 2 : 2 : 5 : 5 : 2. : 2 :
true : true : true"

When colorize is true and mesh_obstacle is true, boundary IDs follow the subdivided_hyper_rectangle convention: 0 (-x), 1 (+x), 2 (-y), 3 (+y). In 3D, the extruded bottom (z=0) gets id 4 and top (z=height) gets id 5. When mesh_obstacle is false, boundary id 0 is used for the obstacle boundary, and the channel boundaries are 1 (-x), 2 (+x), 3 (-y), 4 (+y). In 3D, the extruded bottom (z=0) gets id 5 and top (z=height) gets id 6.

Definition at line 13 of file grid_uniform_channel_with_meshed_cylinder.cc.

References bottom_left, center, colorize, height, inner_radius, mesh_obstacle, n_slices, outer_radius, pad_bottom, pad_left, pad_right, pad_top, top_right, use_transfinite_region, and value_string_to_tensor().

Member Function Documentation

◆ generate_2d_channel_mesh()

template<int dim, int spacedim>
void GridUniformChannelWithMeshedCylinder< dim, spacedim >::generate_2d_channel_mesh ( Triangulation< 2 > & triangulation,
const Point< 2 > & bottom_left,
const Point< 2 > & top_right,
const Point< 2 > & center,
const double inner_radius,
const double outer_radius,
const unsigned int pad_bottom,
const unsigned int pad_top,
const unsigned int pad_left,
const unsigned int pad_right,
const bool colorize )
private

Generate the 2D channel mesh geometry with a meshed cylinder.

This private helper creates the composite 2D triangulation by merging:

  • A balanced disk of radius inner_radius (the cylinder cross-section).
  • A hyper_shell transition region with squared diagonal vertices between inner_radius and outer_radius.
  • Up to 8 rectangular padding sub-meshes filling the gap between the transition square and the channel boundary.

Manifold integer IDs are assigned (0 = TFI, 1 = polar) but no manifold objects are attached — the caller must do that after this function returns.

If colorize is true, boundary IDs are set following the subdivided_hyper_rectangle convention: 0 (-x), 1 (+x), 2 (-y), 3 (+y). When mesh_obstacle is false, boundary id 0 is used for the obstacle boundary and the channel boundaries are 1 (-x), 2 (+x), 3 (-y), 4 (+y).

Parameters
[out]triangulationThe triangulation to fill.
[in]bottom_leftBottom-left corner of the channel.
[in]top_rightTop-right corner of the channel.
[in]centerCenter of the cylinder.
[in]inner_radiusRadius of the inner cylinder.
[in]outer_radiusRadius of the transition region.
[in]pad_bottomNumber of subdivisions in the bottom padding.
[in]pad_topNumber of subdivisions in the top padding.
[in]pad_leftNumber of subdivisions in the left padding.
[in]pad_rightNumber of subdivisions in the right padding.
[in]colorizeWhether to assign distinct boundary IDs.

Definition at line 153 of file grid_uniform_channel_with_meshed_cylinder.cc.

References bottom_left, center, colorize, inner_radius, mesh_obstacle, outer_radius, pad_bottom, pad_left, pad_right, pad_top, top_right, and use_transfinite_region.

◆ make_grid() [1/3]

void GridUniformChannelWithMeshedCylinder< 2, 2 >::make_grid ( Triangulation< 2, 2 > & triangulation)

◆ make_grid() [2/3]

◆ make_grid() [3/3]

template<int dim, int spacedim>
void GridUniformChannelWithMeshedCylinder< dim, spacedim >::make_grid ( Triangulation< dim, spacedim > & triangulation)

Generate the 2D or 3D channel mesh with a meshed cylinder and attach manifold objects for proper mesh refinement.

For 2D: Delegates geometry construction to generate_2d_channel_mesh(), then attaches:

  • PolarManifold on the inner-cylinder boundary faces (manifold_id = 1).
  • TransfiniteInterpolationManifold on the remaining domain (manifold_id = 0). The boundary IDs are assigned following the subdivided_hyper_rectangle convention when colorize is enabled: 0 (-x), 1 (+x), 2 (-y), 3 (+y). When mesh_obstacle is false, boundary id 0 is used for the obstacle boundary and the channel boundaries are 1 (-x), 2 (+x), 3 (-y), 4 (+y).

For 3D: Delegates geometry construction to generate_2d_channel_mesh(), then extrudes the mesh along the z-axis and attaches:

  • CylindricalManifold on the cylinder surface (manifold_id = 1).
  • TransfiniteInterpolationManifold on the remaining domain (manifold_id = 0). The lateral boundary IDs are inherited from the 2D mesh when colorize is enabled. When mesh_obstacle is true, the extruded bottom (z = 0) gets boundary_id = 4 and the top (z = height) gets boundary_id = 5. When mesh_obstacle is false, the extruded bottom (z = 0) gets boundary_id = 5 and the top (z = height) gets boundary_id = 6.
Parameters
[out]triangulationThe triangulation to fill with the channel mesh.

Definition at line 490 of file grid_uniform_channel_with_meshed_cylinder.cc.

Member Data Documentation

◆ bottom_left

template<int dim, int spacedim>
Point<dim> GridUniformChannelWithMeshedCylinder< dim, spacedim >::bottom_left
private

Point that define the bottom-left of the channel in the xy-plane.

Definition at line 156 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ center

template<int dim, int spacedim>
Point<dim> GridUniformChannelWithMeshedCylinder< dim, spacedim >::center
private

Point that define the center of the cylinder in the xy-plane.

Definition at line 160 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ colorize

template<int dim, int spacedim>
bool GridUniformChannelWithMeshedCylinder< dim, spacedim >::colorize
private

Whether to assign distinct boundary IDs to the channel boundaries following the subdivided_hyper_rectangle convention.

Definition at line 190 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ height

template<int dim, int spacedim>
double GridUniformChannelWithMeshedCylinder< dim, spacedim >::height
private

Extrusion height in the z direction, 3D only.

Definition at line 178 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ inner_radius

template<int dim, int spacedim>
double GridUniformChannelWithMeshedCylinder< dim, spacedim >::inner_radius
private

Radius of the cylinder.

Definition at line 162 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ mesh_obstacle

template<int dim, int spacedim>
bool GridUniformChannelWithMeshedCylinder< dim, spacedim >::mesh_obstacle
private

Whether to keep the obstacle mesh (false removes the cylinder cells from the cylinder).

Definition at line 187 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ n_slices

template<int dim, int spacedim>
unsigned int GridUniformChannelWithMeshedCylinder< dim, spacedim >::n_slices
private

Number of layers in the z direction, 3D only. Minimum is 2, which corresponds to a single layer of cells in the z direction.

Definition at line 181 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ outer_radius

template<int dim, int spacedim>
double GridUniformChannelWithMeshedCylinder< dim, spacedim >::outer_radius
private

Radius of the transition region between the cylinder and the channel.

Definition at line 164 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ pad_bottom

template<int dim, int spacedim>
unsigned int GridUniformChannelWithMeshedCylinder< dim, spacedim >::pad_bottom
private

Number of additional cells to be added to pad the channel from center - inner_radius - outer_radius to the channel bottom boundary (-y direction).

Definition at line 167 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ pad_left

template<int dim, int spacedim>
unsigned int GridUniformChannelWithMeshedCylinder< dim, spacedim >::pad_left
private

Number of additional cells to be added to pad the channel from center - inner_radius - outer_radius to the channel left boundary (-x direction).

Definition at line 173 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ pad_right

template<int dim, int spacedim>
unsigned int GridUniformChannelWithMeshedCylinder< dim, spacedim >::pad_right
private

Number of additional cells to be added to pad the channel from center + inner_radius + outer_radius to the channel right boundary (+x direction).

Definition at line 176 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ pad_top

template<int dim, int spacedim>
unsigned int GridUniformChannelWithMeshedCylinder< dim, spacedim >::pad_top
private

Number of additional cells to be added to pad the channel from center + inner_radius + outer_radius to the channel top boundary (+y direction).

Definition at line 170 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ top_right

template<int dim, int spacedim>
Point<dim> GridUniformChannelWithMeshedCylinder< dim, spacedim >::top_right
private

Point that define the top-right of the channel in the xy-plane.

Definition at line 158 of file grid_uniform_channel_with_meshed_cylinder.h.

◆ use_transfinite_region

template<int dim, int spacedim>
bool GridUniformChannelWithMeshedCylinder< dim, spacedim >::use_transfinite_region
private

Whether to use transfinite interpolation for the transition region between the cylinder and the channel.

Definition at line 184 of file grid_uniform_channel_with_meshed_cylinder.h.


The documentation for this class was generated from the following files: