porepy.grids.boundary_grid module

class BoundaryGrid(*args, **kwargs)[source]

Bases: Grid

A grid representing the boundary of a domain.

The BoundaryGrid is generated from a parent grid, and represents those faces in the parent which are on the boundary of the computational domain (i.e. those with tag ‘domain_boundary_faces’ set to True).

The boundary grid is intended as a holder of boundary conditions only.

Todo

The BoundaryGrid is not a full grid, and should not be used as such. The current inheritance from Grid is a hack to get the BoundaryGrid to work with methods that expect a Grid. The natural solution is to make an abc superclass, say, GridBase, which is inherited by both Grid and BoundaryGrid, and then use GridBase in type hints when either a Grid or a BoundaryGrid can be used.

Note

Boundary grids have a id counter, which is shared with the parent class Grid. This may confuse expectations of consecutive numbering of grids, if generation of standard grids is interleaved with generation of boundary grids.

Return type

Grid

cell_centers: ndarray

Cell centers of the boundary grid.

Subset of the face centers of the parent grid.

dim: int

Dimension of the boundary grid.

name: str

Name of the grid.

num_cells: int

Number of cells in the boundary grid. Will correspond to the number of faces on the domain boundary in the parent grid.

property projection

Projection matrix from the parent grid to the boundary grid.

The projection matrix is a sparse matrix, with shape=(num_cells, num_faces_parent), which maps face-wise values on the parent grid to the boundary grid.