porepy.fracs.split_grid module

Module for splitting a grid at the fractures.

duplicate_faces(sd_primary, face_cells)[source]

Duplicate all faces that are connected to a lower-dim cell

Parameters:

sd_primary:

Higher-dim grid

face_cells:

Connection matrix mapping from the cells of a lower-dim subdomain to the faces of the higher-dimensional subdomain.

Parameters
duplicate_nodes(g, nodes, offset)[source]

Duplicate nodes on a fracture. The number of duplication will depend on the cell topology around the node. If the node is not on a fracture 1 duplicate will be added. If the node is on a single fracture 2 duplicates will be added. If the node is on a T-intersection 3 duplicates will be added. If the node is on a X-intersection 4 duplicates will be added. Equivalently for other types of intersections.

Parameters:

g - The grid for which the nodes are duplicated nodes - The nodes to be duplicated offset - How far from the original node the duplications should be

placed.

remove_faces(g, face_id, rem_cell_faces=True)[source]

Remove faces from grid.

PARAMETERS:

g - A grid face_id - Indices of faces to remove rem_cell_faces - Defaults to True. If set to false, the g.cell_faces matrix

is not changed.

remove_nodes(g, rem)[source]

Remove nodes from grid. g - a valid grid definition rem - a ndarray of indices of nodes to be removed

split_faces(gh, face_cells)[source]

Split faces of the grid along each fracture. This function will add an extra face to each fracture face. Note that the original and new fracture face will share the same nodes. However, the cell_faces connectivity is updated such that the fractures are internal boundaries (cells on left side of fractures are not connected to cells on right side of fracture and vise versa). The face_cells are updated such that the copy of a face also map to the same lower-dim cell.

split_fractures(mdg, sd_pairs, **kwargs)[source]

Wrapper function to split all fractures. For each grid in the mdg, we locate the corresponding lower-dimensional grids. The faces and nodes corresponding to these grids are then split, creating internal boundaries.

Parameters

mdg - A mixed-dimensional grid **kwargs:

offset - FLOAT, defaults to 0. Will perturb the nodes around the

faces that are split. NOTE: this is only for visualization. E.g., the face centers are not perturbed.

Returns

mdg - A valid mdg where the faces are split at

internal boundaries.

Examples >>> import numpy as np >>> from gridding.fractured import meshing, split_grid >>> from viz.exporter import export_vtk >>> >>> f_1 = np.array([[-1, 1, 1, -1 ], [0, 0, 0, 0], [-1, -1, 1, 1]]) >>> f_2 = np.array([[0, 0, 0, 0], [-1, 1, 1, -1 ], [-.7, -.7, .8, .8]]) >>> f_set = [f_1, f_2] >>> domain = {‘xmin’: -2, ‘xmax’: 2,

‘ymin’: -2, ‘ymax’: 2, ‘zmin’: -2, ‘zmax’: 2}

>>> mdg = meshing.create_grid(f_set, domain)
>>> [g.compute_geometry() for g,_ in mdg]
>>>
>>> split_grid.split_fractures(mdg, offset=0.1)
>>> export_vtk(mdg, "grid")
Parameters
split_nodes(sd_primary, sd_secondary, primary_to_secondary_nodes, visualization_offset=0.0)[source]

Splits the nodes of a subdomain grid

Parameters:

sd_primary:

Higher-dimension grid.

sd_secondary:

A list of lower dimensional grids

gh_2_gl_node:

A list of connection arrays. Each array in the list gives the mapping from the lower-dim nodes to the higher dim nodes. gh_2_gl_nodes[0][0] is the higher-dim index of the first node of the first lower-dim.

offset:

Optional, defaults to 0. This gives the offset from the fracture to the new nodes. Note that this is only for visualization, e.g., g.face_centers is not updated.

Parameters
split_specific_faces(sd_primary, face_cell_list, faces, cells, secondary_ind, non_planar=False)[source]

For a given pair of sd_primary and sd_secondary. Split only the faces specified by faces (higher-dimensional), corresponding to new cells (lower-dimensional). gl_ind identifies gl in face_cell_list, i.e.

intf = mdg.subdomain_pair_to_interface((gh, gl)) face_cell_list[gl_ind] = mdg.interface_data(intf, ‘face_cells’)

Parameters
update_cell_connectivity(g, face_id, normal, x0)[source]

After the faces in a grid are duplicated, we update the cell connectivity list. Cells on the right side of the fracture do not change, but the cells on the left side are attached to the face duplicates. We assume that all faces that have been duplicated lie in the same plane. This plane is described by a normal and a point, x0. We attach cell on the left side of the plane to the duplicate of face_id. The cell on the right side is attached to the face frac_id.

Parameters:

g - The grid for which the cell_face mapping is updated frac_id - Indices of the faces that have been duplicated normal - Normal of faces that have been duplicated. Note that we assume

that all faces have the same normal

x0 - A point in the plane where the faces lie

Returns:

int: Flag that informs on what action has been taken. 0 means g.cell_faces has been

split. -1 means the fracture was on the boundary, and no action taken.

Raises:

ValueError: If the fracture is not planar

Parameters
Return type

int