cashocs.geometry.mesh.regular_box_mesh#

cashocs.geometry.mesh.regular_box_mesh(n: int = 10, start_x: float = 0.0, start_y: float = 0.0, start_z: float | None = None, end_x: float = 1.0, end_y: float = 1.0, end_z: float | None = None, diagonal: Literal['right', 'left', 'left/right', 'right/left', 'crossed'] = 'right', comm: MPI.Comm | None = None) _typing.MeshTuple[source]#

Creates a mesh corresponding to a rectangle or cube.

This function creates a uniform mesh of either a rectangle or a cube, with specified start (S_) and end points (E_). The resulting mesh uses n elements along the shortest direction and accordingly many along the longer ones. The resulting domain is

\[\begin{split}\begin{alignedat}{2} &[start_x, end_x] \times [start_y, end_y] \quad &&\text{ in } 2D, \\ &[start_x, end_x] \times [start_y, end_y] \times [start_z, end_z] \quad &&\text{ in } 3D. \end{alignedat}\end{split}\]

The boundary markers are ordered as follows:

  • 1 corresponds to \(x=start_x\).

  • 2 corresponds to \(x=end_x\).

  • 3 corresponds to \(y=start_y\).

  • 4 corresponds to \(y=end_y\).

  • 5 corresponds to \(z=start_z\) (only in 3D).

  • 6 corresponds to \(z=end_z\) (only in 3D).

Parameters:
  • n (int) – Number of elements in the shortest coordinate direction.

  • start_x (float) – Start of the x-interval.

  • start_y (float) – Start of the y-interval.

  • start_z (float | None) – Start of the z-interval, mesh is 2D if this is None (default is None).

  • end_x (float) – End of the x-interval.

  • end_y (float) – End of the y-interval.

  • end_z (float | None) – End of the z-interval, mesh is 2D if this is None (default is None).

  • diagonal (Literal['right', 'left', 'left/right', 'right/left', 'crossed']) – This defines the type of diagonal used to create the box mesh in 2D. This can be one of "right", "left", "left/right", "right/left" or "crossed".

  • comm (MPI.Comm | None) – MPI communicator that is to be used for creating the mesh.

Returns:

A tuple (mesh, subdomains, boundaries, dx, ds, dS), where mesh is the imported FEM mesh, subdomains is a mesh function for the subdomains, boundaries is a mesh function for the boundaries, dx is a volume measure, ds is a surface measure, and dS is a measure for the interior facets.

Return type:

_typing.MeshTuple