pygeon.grids.octagon module

Module for the octagon grid.

class pygeon.grids.octagon.OctagonGrid(*args, **kwargs)[source]

Bases: Grid

A structured grid with octagons and squares in the interior and triangles near the boundary.

__init__(nx, physdims=None, name='Octagon grid')[source]

Constructor for the 2D octagonal grid.

Parameters:
  • nx (np.ndarray) – Number of cells in the x and y directions.

  • physdims (np.ndarray or dict) – The physical dimensions, either as a numpy array or a dict with keys “xmin”, “xmax”, “ymin”, and “ymax”.

  • name (str) – Name of grid.

compute_nodes(nx, physdims)[source]

Compute the nodes of an octagon grid.

Parameters:
  • nx (np.ndarray) – Number of grid points in each dimension.

  • physdims (dict| np.ndarray) – Physical dimensions of the grid.

Returns:

Array of node coordinates.

Return type:

np.ndarray

rescale_nodes(nodes, nx, physdims)[source]

Rescales the given nodes based on the physical dimensions and grid size.

Parameters:
  • nodes (np.ndarray) – The array of nodes to be rescaled.

  • nx (np.ndarray) – The grid size in each dimension.

  • physdims (dict| np.ndarray) – The physical dimensions of the grid.

Returns:

The rescaled nodes.

Return type:

np.ndarray

compute_face_nodes(nx)[source]

Compute the face-node connectivity matrix for an octagon grid.

Parameters:

nx (np.ndarray) – Array containing the number of nodes in the x and y directions.

Returns:

The face-node connectivity matrix.

Return type:

sps.csc_array

compute_cell_faces(nx)[source]

Compute the faces of each cell in the octagon grid.

Parameters:
  • nx (np.ndarray) – Array containing the number of cells in the x

  • directions. (and y)

Returns:

Sparse matrix representing the cell faces.

Return type:

sps.csc_array