pyopmspe11.utils.mapproperties module#
Create SPE11 grids and assign geological and reporting properties.
The module reads benchmark geometry, builds Cartesian, tensor, or corner-point grids, maps facies and reporting regions to cells, adds boundary pore volume, and locates wells and pressure sensors before deck files are written.
- generate_deck_files(cfg)[source]#
Generate grid, property, and OPM input files.
The selected grid type determines how facies, reporting regions, boundary pore volume, wells, and sensors are mapped before files are written.
- _calculate_cell_centers(xmx, ymy, zmz)[source]#
Calculate cell-center coordinates from axis vertices.
- Parameters:
- xmxNDArray
Grid vertices along the x axis.
- ymyNDArray
Grid vertices along the y axis.
- zmzNDArray
Grid vertices along the z axis.
- Returns:
- tuple[NDArray, NDArray, NDArray]
Calculated arrays in x, y, and z order.
- Parameters:
xmx (NDArray)
ymy (NDArray)
zmz (NDArray)
- Return type:
tuple[NDArray, NDArray, NDArray]
- _calculate_cell_sizes(xmx, ymy, zmz)[source]#
Calculate cell sizes from axis vertices.
- Parameters:
- xmxNDArray
Grid vertices along the x axis.
- ymyNDArray
Grid vertices along the y axis.
- zmzNDArray
Grid vertices along the z axis.
- Returns:
- tuple[NDArray, NDArray, NDArray]
Calculated arrays in x, y, and z order.
- Parameters:
xmx (NDArray)
ymy (NDArray)
zmz (NDArray)
- Return type:
tuple[NDArray, NDArray, NDArray]
- _assign_structured_spe11a_properties(cfg, polygons, facies)[source]#
Assign geological and reporting properties on a structured SPE11A grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- polygonslist
Prepared facies polygons.
- facieslist
Facies identifiers corresponding to the polygons.
- Returns:
- fipnumNDArray
Reporting-region identifiers in global cell order.
- fluxnumNDArray
Facies identifiers in global cell order.
- x_verticesNDArray
Grid vertices along the x axis.
- z_verticesNDArray
Grid vertices along the z axis.
- Parameters:
- Return type:
tuple[NDArray, NDArray, NDArray, NDArray]
- _assign_structured_spe11bc_properties(cfg, polygons, facies)[source]#
Assign geological and reporting properties on a structured SPE11B or SPE11C grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- polygonslist[Polygon]
Prepared facies polygons.
- facieslist
Facies identifiers corresponding to the polygons.
- Returns:
- fipnumNDArray
Reporting-region identifiers in global cell order.
- fluxnumNDArray
Facies identifiers in global cell order.
- boundary_porvlist[str]
OPM EQUALS records assigning additional pore volume to boundary cells.
- x_verticesNDArray
Grid vertices along the x axis.
- z_verticesNDArray
Grid vertices along the z axis.
- Parameters:
- Return type:
- _add_front_back_boundary_properties(cfg, fipnum, fluxnum, porv, d_x, d_z, xcent, zcent, lowpoly)[source]#
Add pore volume and FIPNUM values on SPE11C front and back boundaries.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- fipnumNDArray
FIPNUM values in global cell order.
- fluxnumNDArray
Facies identifiers in global cell order.
- porvlist
Boundary pore-volume edit records.
- d_xNDArray
Cell sizes along x.
- d_zNDArray
Cell sizes or effective thicknesses along z.
- xcentNDArray
Cell centers along x.
- zcentNDArray
Cell centers along z.
- lowpolyPolygon
Polygon bounding the lower neighbourhood.
- Parameters:
- Return type:
None
- _set_front_back_fipnum(cfg, fipnum, fluxnum, ind)[source]#
Assign front and back boundary FIPNUM values for one SPE11C column.
- _get_polygon_search_order(z, zmidbot, ztopbot)[source]#
Return a depth-dependent facies-polygon search order.
- Parameters:
- zfloat
Cell-center z coordinate.
- zmidbotfloat
Lower depth threshold for polygon ordering.
- ztopbotfloat
Upper depth threshold for polygon ordering.
- Returns:
- list[int]
Facies-polygon indices ordered to check the most likely polygons first.
- Parameters:
- Return type:
- _assign_corner_point_spe11a_properties(cfg, polygons, facies, xc, zc)[source]#
Assign geological and reporting properties on a corner-point SPE11A grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- polygonslist[Polygon]
Prepared facies polygons.
- facieslist
Facies identifiers corresponding to the polygons.
- xcNDArray
Corner-point cell centers along the x axis.
- zcNDArray
Corner-point cell centers along the z axis.
- Returns:
- fipnumNDArray
Reporting-region identifiers in global cell order.
- fluxnumNDArray
Facies identifiers in global cell order.
- Parameters:
- Return type:
tuple[NDArray, NDArray]
- _assign_corner_point_spe11bc_properties(cfg, polygons, facies, xc, zc, ymy, ycent, d_x, d_y, d_z)[source]#
Assign geological and reporting properties on a corner-point SPE11B or SPE11C grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- polygonslist[Polygon]
Prepared facies polygons.
- facieslist
Facies identifiers corresponding to the polygons.
- xcNDArray
Corner-point cell centers along the x axis.
- zcNDArray
Corner-point cell centers along the z axis.
- ymyNDArray
Grid vertices along the y axis.
- ycentNDArray
Cell centers along the y axis.
- d_xNDArray
Cell sizes along the x axis.
- d_yNDArray
Cell sizes along the y axis.
- d_zNDArray
Effective cell thicknesses in the x-z plane.
- Returns:
- fipnumNDArray
Reporting-region identifiers in global cell order.
- fluxnumNDArray
Facies identifiers in global cell order.
- boundary_porvlist[str]
OPM EQUALS records assigning additional pore volume to boundary cells.
- Parameters:
- Return type:
- _locate_corner_point_wells_and_sensors(cfg, fipnum, zc, ymy, pop1, pop2, well1, well2)[source]#
Store corner-point well and sensor indices for SPE11B or SPE11C.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- fipnumNDArray
FIPNUM values in global cell order.
- zcNDArray
Corner-point cell centers along z.
- ymyNDArray
Grid vertices along the y axis.
- pop1int
Flattened index of pressure sensor 1.
- pop2int
Flattened index of pressure sensor 2.
- well1int
Flattened index of injection well 1.
- well2int
Flattened index of injection well 2.
- Parameters:
- Return type:
None
- _get_region_fipnum(cfg, x_c, z_c, idx, fluxnum)[source]#
Return the reporting-region FIPNUM for one cell.
The reporting region depends on the cell-center coordinates, facies, and whether the cell lies on a lateral boundary.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- x_cfloat
Cell-center x coordinate.
- z_cfloat
Cell-center z coordinate.
- idxint
Cell index along the x axis.
- fluxnumfloat
Facies identifier assigned to the cell.
- Returns:
- int
FIPNUM identifying a benchmark box, lateral boundary, facies-1 region, or background region.
- Parameters:
- Return type:
- _get_facies_region_fipnum(fluxnum, numa, numb)[source]#
Select a region FIPNUM according to facies-1 overlap.
- _locate_structured_sensors(cfg, fipnum, xcent, ycent, zcent)[source]#
Locate pressure sensors in a structured grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- fipnumNDArray
FIPNUM values in global cell order.
- xcentNDArray
Cell centers along x.
- ycentNDArray
Cell centers along y.
- zcentNDArray
Cell centers along z.
- Parameters:
cfg (Config)
fipnum (NDArray)
xcent (NDArray)
ycent (NDArray)
zcent (NDArray)
- Return type:
None
- _locate_structured_wells(cfg, xcent, ycent, zcent)[source]#
Locate injection wells in a structured grid.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- xcentNDArray
Cell centers along x.
- ycentNDArray
Cell centers along y.
- zcentNDArray
Cell centers along z.
- Parameters:
cfg (Config)
xcent (NDArray)
ycent (NDArray)
zcent (NDArray)
- Return type:
None
- _calculate_spe11c_elevation(cfg, ycent)[source]#
Calculate the SPE11C vertical offset along the y axis.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- ycentNDArray
Cell centers along y.
- Returns:
- NDArray
Calculated numeric values.
- Parameters:
cfg (Config)
ycent (NDArray)
- Return type:
NDArray
- _read_facies_polygons(cfg)[source]#
Read benchmark geometry and construct prepared facies polygons.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- Returns:
- polygonslist[Polygon]
Prepared polygons used for repeated point-in-polygon tests.
- facieslist[int]
Facies identifier corresponding to each polygon.
- pointslist[Point]
Scaled benchmark geometry points used for corner-point grids.
- Parameters:
cfg (Config)
- Return type:
- _read_lower_region_polygon(cfg)[source]#
Read the polygon bounding the lower active neighbourhood.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- Returns:
- Polygon
Polygon enclosing cells retained by the lower-neighbourhood model.
- Parameters:
cfg (Config)
- Return type:
Polygon
- _build_corner_point_grid(cfg, points)[source]#
Build SPE11 corner-point geometry and cell dimensions.
Horizon lines are interpolated and vertically refined before COORD and ZCORN are written and cell centers and sizes are calculated.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- pointslist[Point]
Benchmark geometry points.
- Returns:
- xc, zcNDArray
Cell-center coordinates in the x-z plane.
- d_x, d_y, d_zNDArray
Cell sizes along x and y and effective thicknesses in the x-z plane.
- ycentNDArray
Cell-center coordinates along the y axis.
- xmx, ymyNDArray
Grid vertices along the x and y axes.
- Parameters:
- Return type:
tuple[NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray]
- _refine_vertical_grid(xci, zci, ncz, znr)[source]#
Refine corner-point pillars using vertical refinement factors.
- Parameters:
- xciNDArray
Unrefined pillar x coordinates.
- zciNDArray
Unrefined pillar z coordinates.
- nczint
Number of unrefined vertical cells.
- znrlist[int]
Vertical refinement factors.
- Returns:
- xcr, zcrNDArray
Refined pillar coordinates along x and z.
- ncx_new, ncz_newint
Numbers of cells along x and z after refinement.
- Parameters:
- Return type: