Mesh#

Mesh2D is the class which provides most of functionality. It is not intended to be instantiated manually, but rather created by calling create_elliptical_mesh(). It provides very low-level access to the mesh geometry, as it is intended to be as fast as possible to use.

class rmsh.Mesh2D[source]#

Class which contains the mesh information.

It should not be created from its constructor, since it interfaces with the internal C extension.

block_boundary_lines(block_id: int, boundary_id: int, /) npt.NDArray[np.int32]#

Return indices of all lines on a boundary of a block.

Indices start at 1 and a negative value indicates a reversed orientation of the line.

Parameters:
  • block_id (int) – The index of the block for which the line indices should be returned.

  • boundary (BoundaryId) – The ID of a boundary from which the line indices should be returned.

Returns:

Array with indices of all lines on a boundary of a block block_id.

Return type:

ndarray[int32]

block_boundary_points(block_id: int, boundary: BoundaryId) npt.NDArray[np.int32]#

Return indices of all nodes on a boundary of a block.

Parameters:
  • block_id (int) – The index of the block for which the point indices should be returned.

  • boundary (BoundaryId) – The ID of a boundary from which the point indices should be returned.

Returns:

Array with indices of all points on a boundary of a block block_id.

Return type:

ndarray[int32]

block_boundary_surfaces(block_id: str, boundary: BoundaryId) npt.NDArray[np.int32]#

Return indices of all surfaces on a boundary of a block.

Indices start at 1 and a negative value indicates a reversed orientation of the surface, though for this function this is not needed.

Parameters:
  • block_id (str) – The label of the block for which the surfaces indices should be returned.

  • boundary (BoundaryId) – The ID of a boundary from which the surfaces indices should be returned.

Returns:

Array with indices of all surfaces on a boundary of a block block_id.

Return type:

ndarray[int32]

block_label_boundary_lines(block_id: str, boundary: BoundaryId) ndarray[tuple[int, ...], dtype[int32]][source]#

Return indices of all lines on a boundary of a block.

Indices start at 1 and a negative value indicates a reversed orientation of the line.

Parameters:
  • block_id (str) – The label of the block for which the line indices should be returned.

  • boundary (BoundaryId) – The ID of a boundary from which the line indices should be returned.

Returns:

Array with indices of all lines on a boundary of a block block_id.

Return type:

ndarray[int32]

block_label_boundary_points(block_id: str, boundary: BoundaryId) ndarray[tuple[int, ...], dtype[int32]][source]#

Return indices of all nodes on a boundary of a block.

Parameters:
  • block_id (str) – The label of the block for which the point indices should be returned.

  • boundary (BoundaryId) – The ID of a boundary from which the point indices should be returned.

Returns:

Array with indices of all points on a boundary of a block block_id.

Return type:

ndarray[int32]

block_label_lines(block_id: str) ndarray[tuple[int, ...], dtype[int32]][source]#

Return indices of all lines within a block.

Indices start at 1 and a negative value indicates a reversed orientation of the line.

Parameters:

block_id (str) – The label of the block for which the line indices should be returned.

Returns:

Array with indices of all lines within the mesh block specified by block_id.

Return type:

ndarray[int32]

block_lines(idx: int, /) npt.NDArray[np.int32]#

Return indices of all lines within a block.

Indices start at 1 and a negative value indicates a reversed orientation of the line.

Parameters:

block_id (int) – The index of the block for which the line indices should be returned.

Returns:

Array with indices of all lines within the mesh block specified by block_id.

Return type:

ndarray[int32]

surface_element(surf, order) npt.NDArray[np.int32]#

Return indices of surfaces, which form a square element of width (2*order+1).

This is intended to be used for computing cell-based interpolations.

Parameters:
  • surf (int) – The one-based index of the surface which should be the center of the element.

  • order (int) – Size of the element in each direction away from the center (zero means only the element, one means 3 x 3, etc.)

Returns:

Array with indices of all surfaces in the element. Note that since one-based indexing is used, a zero indicates a missing surface caused by a numerical boundary. Negative indices mean a negative orientation.

Return type:

ndarray[int32]

surface_element_points(surf: int, order: int) npt.NDArray[np.int32]#

Return indices of points, which form a square element of width (2*order+1).

This is intended to be used for computing nodal-based interpolations for surface elements.

Parameters:
  • surf (int) – The one-based index of the surface which should be the center of the element.

  • order (int) – Size of the element in each direction away from the center (zero means only the element, one means 3 x 3, etc.)

Returns:

Array with indices of all indices in the element. Note that since one-based indexing is used, a value of -1 indicates a missing point caused by a numerical boundary.

Return type:

ndarray[int32]

property block_names: list[str]#

Label strings of each block within the mesh.

These are the only ones which are valid when referring to a block in the mesh.

lines#

line indices

Has a shape (N, 2), where N is the number of lines in the mesh.

Type:

NDArray[np.int32]

pos_x#

X coordinates of nodes

Type:

NDArray[np.double]

pos_y#

Y coordinates of nodes

Type:

NDArray[np.double]

surfaces#

surface indices

Has a shape (N, 4), where N is the number of surfaces in the mesh. Indices start at 1 instead of 0 and a negative value of the index means that a line should be in opposite orientation to how it is in the lines array to maintain a consistent surface orientation.

Type:

NDArray[np.int32]