pygeon.grids.grid module

Grid class for the pygeon package.

class pygeon.grids.grid.Grid(*args, **kwargs)[source]

Bases: Grid

Grid class represents a geometric grid object, in addition to the pp.Grid class it implements the following attributes and methods.

__init__(*args, **kwargs)[source]

Initialize a Grid object.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

None

compute_geometry()[source]

Defines grid entities of codim 2 and 3.

The entities are referred to by their codimension: 0: “cells” 1: “faces” 2: “ridges” 3: “peaks”

This method computes the geometry of the grid by calling the superclass’s compute_geometry method, computing the ridge and peak connectivities, and storing the edge lengths and mesh size.

Parameters:

None

Returns:

None

compute_ridges()[source]

Computes the ridges of the grid and assigns the following attributes:

  • num_ridges: number of ridges

  • num_peaks: number of peaks

  • face_ridges: connectivity between each face and ridge

  • ridge_peaks: connectivity between each ridge and peak

  • tags[‘tip_ridges’]: tags for entities at fracture tips

  • tags[‘tip_peaks’]: tags for entities at fracture tips

Parameters:

None

Returns:

None

tag_ridges()[source]

Tag the peaks and ridges of the grid located on fracture tips.

This method tags the peaks and ridges of the grid that are located on fracture tips. It sets the “tip_peaks” and “tip_ridges” tags in the grid object. For 2D grids, the “tip_ridges” tag is determined based on the “tip_faces” tag and the face ridges. For 3D grids, the “tip_ridges” tag is initialized as an array of zeros. The “domain_boundary_ridges” tag is also set based on the face ridges and the “domain_boundary_faces” tag.

Parameters:

None

Returns:

None

compute_subvolumes(return_subsimplices=False)[source]

Compute the subvolumes of the grid.

Parameters:

return_subsimplices (bool, optional) – Whether to return the sub-simplices. Defaults to False.

Returns:

The computed subvolumes with each entry [node, cell] describing the signed measure of the associated sub-volume

Return type:

sps.csc_array

compute_opposite_nodes(recompute=False)[source]

Computes a matrix containing the index of the opposite node for every (face, cell) pair. Sets it as an attribute for later use.

Parameters:

recompute (bool, optional) – Whether to recompute the opposite nodes. Defaults to False.

Returns:

The index k of the opposite node is in the entry (face, cell)

Return type:

sps.csc_array

compute_edge_properties()[source]

Computes and stores the tangent vectors and lengths of the grid edges (1D entities).

Parameters:

None

Returns:

None

compute_mesh_size()[source]

Computes and stores the typical mesh size as the mean of the edge lengths.

Parameters:

None

Returns:

None

compute_rotation_matrix()[source]

Computes and stores the rotation matrix that maps the subdomain to the xy-plane or x-axis.

Parameters:

None

Returns:

None

copy()[source]

Create a new instance with some attributes deep-copied from the grid.

Returns:

A deep copy of self. Some predefined attributes are also copied.