porepy.grids.structured module

Module containing classes for structured grids.

Acknowledgement

The implementation of structured grids is in practice a translation of the corresponding functions found in the Matlab Reservoir Simulation Toolbox (MRST) developed by SINTEF ICT.

class CartGrid(*args, **kwargs)[source]

Bases: TensorGrid

Representation of a 2D or 3D Cartesian grid.

The name 'CartGrid' is assigned to each instance.

Parameters:
  • nx (np.ndarray) –

    Number of cells in each direction (x, y or z).

    Should be 1d, 2d or 3d. 1d grids can also be specified by a scalar.

  • physdims (Optional[Union[np.ndarray, dict[str, float]]]) –

    default=None

    Physical dimensions in each direction.

    Can be given as an array with up to 3 entries (for each dimension).

    Can also be given as a dictionary with keys

    • 'xmin', 'xmax',

    • 'ymin', 'ymax' (optional if 1D),

    • 'zmin', 'zmax' (optional if 1D or 2D).

    If None, the number of cells in each direction is used, i.e. the cells will be of unit size.

class TensorGrid(*args, **kwargs)[source]

Bases: Grid

Representation of a grid formed by a tensor product of line point distributions.

For information on attributes and methods, see the documentation of the parent class.

The resulting grid is 1D or 2D or 3D, depending on the number of coordinate lines are provided.

Parameters:
  • x (np.ndarray) – Node coordinates in x-direction.

  • y (Optional[np.ndarray]) –

    default=None

    Node coordinates in y-direction. If None, the created grid will be 1D.

  • z (Optional[np.ndarray]) –

    default=None

    Node coordinates in z-direction. If None, the created grid will be 2D.

  • name (str) –

    default=None

    Name for the grid. If None, the grid will be called 'TensorGrid'.

cart_dims: ndarray

The resulting dimensions of the of the underlying Cartesian grid.