porepy.fracs.non_conforming module

Created on Sun Nov 5 11:17:04 2017

@author: eke001

combine_grids(g, g_1d, h, h_1d, global_ind_offset, list_of_grids, tol)[source]
init_global_ind(gl)[source]

Initialize a global indexing of nodes to a set of local grids.

Parameters

gl (triple list) – Outer: One per fracture, middle: dimension, inner: grids within the dimension.

Returns

Single list representation of all grids. Fractures and

dimensions will be mixed up.

int: Global number of nodes.

Return type

list (Grid)

merge_1d_grids(g, h, global_ind_offset=0, tol=1e-4)[source]

Merge two 1d grids with non-matching nodes to a single grid.

The grids should have common start and endpoints. They can be into 3d space in a genreal way.

The function is primarily intended for merging non-conforming DFN grids.

Parameters
  • g – 1d tensor grid.

  • h – 1d tensor grid

  • glob_ind_offset (int, defaults to 0) – Off set for the global point index of the new grid.

  • tol (double, defaults to 1e-4) – Tolerance for when two nodes are merged into one.

Returns

New tensor grid, containing the combined node definition. int: New global ind offset, increased by the number of cells in the

combined grid.

np.array (int): Indices of common nodes (after sorting) of g and the

new grid.

np.array (int): Indices of common nodes (after sorting) of h and the

new grid.

np.array (int): Permutation indices that sort the node coordinates of

g. The common indices between g and the new grid are found as new_grid.nodes[:, g_in_combined] = g.nodes[:, sorted]

np.array (int): Permutation indices that sort the node coordinates of

h. The common indices between h and the new grid are found as new_grid.nodes[:, h_in_combined] = h.nodes[:, sorted]

Return type

TensorGrid

merge_grids(grids, intersections, tol=1e-4)[source]

Main method of module, merge all grids

process_intersections(grids, intersections, global_ind_offset, list_of_grids, tol)[source]

Loop over all intersections, combined two and two grids.

update_cell_faces(g, delete_faces, new_faces, in_combined, fn_orig, node_coord_orig, tol=1e-4)[source]

Replace faces in a cell-face map.

If faces have been refined (or otherwise modified), it is necessary to update the cell-face relation as well. This function does so, while taking care that the (implicit) mapping between cells and nodes is ordered so that geometry computation still works.

The changes of g.cell_faces are done in-place.

It is assumed that the new faces that replace an old are ordered along the common line. E.g. if a face with node coordinates (0, 0) and (3, 0) is replaced by three new faces of unit length, they should be ordered as 1. (0, 0) - (1, 0) 2. (1, 0) - (2, 0) 3. (2, 0) - (3, 0) Switching the order into 3, 2, 1 is okay, but, say, 1, 3, 2 will create problems.

It is also tacitly assumed that each cell has at most one face deleted. Changing this may not be difficult, but has not been prioritized so far.

The function has been tested in 2d only, reliability in 3d is unknown, but doubtful.

Parameters
  • g (grid) – To be updated.

  • delete_faces (np.ndarray) – Faces to be deleted, as found in g.cell_faces

  • new_faces (np.ndarray) – Index of new faces, as found in g.face_nodes

  • in_combined (np.ndarray) – Map between old and new faces. delete_faces[i] is replaced by new_faces[in_combined[i]:in_combined[i+1]].

  • fn_orig (np.ndarray) – Face-node relation of the orginial grid, before update of faces.

  • node_coord_orig (np.ndarray) – Node coordinates of orginal grid, before update of nodes.

  • tol (double, defaults to 1e-4) – Small tolerance, used to compare coordinates of points.

update_face_nodes(g, delete_faces, num_new_faces, new_node_offset, nodes_per_face=None)[source]

Update face-node map by deleting and inserting new faces.

The method deletes specified faces, adds new ones towards the end. It does nothing to adjust the face-node relation for remaining faces.

The code assumes a constant number of nodes per face.

Parameters
  • g (grid) – Grid to have its faces modified. Should have fields face_nodes and num_faces.

  • delete_faces (np.array) – Index of faces to be deleted.

  • num_new_faces (int) – Number of new faces to create.

  • new_node_offset (int) – Offset index of the new nodes.

  • nodes_per_face (int, optional) – Number of nodes per face, assumed equal for all faces. Defaults to g.dim, that is, simplex grids

Returns

Index of the new faces.

Return type

np.array

update_face_tags(g, delete_faces, new_faces)[source]

Update the face tags of a cell.

Delete tags for old faces, and add new tags for their replacements.

If the grid has no face tags, no change is done

Parameters
  • g (grid) – To be modified

  • delete_faces (np.array or list) – Faces to be deleted.

  • new_faces (list of list) – For each item in delete_faces, a list of new replacement faces.

update_global_point_ind(grid_list, old_ind, new_ind)[source]

Update global point indices in a list of grids.

The method replaces indices in the attribute global_point_ind in the grid. The update is done in place.

Parameters
  • grid_list (list of grids) – Grids to be updated.

  • old_ind (np.array) – Old global indices, to be replaced.

  • new_ind (np.array) – New indices.

update_nodes(g, g_1d, new_grid_1d, this_in_combined, sort_ind, global_ind_offset, list_of_grids)[source]

Update a 2d grid to conform to a new grid along a 1d line.

Intended use: A 1d mesh that is embedded in a 2d mesh (along a fracture) has been updated / refined. This function then updates the node information in the 2d grid.

Parameters
  • g (grid, dim==2) – Main grid to update. Has faces along a fracture.

  • g_1d (grid, dim==1) – Original line grid along the fracture.

  • new_grid_1d (grid, dim==1) – New line grid, formed by merging two coinciding, but non-matching grids along a fracture.

  • this_in_combined (np.ndarray) – Which nodes in the new grid are also in the old one, as returned by merge_1d_grids().

  • sort_ind (np.ndarray) – Sorting indices of the coordinates of the old grid, as returned by merge_1d_grids().

  • list_of_grids (list) – Grids for all dimensions.

Returns: