![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <grid_uniform_channel_with_meshed_square_prism.h>
Public Member Functions | |
| GridUniformChannelWithMeshedSquarePrism (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_half_side, const double outer_half_side, const double inner_rotation_angle, 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_half_side |
| double | outer_half_side |
| double | inner_rotation_angle |
| unsigned int | pad_bottom |
| unsigned int | pad_top |
| unsigned int | pad_left |
| unsigned int | pad_right |
| double | height |
| unsigned int | n_slices |
| bool | mesh_obstacle |
| bool | colorize |
Generates a rectangular channel mesh with a meshed square obstacle in 2D (extruded to a square prism in 3D). 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 mesh consists of three nested regions around the obstacle center:
inner_half_side (material_id = 1).inner_half_side and outer_half_side.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.
Definition at line 40 of file grid_uniform_channel_with_meshed_square_prism.h.
| GridUniformChannelWithMeshedSquarePrism< dim, spacedim >::GridUniformChannelWithMeshedSquarePrism | ( | 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 square obstacle |
| 3 | inner_half_side | double | yes | Half-side of the inner square obstacle |
| 4 | outer_half_side | double | yes | Half-side of the outer transition square |
| 5 | rotation_deg | double | no | In-plane rotation (degrees) applied to the inner region (default: 0) |
| 6 | pad_bottom | int | no | N cells below the transition (default: 0) |
| 7 | pad_top | int | no | N cells above the transition (default: 0) |
| 8 | pad_left | int | no | N cells left of the transition (default: 0) |
| 9 | pad_right | int | no | N cells right of the transition (default: 0) |
| 10 | height | double | no | Extrusion height in z, 3D only (default: 1.0) |
| 11 | n_slices | int | no | Number of z-layers, 3D only (default and min: 2) |
| 12 | mesh_obstacle | true/false | no | Whether to mesh the inner square obstacle (default: false) |
| 13 | colorize | true/false | no | Assign distinct boundary IDs (default: false) |
Example:
When colorize 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.
Definition at line 19 of file grid_uniform_channel_with_meshed_square_prism.cc.
References bottom_left, center, colorize, height, inner_half_side, inner_rotation_angle, mesh_obstacle, n_slices, outer_half_side, pad_bottom, pad_left, pad_right, pad_top, top_right, and value_string_to_tensor().
|
private |
Generate the 2D channel mesh geometry with a meshed square obstacle.
This private helper creates the composite 2D triangulation by merging:
inner_half_side and the outer vertices are placed to form the outer square of half-side outer_half_side. When rotated, the inner vertices are rotated by inner_rotation_angle while only half of the outer vertices are rotated and projected to the closest point on the outer square. The other half are attached to the outer square corners. The choice of which outer vertices are rotated and which are attached to the corners is made on a closest-angle basis to minimize the distortion of the transition cells.Material IDs are assigned as follows: 1 for the inner obstacle and 0 for the rest of the channel.
If colorize is true, boundary IDs are set following the subdivided_hyper_rectangle convention: 0 (-x), 1 (+x), 2 (-y), 3 (+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 square obstacle. |
| [in] | inner_half_side | Half-side of the inner square obstacle. |
| [in] | outer_half_side | Half-side of the outer transition square. |
| [in] | inner_rotation_angle | In-plane rotation angle in degrees. |
| [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] | mesh_obstacle | Whether to mesh the inner square obstacle or leave it as a hole. |
| [in] | colorize | Whether to assign distinct boundary IDs. |
Definition at line 175 of file grid_uniform_channel_with_meshed_square_prism.cc.
References bottom_left, center, colorize, inner_half_side, inner_rotation_angle, mesh_obstacle, outer_half_side, pad_bottom, pad_left, pad_right, pad_top, and top_right.
| void GridUniformChannelWithMeshedSquarePrism< 2, 2 >::make_grid | ( | Triangulation< 2, 2 > & | triangulation | ) |
Definition at line 594 of file grid_uniform_channel_with_meshed_square_prism.cc.
References bottom_left, center, colorize, generate_2d_channel_mesh(), inner_half_side, inner_rotation_angle, outer_half_side, pad_bottom, pad_left, pad_right, pad_top, and top_right.
| void GridUniformChannelWithMeshedSquarePrism< 3, 3 >::make_grid | ( | Triangulation< 3, 3 > & | triangulation | ) |
Definition at line 618 of file grid_uniform_channel_with_meshed_square_prism.cc.
References bottom_left, center, colorize, generate_2d_channel_mesh(), height, inner_half_side, inner_rotation_angle, mesh_obstacle, n_slices, outer_half_side, pad_bottom, pad_left, pad_right, pad_top, and top_right.
| void GridUniformChannelWithMeshedSquarePrism< dim, spacedim >::make_grid | ( | Triangulation< dim, spacedim > & | triangulation | ) |
Generate the 2D/3D channel mesh with a meshed square obstacle.
For 2D: Delegates geometry construction to generate_2d_channel_mesh(). The boundary IDs are assigned following the subdivided_hyper_rectangle convention when colorize is enabled: 0 (-x), 1 (+x), 2 (-y), 3 (+y).
For 3D: Delegates geometry construction to generate_2d_channel_mesh(), then extrudes the mesh along the z-axis and attaches the new boundary IDs. The lateral boundary IDs are inherited from the 2D mesh when colorize is enabled. The extruded bottom (z = 0) gets boundary_id = 4 and the top (z = height) gets boundary_id = 5.
| [out] | triangulation | The triangulation to fill with the channel mesh. |
Definition at line 672 of file grid_uniform_channel_with_meshed_square_prism.cc.
|
private |
Point that define the bottom-left of the channel in the xy-plane.
Definition at line 149 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Point that define the center of the obstacle in the xy-plane.
Definition at line 153 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Whether to assign distinct boundary IDs to the channel boundaries following the subdivided_hyper_rectangle convention.
Definition at line 185 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Extrusion height in the z direction, 3D only.
Definition at line 177 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Half-side of the inner square obstacle.
Definition at line 155 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
In-plane rotation angle in radians applied to the inner mesh pattern.
Definition at line 159 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Whether to mesh the inner square obstacle or leave it as a hole.
Definition at line 182 of file grid_uniform_channel_with_meshed_square_prism.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 180 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Half-side of the outer transition square.
Definition at line 157 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Number of additional cells to be added to pad the channel from center - inner_half_side - outer_half_side to the channel bottom boundary (-y direction).
Definition at line 163 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Number of additional cells to be added to pad the channel from center - inner_half_side - outer_half_side to the channel left boundary (-x direction).
Definition at line 171 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Number of additional cells to be added to pad the channel from center + inner_half_side + outer_half_side to the channel right boundary (+x direction).
Definition at line 175 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Number of additional cells to be added to pad the channel from center + inner_half_side + outer_half_side to the channel top boundary (+y direction).
Definition at line 167 of file grid_uniform_channel_with_meshed_square_prism.h.
|
private |
Point that define the top-right of the channel in the xy-plane.
Definition at line 151 of file grid_uniform_channel_with_meshed_square_prism.h.