![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#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 > ¢er, 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 |
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:
inner_radius (hyper_ball_balanced).inner_radius and outer_radius, whose diagonal vertices are adjusted to form a square.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:
Definition at line 44 of file grid_uniform_channel_with_meshed_cylinder.h.
| GridUniformChannelWithMeshedCylinder< dim, spacedim >::GridUniformChannelWithMeshedCylinder | ( | const std::string & | grid_arguments | ) |
Constructor that parses geometry parameters from a colon-separated string.
| [in] | grid_arguments | A 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:
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().
|
private |
Generate the 2D channel mesh geometry with a meshed cylinder.
This private helper creates the composite 2D triangulation by merging:
inner_radius (the cylinder cross-section).inner_radius and outer_radius.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).
| [out] | triangulation | The triangulation to fill. |
| [in] | bottom_left | Bottom-left corner of the channel. |
| [in] | top_right | Top-right corner of the channel. |
| [in] | center | Center of the cylinder. |
| [in] | inner_radius | Radius of the inner cylinder. |
| [in] | outer_radius | Radius of the transition region. |
| [in] | pad_bottom | Number of subdivisions in the bottom padding. |
| [in] | pad_top | Number of subdivisions in the top padding. |
| [in] | pad_left | Number of subdivisions in the left padding. |
| [in] | pad_right | Number of subdivisions in the right padding. |
| [in] | colorize | Whether 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.
| void GridUniformChannelWithMeshedCylinder< 2, 2 >::make_grid | ( | Triangulation< 2, 2 > & | triangulation | ) |
Definition at line 411 of file grid_uniform_channel_with_meshed_cylinder.cc.
References bottom_left, center, colorize, generate_2d_channel_mesh(), inner_radius, outer_radius, pad_bottom, pad_left, pad_right, pad_top, and top_right.
| void GridUniformChannelWithMeshedCylinder< 3, 3 >::make_grid | ( | Triangulation< 3, 3 > & | triangulation | ) |
Definition at line 430 of file grid_uniform_channel_with_meshed_cylinder.cc.
References bottom_left, center, colorize, generate_2d_channel_mesh(), height, inner_radius, mesh_obstacle, n_slices, outer_radius, pad_bottom, pad_left, pad_right, pad_top, top_right, and use_transfinite_region.
| 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:
For 3D: Delegates geometry construction to generate_2d_channel_mesh(), then extrudes the mesh along the z-axis and attaches:
| [out] | triangulation | The triangulation to fill with the channel mesh. |
Definition at line 490 of file grid_uniform_channel_with_meshed_cylinder.cc.
|
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.
|
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.
|
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.
|
private |
Extrusion height in the z direction, 3D only.
Definition at line 178 of file grid_uniform_channel_with_meshed_cylinder.h.
|
private |
Radius of the cylinder.
Definition at line 162 of file grid_uniform_channel_with_meshed_cylinder.h.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.