porepy.fracs.fracture module

A module containing the abstract base class for all fractures.

class Fracture(points, index=None, sort_points=True)[source]

Bases: ABC

Abstract base class for representing a single fracture.

This base class provides general functionalities agnostic to the dimension of the fracture and the ambient dimension. It contains various utility methods, mainly intended for the use together with the FractureNetwork class.

A fracture is defined by its num_points vertices, stored in an nd x num_points numpy-array, where nd is the assumed ambient dimension. The order/sorting of vertices has to be implemented explicitly.

Dimension-dependent routines are implemented as abstract methods.

PorePy currently only supports planar and convex fractures fully. As a work-around, the fracture can be split into convex parts.

Parameters
  • points (ArrayLike) –

  • index (Optional[int]) –

  • sort_points (bool) –

abstract compute_centroid()[source]

Abstract method for computing and returning the centroid of the fracture.

Note that convexity is assumed.

Return type

ndarray

abstract compute_normal()[source]

Abstract method for computing and returning the normal vector.

Return type

ndarray

copy()[source]

Return a copy of the fracture with the current vertices.

Note

The original points (as given when the fracture was initialized) will not be preserved.

Returns

Fracture with the same points.

Return type

Fracture

is_vertex(p, tol=1e-4)[source]

Check whether a given point is a vertex of the fracture.

Parameters
  • p (shape=(nd, )) – Point to be checked.

  • tol (float) – Tolerance of point accuracy. Default is 1e-4.

Returns

A tuple containing

bool:

Indicates whether the point is a vertex.

ndarray:

Gives the position of p in pts if the point is a vertex. Else, None is returned.

Return type

tuple[bool, Optional[int]]

abstract local_coordinates()[source]

Abstract method for computing the local coordinates.

The compuation is performed on the vertex coordinates in a local system and its local dimension \(d\) is assumed to be \(d = nd - 1\), i.e. the fracture has co-dimension 1.

Returns

Coordinates of the vertices in local dimensions (shape=(d, num_points)).

Return type

ndarray

points()[source]

Generator over the vertices of the fracture.

Yields

Fracture vertex (shape=(nd, )).

Return type

Generator[ndarray, None, None]

segments()[source]

Generator over the segments according to the currently applied order.

Yields

Fracture segment (shape=(nd, 2)).

Return type

Generator[ndarray, None, None]

set_index(i)[source]

Set index of this fracture.

Parameters

i (int) – Index.

abstract sort_points()[source]

Abstract method to sort the vertices as needed for geometric algorithms.

Returns

Array of integer indices corresponding to the sorting.

Return type

ndarray

center: ndarray

Centroid of the fracture (shape=(nd, )).

index: Optional[int]

Index of fracture.

Intended use in FractureNetwork2d and FractureNetwork3d. Exact use is not clear (several fractures can be given same index), use with care.

normal: ndarray

Normal vector (shape=(nd, )).

orig_pts: ndarray

Original fracture vertices (shape=(nd, num_points)).

The original points are kept in case the fracture geometry is modified.

pts: ndarray

Fracture vertices (shape=(nd, num_points)), stored in the implemented order.

Note that the points passed to init will mutate.