porepy.fracs.fracture_importer module

dfm_3d_from_fab(file_name, tol=1e-4, domain=None, return_domain=False, **mesh_kwargs)[source]

Create the grid bucket from a set of 3d fractures stored in a fab file and domain.

Parameters
  • file_name (str) – name of the file

  • tol (float) – (optional) tolerance for the methods

  • domain – (optional) the domain, otherwise a bounding box is considered

  • return_domain (bool) – whether to return the domain.

  • mesh_kwargs – kwargs for the gridding, see meshing.simplex_grid

Returns

the mixed-dimensional grid

Return type

mdg

dfm_from_gmsh(file_name, dim, **kwargs)[source]

Generate a MixedDimensionalGrid from a gmsh file.

If the provided file is input for gmsh (.geo, not .msh), gmsh will be called to generate the mesh before the MixedDimensionalGrid is constructed.

Parameters
  • file_name (str) – Name of gmsh in and out file. Should have extsion .geo or .msh. In the former case, gmsh will be called upon to generate the mesh before the mixed-dimensional mesh is constructed.

  • dim (int) – Dimension of the problem. Should be 2 or 3.

Returns

Mixed-dimensional grid as contained in the gmsh file.

Return type

MixedDimensionalGrid

elliptic_network_3d_from_csv(file_name, has_domain=True, tol=1e-4, degrees=False)[source]

Create the fracture network from a set of 3d fractures stored in a csv file and domain. In the csv file, we assume the following structure - first line (optional) describes the domain as a rectangle with

X_MIN, Y_MIN, Z_MIN, X_MAX, Y_MAX, Z_MAX

  • the other lines describe the N fractures as a elliptic fractures: center_x, center_y, center_z, major_axis, minor_axis, major_axis_angle,

    strike_angle, dip_angle, num_points.

See create_elliptic_fracture for information about the parameters

Lines that start with a # are ignored.

Parameters

file_name

Name of the file

has_domain

Whether the first line in the csv file specify the domain

tol

Tolerance for geometry related methods (snapping etc.) of FractureNetwork3d. Defaults to 1e-4.

# TODO document argument degrees

Returns

FractureNetwork3d

the fracture network

network_2d_from_csv(f_name, tagcols=None, tol=1e-8, max_num_fracs=None, polyline=False, return_frac_id=False, domain=None, **kwargs)[source]

Read csv file with fractures to obtain fracture description.

Create the mixed-dimensional grid from a set of fractures stored in a csv file and a domain. In the csv file, we assume one of the two following structures:

  1. FID, START_X, START_Y, END_X, END_Y

  2. FID, PT_X, PT_Y

Format a) is used to describe fractures consisting of a straight line. FID is the fracture id, START_X and START_Y are the abscissa and coordinate of the starting point, and END_X and END_Y are the abscissa and coordinate of the ending point.

Format b) can be used to describe polyline fractures: Each row in the file represents a separate points, points with the same FID will be assigned to the same fracture in the order specified in the file.

To change the delimiter from the default comma, use kwargs passed to np.genfromtxt.

The csv file is assumed to have a header of 1 line. To change this number, use kwargs skip_header.

Parameters
  • f_name (str) – Path to csv file

  • tagcols (array-like, int. Optional) – Column index where fracture tags are stored. 0-offset. Defaults to no columns.

  • tol (double, optional) – Tolerance for merging points with almost equal coordinates.

  • max_num_fracs (int, optional) – Maximum number of fractures included, counting from the start of the file. Defaults to inclusion of all fractures.

  • **kwargs – keyword arguments passed on to np.genfromtxt.

Returns

Network representation of the fractures

Return type

FractureNetwork2d

Raises

ValueError – If a fracture of a single point is specified.

network_3d_from_csv(file_name, has_domain=True, tol=1e-4, **kwargs)[source]

Create the fracture network from a set of 3d fractures stored in a csv file and domain. In the csv file, we assume the following structure - first line (optional) describes the domain as a rectangle with

X_MIN, Y_MIN, Z_MIN, X_MAX, Y_MAX, Z_MAX

  • the other lines descibe the N fractures as a list of points P0_X, P0_Y, P0_Z, …,PN_X, PN_Y, PN_Z

Lines that start with a # are ignored.

Parameters
  • file_name (str) – path to the csv file

  • has_domain (boolean) – if the first line in the csv file specify the domain

  • tol (float) – (double, optional) geometric tolerance used in the computations. Defaults to 1e-4.

  • **kwargs – Keyword arguments passed on to Fracture and FractureNetwork3d

Returns

the fracture network

Return type

network

network_3d_from_fab(f_name, return_all=False, tol=None)[source]

Read fractures from a .fab file, as specified by FracMan.

The filter is based on the .fab-files available at the time of writing, and may not cover all options available.

Parameters
  • f_name (str) – Path to .fab file.

  • return_all (bool) – Whether to return additional information (see Returns)

  • tol (Optional[float]) – Tolerance passed on instantiation of the returned FractureNetwork3d

Returns

the network of fractures tess_fracs (optional returned if return_all==True, list of np.ndarray):

Each list element contains fracture cut by the domain boundary, represented by vertexes as a nd x n_pt array.

tess_sgn (optional returned if return_all==True, np.ndarray):

For each element in tess_frac, a +-1 defining which boundary the fracture is on.

Return type

network

The function also reads in various other information of unknown usefulness, see implementation for details. This information is currently not returned.