porepy.fracs.meshing module

Main module for grid generation in fractured domains in 2d and 3d.

The module serves as the only necessary entry point to create the grid. It will therefore wrap interface to different mesh generators, pass options to the generators etc.

cart_grid(fracs, nx, **kwargs)[source]

Creates a cartesian fractured MixedDimensionalGrid in 2- or 3-dimensions.

Parameters
  • fracs (list[numpy.ndarray]) – One list item for each fracture. Each item consist of a (nd x npt) array describing fracture vertices, where npt is 2 for 2d domains, 4 for 3d domains. The fractures have to be rectangles(3D) or straight lines(2D) that align with the axis. The fractures may be intersecting.The fractures will snap to the closest grid faces.

  • nx (np.ndarray) – Number of cells in each direction. Should be 2D or 3D

Return type

MixedDimensionalGrid

**kwargs:
physdims (np.ndarray): Physical dimensions in each direction.

Defaults to same as nx, that is, cells of unit size. May also contain fracture tags, options for gridding, etc.

Returns

A complete mixed-dimensional grid where all fractures are represented as lower dim grids. The higher dim fracture faces are split in two, and on the edges of the MixedDimensionalGrid graph the mapping from lower dim cells to higher dim faces are stored as ‘face_cells’. Each face is given boolean tags depending on the type: domain_boundary_faces: All faces that lie on the domain boundary (i.e. should be given a boundary condition).fracture_faces: All faces that are split (i.e. has a connection to a lower dim grid). tip_faces: A boundary face that is not on the domain boundary, nor coupled to a lower dimensional domain. The union of the above three is the tag boundary_faces.

Return type

MixedDimensionalGrid

Parameters

Examples

>>> frac1 = np.array([[1, 4], [2, 2]])
>>> frac2 = np.array([[2, 2], [1, 4]])
>>> fracs = [frac1, frac2]
>>> mdg = cart_grid(fracs, [5, 5])
create_interfaces(mdg, sd_pair_to_face_cell_map)[source]

Create interfaces for a given MixedDimensionalGrid.

Parameters
subdomains_to_mdg(subdomains, time_tot=None, **kwargs)[source]

Convert a list of grids to a full MixedDimensionalGrid.

The list can come from several mesh constructors, both simplex and structured approaches uses this in 2D and 3D.

The function can not be used on an arbitrary set of grids; they should contain information to glue grids together. This will be included for grids created by the standard mixed-dimensional grid constructors. Essentially, do not directly use this function unless you are knowledgeable about how it works.

Parameters
  • subdomains (list[list[porepy.grids.grid.Grid]]) – Subdomains to enter into the Mixed-dimensional grid. Sorted per dimension.

  • time_tot (optional) – Start time for full mesh construction. Used for logging. Defaults to None, in which case no information on total time consumption is logged.

  • **kwargs – Passed on to subfunctions.

Returns

Final mixed-dimensional grid.

Return type

MixedDimensionalGrid

tensor_grid(fracs, x, y=None, z=None, **kwargs)[source]

Creates a cartesian fractured MixedDimensionalGrid in 2- or 3-dimensions.

Args: fracs (list of np.ndarray): One list item for each fracture. Each item

consist of a (nd x npt) array describing fracture vertices, where npt is 2 for 2d domains, 4 for 3d domains. The fractures has to be rectangles(3D) or straight lines(2D) that alignes with the axis. The fractures may be intersecting. The fractures will snap to closest grid faces.

x (np.ndarray): Node coordinates in x-direction y (np.ndarray): Node coordinates in y-direction. z (np.ndarray): Node coordinates in z-direction. **kwargs: May contain fracture tags, options for gridding, etc.

Returns: MixedDimensionalGrid: A complete bucket where all fractures are represented as

lower dim grids. The higher dim fracture faces are split in two, and on the edges of the MixedDimensionalGrid graph the mapping from lower dim cells to higher dim faces are stored as ‘face_cells’. Each face is given boolean tags depending on the type:

domain_boundary_faces: All faces that lie on the domain boundary

(i.e. should be given a boundary condition).

fracture_faces: All faces that are split (i.e. has a connection to a

lower dim grid).

tip_faces: A boundary face that is not on the domain boundary, nor

coupled to a lower domentional domain.

The union of the above three is the tag boundary_faces.

Examples
>>> frac1 = np.array([[1, 4], [2, 2]])
>>> frac2 = np.array([[2, 2], [1, 4]])
>>> fracs = [frac1, frac2]
>>> mdg = cart_grid(fracs, [5, 5])
Parameters
Return type

MixedDimensionalGrid