flopy.utils.cvfdutil module

class Point(x, y)[source]

Bases: object

normalize(dx, dy)[source]
offset(x0, y0)[source]
area_of_polygon(x, y)[source]
centroid_of_polygon(points)[source]
get_disv_gridprops(verts, iverts, xcyc=None)[source]

Calculate disv grid properties from verts and iverts

Parameters:
  • verts (ndarray) – 2d array of x, y vertices

  • iverts (list) – list of size ncpl, with a list of vertex numbers for each cell

Returns:

gridprops – Dictionary containing entries that can be passed directly into the modflow6 disv package.

Return type:

dict

gridlist_to_verts(gridlist)[source]

Take a list of flopy structured model grids and convert them into vertices. The idomain can be set to remove cells in a parent grid. Cells from a child grid will patched in to make a single set of vertices. Cells will be numbered according to consecutive numbering of active cells in the grid list.

Parameters:

gridlist (list) – List of flopy.discretization.modelgrid. Must be of type structured grids

Returns:

verts, iverts – vertices and list of cells and which vertices comprise the cells

Return type:

np.ndarray, list

isBetween(a, b, c, epsilon=0.001)[source]
normalize_points(a, b, c)[source]
segment_face(ivert, ivlist1, ivlist2, vertices)[source]

Check the vertex lists for cell 1 and cell 2. Add a new vertex to cell 1 if necessary.

Parameters:
  • ivert (int) – vertex number to check

  • ivlist1 (list) – list of vertices for cell 1. Add a new vertex to this cell if needed.

  • ivlist2 (list) – list of vertices for cell2.

  • vertices (ndarray) – array of x, y vertices

Returns:

segmented – Return True if a face in cell 1 was split up by adding a new vertex

Return type:

bool

shapefile_to_cvfd(shp, **kwargs)[source]
shapefile_to_xcyc(shp)[source]

Get cell centroid coordinates

Parameters:

shp (string) – Name of shape file

Returns:

xcyc – x, y coordinates of all polygons in shp

Return type:

ndarray

shared_face(ivlist1, ivlist2)[source]
to_cvfd(vertdict, nodestart=None, nodestop=None, skip_hanging_node_check=False, duplicate_decimals=9, verbose=False, detect_non_convergence=True)[source]

Convert a vertex dictionary into verts and iverts

Parameters:
  • vertdict – A dictionary {icell: [(x1, y1), (x2, y2), (x3, y3), …]}

  • nodestart (int) – Starting node number. (default is zero)

  • nodestop (int) – Ending node number up to but not including. (default is len(vertdict))

  • skip_hanging_node_check (bool) – Skip the hanging node check. The hanging node check is designed for quad-based grid refinement (e.g., quadtree grids) where larger cells are subdivided, creating “hanging nodes” that need to be added to neighboring cells. The check may not converge for grids with floating point precision artifacts like nearly duplicate vertices. Set this option True to avoid this. If False and non-convergence is detected (assuming detect_non_convergence is True), a warning will be issued.

  • duplicate_decimals (int) – Decimals to round duplicate vertex checks. GRIDGEN can occasionally produce very-nearly overlapping vertices, this can be used to change the sensitivity for filtering out duplicates. (default is 9)

  • verbose (bool) – Print messages to the screen. (default is False)

  • detect_non_convergence (bool) – Enable automatic detection of non-convergent hanging node checks. When enabled, the algorithm monitors segmentation counts across iterations. If counts remain high and are flat or increasing, stop early and issue a warning. This prevents infinite loops while still allowing slow-but-steady decrease to converge for complex grids. Set False to disable this check and allow unlimited iterations. (default is True)

Returns:

  • verts (ndarray) – array of x, y vertices

  • iverts (list) – list containing a list for each cell