flopy.utils.faceutil module

Face utilities for finding shared faces between grid cells

get_shared_face(mg: Grid, cellid1: tuple[int, ...], cellid2: tuple[int, ...]) list[tuple[float, float]] | None[source]

Get the 2D coordinates of the shared face between two cells.

Parameters:
  • mg (Grid) – Model grid

  • cellid1 (tuple of int) – First cell ID

  • cellid2 (tuple of int) – Second cell ID

Returns:

List of two (x, y) tuples representing the shared face endpoints, or None if cells don’t share a face

Return type:

list or None

get_shared_face_3d(mg: Grid, cellid1: tuple[int, ...], cellid2: tuple[int, ...]) list[tuple[float, float, float]] | None[source]

Get the 3D coordinates of the shared face between two cells.

Parameters:
  • mg (Grid) – Model grid

  • cellid1 (tuple) – First cell ID

  • cellid2 (tuple) – Second cell ID

Returns:

List of (x, y, z) tuples representing the shared face vertices, or None if cells don’t share a face

Return type:

list or None

get_shared_face_indices(mg: Grid, node1: int, node2: int) tuple[int, int] | None[source]

Find a shared face between two cells and return its vertex indices.

Parameters:
  • mg (Grid) – Model grid

  • node1 (int) – First node number (2D)

  • node2 (int) – Second node number (2D)

Returns:

Tuple of two vertex indices representing the shared edge, or None if cells don’t share an edge

Return type:

tuple or None

hfb_data_to_linework(recarray: recarray, modelgrid: Grid) list[tuple[tuple[float, float], tuple[float, float]]][source]

Convert HFB barrier data to line segments representing shared cell faces.

Parameters:
  • recarray (np.recarray) – recarray of hfb input data

  • modelgrid (Grid) – modelgrid instance

Returns:

list of line segments, each as a tuple of two (x, y) coordinate tuples

Return type:

list

is_vertical(mg: Grid, cellid1: tuple[int, ...], cellid2: tuple[int, ...]) bool[source]

Determine if a 3D face is horizontal (between vertically stacked cells) or vertical (between laterally adjacent cells).

For structured (DIS) and vertex (DISV) grids, uses cellid structure to determine orientation. For unstructured (DISU) grids, prefers to use the ihc (horizontal connection indicator) array if available, falling back to geometric analysis of shared face z-coordinates.

Parameters:
  • mg (Grid) – Model grid

  • cellid1 (tuple) – First cell ID

  • cellid2 (tuple) – Second cell ID

Returns:

True if face is vertical (laterally adjacent cells), False if horizontal (vertically stacked cells)

Return type:

bool