porepy.fracs.plane_fracture module

Contains classes representing fractures in 2D, i.e. manifolds of dimension 2 embedded in 3D.

class PlaneFracture(points, index=None, check_convexity=False, sort_points=True)[source]

Bases: Fracture

A class representing planar fracture in 3D in form of a (bounded) plane.

Non-convex fractures can be initialized, but geometry processing (computation of intersections etc.) is not supported for non-convex geometries.

Parameters
  • points (ArrayLike) –

  • index (Optional[int]) –

  • check_convexity (bool) –

  • sort_points (bool) –

add_points(p, check_convexity=True, tol=1e-4, enforce_pt_tol=None)[source]

Add points to the polygon with the implemented sorting enforced.

Always run a test to check that the points are still planar. By default, a check of convexity is also performed, however, this can be turned off to speed up simulations (the test uses sympy, which turns out to be slow in many cases).

Parameters
  • p (np.ndarray, nd x n) – Points to be added.

  • check_convexity (bool, optional) – Verify that the polygon is convex. Defaults to true.

  • tol (float , optional) – Tolerance used to check if the point already exists. Defaults to 1e-4.

  • enforce_pt_tol (float, optional) – Defaults to None. If not None, enforces a maximal distance between points by removing points failing that criterion.

Returns

True, if the resulting polygon is planar, False otherwise. If the

argument check_convexity is True, checks for planarity AND convexity

Return type

bool

as_sympy_polygon(pts=None)[source]

Represent polygon as a sympy object.

Parameters

ptsnumpy.array(nd x npt) , optional

Points for the polygon. Defaults to None, in which case self.pts is used.

Returns

sympy.geometry.Polygon

Representation of the polygon formed by p.

Parameters

pts (Optional[ndarray]) –

Return type

Polygon

compute_centroid()[source]

See parent class docs. The method assumes the polygon is convex.

Return type

ndarray

compute_normal()[source]

See parent class docs.

Return type

ndarray

is_convex()[source]

See parent class docs

TODO

If a hanging node is inserted at a segment, this may slightly violate convexity due to rounding errors. It should be possible to write an algorithm that accounts for this. First idea: Project point onto line between points before and after, if the projection is less than a tolerance, it is okay.

Return type

bool

is_planar(tol=1e-4)[source]

Check if the points representing this fracture lie within a 2D-plane.

Parameters

tolfloat

Tolerance for non-planarity. Treated as an absolute quantity (no scaling with fracture extent).

Returns

bool

True if the polygon is planar, False otherwise.

Parameters

tol (float) –

Return type

bool

local_coordinates()[source]

Represent the vertex coordinates in the natural 2D plane.

The plane has constant, but not necessarily zero, third coordinate. I.e., no translation to the origin is made.

Returns

numpy.ndarray(2 x n)

The 2d coordinates of the vertices.

Return type

ndarray

remove_points(ind, keep_orig=False)[source]

Remove points from the fracture definition.

Parameters
  • ind (np.ndarray or list) – Numpy array or list of indices of points to be removed.

  • keep_orig (bool, optional) – Defaults to False. If True, keeps the original points in the attribute orig_pts.

sort_points()[source]

Ensure that the points are sorted in a counter-clockwise (CCW) order.

Notes

For now, the ordering of nodes in based on a simple angle argument. This will not be robust for general point clouds, but we expect the fractures to be regularly shaped in this sense. In particular, we will be safe if the cell is convex.

Returns

numpy.ndarray(dtype=int)

The 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.

create_elliptic_fracture(center, major_axis, minor_axis, major_axis_angle, strike_angle, dip_angle, num_points=16, index=None)[source]

Initialize an elliptic shaped fracture, approximated by a polygon.

The rotation of the plane is calculated using three angles. First, the rotation of the major axis from the x-axis. Next, the fracture is inclined by specifying the strike angle (which gives the rotation axis) measured from the x-axis, and the dip angle. All angles are measured in radians.

Notes

This child class constructor does not call the parent class constructor. Ergo parent methods like copy are not available

Parameters

centernumpy.ndarray(3x1)

Center coordinates of fracture.

major_axisfloat

Length of major axis (radius-like, not diameter).

minor_axisfloat

Length of minor axis. There are no checks on whether the minor axis is less or equal the major.

major_axis_anglefloat , radians

Rotation of the major axis from the x-axis. Measured before strike-dip rotation, see above.

strike_anglefloat , radians

Line of rotation for the dip. Given as angle from the x-direction.

dip_anglefloat , radians

Dip angle, i.e. rotation around the strike direction.

num_pointsint , optional

Defaults to 16. Number of points used to approximate the ellipsis.

indexint , optional

Index of fracture. Defaults to None.

Examples

Fracture centered at [0, 1, 0], with a ratio of lengths of 2, rotation in xy-plane of 45 degrees, and an incline of 30 degrees rotated around the x-axis. >>> frac = create_elliptic_fracture(np.array([0, 1, 0]), 10, 5,

np.pi/4, 0, np.pi/6)

Parameters