porepy.fracs.msh_2_grid module
Module for converting gmsh output file to our grid structure.
- create_0d_grids(pts, cells, phys_names, cell_info, target_tag_stem=None)[source]
Create 0d grids for points of a specified type from a gmsh tessalation.
Only points that were defined as ‘physical’ in the gmsh sense may have a grid created, but then only if the physical name matches specified target_tag_stem.
It is assumed that the mesh is read by meshio. See porepy.fracs.simplex for how to do this.
- Parameters
pts (
np.ndarray, npt x 3
) – Global point set from gmshcells (
dict
) – Should have a key vertex, which maps to a np.ndarray if indices of the points that form point grids.phys_names (
dict
) – mapping from the gmsh tags assigned to physical entities to the physical name of that tag.cell_info (
dictionary
) – Should have a key ‘vertex’, that contains the physical names (in the gmsh sense) of the points.target_tag_stem (
str, optional
) – The target physical name, all points that have this tag will be assigned a grid. The string is assumed to be on the from BASE_NAME_OF_TAG_{INDEX}, where _INDEX is a number. The comparison is made between the physical names and the target_tag_stem, up to the last underscore. If not provided, the physical names of fracture points will be used as target.
- Returns
- List of 0d grids for all physical points that matched with the
specified target tag.
- Return type
list of grids
- create_1d_grids(pts, cells, phys_names, cell_info, line_tag=None, tol=1e-4, constraints=None, return_fracture_tips=True)[source]
Create 1d grids for lines of a specified type from a gmsh tessalation.
Only lines that were defined as ‘physical’ in the gmsh sense may have a grid created, but then only if the physical name matches specified line_tag.
It is assumed that the mesh is read by meshio. See porepy.fracs.simplex for how to do this.
- Parameters
pts (
np.ndarray, npt x 3
) – Global point set from gmshcells (
dict
) – Should have a key ‘line’, which maps to a np.ndarray with indices of the lines that form 1d grids.phys_names (
dict
) – mapping from the gmsh tags assigned to physical entities to the physical name of that tag.cell_info (
dictionary
) – Should have a key ‘line’, that contains the physical names (in the gmsh sense) of the points.line_tag (
str, optional
) – The target physical name, all lines that have this tag will be assigned a grid. The string is assumed to be on the from BASE_NAME_OF_TAG_{INDEX}, where _INDEX is a number. The comparison is made between the physical names and the line, up to the last underscore. If not provided, the physical names of fracture lines will be used as target.tol (
double, optional
) – Tolerance used when comparing points in the creation of line grids. Defaults to 1e-4.constraints (
np.array, optional
) – Array with lists of lines that should not become grids. The array items should match the INDEX in line_tag, see above.return_fracture_tips (
boolean, optional
) – If True (default), fracture tips will be found and returned.
- Returns
- List of 1d grids for all physical lines that matched with the
specified target tag.
- np.array, each item is an array of indices of points on a fracture tip. Only
returned in return_fracture_tips is True.
- Return type
list of grids
- create_2d_grids(pts, cells, phys_names, cell_info, is_embedded=False, surface_tag=None, constraints=None)[source]
Create 2d grids for lines of a specified type from a gmsh tessalation.
Only surfaces that were defined as ‘physical’ in the gmsh sense may have a grid created, but then only if the physical name matches specified line_tag.
It is assumed that the mesh is read by meshio. See porepy.fracs.simplex for how to do this.
- Parameters
pts (
np.ndarray, npt x 3
) – Global point set from gmshcells (
dict
) – Should have a key ‘triangle’ which maps to a np.ndarray with indices of the points that form 2d grids.phys_names (
dict
) – mapping from the gmsh tags assigned to physical entities to the physical name of that tag.cell_info (
dictionary
) – Should have a key ‘triangle’ that contains the physical names (in the gmsh sense) of the points.is_embedded (
boolean, optional
) – If True, the triangle grids are embedded in 3d space. If False (default), the grids are truly 2d.surface_tag (
str, optional
) – The target physical name, all surfaces that have this tag will be assigned a grid. The string is assumed to be on the from BASE_NAME_OF_TAG_{INDEX}, where _INDEX is a number. The comparison is made between the physical names and the line, up to the last underscore. If not provided, the physical names of fracture surfaces will be used as target.constraints (
np.array, optional
) – Array with lists of lines that should not become grids. The array items should match the INDEX in line_tag, see above.
- Returns
- List of 2d grids for all physical surfaces that matched with the
specified target tag.
- Return type
list of grids
- create_embedded_line_grid(loc_coord, glob_id, tol=1e-4)[source]
Create a 1d grid embedded in a higher dimensional space.
- Parameters
loc_coord (
np.ndarray
) – Coordinates of points to be used in the grid.glob_id (
np.ndarray
) – Global indexes of the points. Typically refers to a global mesh, where the points of this grid is a subset.tol (
float, optional
) – Tolerance used for check of collinearity of the points. Defaults to 1e-4.
- Returns
DESCRIPTION.
- Return type
g (TYPE)