porepy.grids.grid_extrusion module
This module contains functionality to to increase the dimensions of grids by extrusion in the z-direction.
Both, single grids and mixed-dimensional grids can be extruded. The dimension of the highest-dimensional grid should be 2 at most.
The two functions performing above are
- extrude_grid(g, z)[source]
Increases the dimension of a given grid by 1, by extruding the grid in the z-direction.
The original grid is assumed to be in the xy-plane, that is, any existing non-zero z-direction is ignored.
Both, the original and the new grid will have their geometry computed.
- Parameters
- Raises
ValueError – If the z-coordinates for nodes contain both positive and negative values.
ValueError – If a 3D grid is provided for extrusion.
- Returns
A 3-tuple containing
Grid
:The extruded grid of dimension
g.dim + 1
.ndarray
:Cell mappings, such that that row
i
gives all indices of cells in the extruded grid that comes from celli
in the original grid.ndarray
:Face mappings, s.t. row
i
gives all indices of faces in the extruded grid that come from facei
in the original grid.
- Return type
- extrude_grid_bucket(mdg, z)[source]
Extrude a mixed-dimensional grid by extending all fixed-dimensional grids in the z-direction.
In practice, the original grid bucket will be 2D, and the result is 3D.
The returned mixed-dimensional grid is fully functional, including mortar grids on the mdg edges. The data dictionaries on subdomains and interfaces are mainly empty. Data can be transferred from the original md-grid via the returned map between old and new grids.
- Parameters
mdg (MixedDimensionalGrid) – Mixed-dimensional grid to be extruded. The highest dimension should be 2D.
z (ndarray) – An array containing z-coordinates per node for the extruded grid. Should be either non-negative or non-positive, and be sorted in increasing or decreasing order, respectively.
- Returns
A 2-tuple containing
MixedDimensionalGrid
:A mixed-dimensional grid with highest dimension 3. The data dictionaries on subdomains and interfaces are mostly empty.
dict
:Mapping from individual grids in the old mixed-dimensional grid to the corresponding extruded grids in the new one. The dictionary values are a named tuple with elements grid (new grid), cell_map and face_map, where the two latter describe mapping between the new and old grid, see
extrude_grid()
for details.
- Return type