pofff.utils.mapproperties module#

Generate FluidFlower grids and assign spatial model properties.

The module builds Cartesian, tensor, and corner-point grids; reads geological points, horizons, and facies polygons; applies thickness maps; locates sensors and injection sources; classifies reporting boxes; and writes mappings from the simulation grid to the benchmark reporting grid.

pofff.utils.mapproperties._assign_box_region(bounds: list[list[float]], sand_region: str, other_region: str, x: NDArray[float64], z: NDArray[float64], fluxnum: NDArray[Any], fipnum: NDArray[Any]) None[source]#

Assign FIPNUM values inside one benchmark reporting box.

Cells belonging to facies 1 receive sand_region. All other cells inside the box receive other_region. The fipnum array is modified in place.

Parameters:
boundslist[list[float]]

Lower-left and upper-right box corners as [[xmin, zmin], [xmax, zmax]] in metres.

sand_regionstr

FIPNUM assigned to cells in facies 1.

other_regionstr

FIPNUM assigned to all other facies inside the box.

xNDArray[np.float64]

Cell-centre x coordinates in global cell order, in metres.

zNDArray[np.float64]

Cell-centre z coordinates in global cell order, in metres.

fluxnumlist[str]

Facies identifiers in global cell order.

fipnumlist[str]

FIPNUM values in global cell order, modified in place.

pofff.utils.mapproperties._assign_corner_point_properties(cfg: PofffConfig, xyz: NDArray[float64], polygons: list[Polygon], xcoord: NDArray[float64], zcoord: NDArray[float64]) None[source]#

Assign properties and feature indices on a corner-point grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xyzNDArray[np.float64]

Cell-centroid coordinates with columns x, y, and z.

polygonslist[Polygon]

FluidFlower facies polygons in model coordinates.

xcoordNDArray[np.float64]

Corner-point x coordinates arranged by pillar and vertical interface.

zcoordNDArray[np.float64]

Corner-point z coordinates arranged by pillar and vertical interface.

pofff.utils.mapproperties._assign_spatial_properties(cfg: PofffConfig, polygons: list[Polygon], xcent: NDArray[float64] | None = None, zcent: NDArray[float64] | None = None, xyz: NDArray[float64] | None = None, xcoord: NDArray[float64] | None = None, zcoord: NDArray[float64] | None = None) None[source]#

Dispatch property assignment for the selected grid representation.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

polygonslist[Polygon]

FluidFlower facies polygons in model coordinates.

xcentNDArray[np.float64] | None, optional

Cell-centre x coordinates in metres.

zcentNDArray[np.float64] | None, optional

Cell-centre z coordinates in metres.

xyzNDArray[np.float64] | None, optional

Cell-centroid coordinates with columns x, y, and z.

xcoordNDArray[np.float64] | None, optional

Corner-point x coordinates arranged by pillar and vertical interface.

zcoordNDArray[np.float64] | None, optional

Corner-point z coordinates arranged by pillar and vertical interface.

pofff.utils.mapproperties._assign_structured_grid_properties(cfg: PofffConfig, xcent: NDArray[float64], zcent: NDArray[float64], polygons: list[Polygon]) None[source]#

Assign properties and feature indices on a structured grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xcentNDArray[np.float64]

Cell-centre x coordinates in metres.

zcentNDArray[np.float64]

Cell-centre z coordinates in metres.

polygonslist[Polygon]

FluidFlower facies polygons in model coordinates.

pofff.utils.mapproperties._build_corner_point_coordinates(cfg: PofffConfig, points: list[list[float]]) tuple[NDArray[float64], NDArray[float64], NDArray[float64]][source]#

Build refined corner-point coordinates and cell centroids.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

pointslist[list[float]]

Geological points represented by x and z coordinates in metres.

Returns:
tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]

Cell centroids followed by refined corner x and z coordinates.

pofff.utils.mapproperties._classify_reporting_boxes(cfg: PofffConfig, x: NDArray[float64], z: NDArray[float64], flux: list[str]) list[str][source]#

Assign benchmark reporting-region FIPNUM values.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xNDArray[np.float64]

Cell or plotting x coordinates in metres.

zNDArray[np.float64]

Cell or plotting z coordinates in metres.

fluxlist[str]

Facies identifiers in global cell order.

Returns:
list[str]

FIPNUM values in global cell order.

pofff.utils.mapproperties._load_thickness_map(cfg: PofffConfig) tuple[float, NDArray, NDArray, NDArray][source]#

Load the selected FluidFlower thickness map and multipliers.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

Returns:
tuple[float, NDArray, NDArray, NDArray]

Minimum thickness, map x and z coordinates, and normalized multipliers.

pofff.utils.mapproperties._locate_corner_point_sensors(cfg: PofffConfig, x: NDArray[float64], ztop: NDArray[float64]) tuple[int, int][source]#

Locate both observation sensors on a corner-point grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xNDArray[np.float64]

Cell or plotting x coordinates in metres.

ztopNDArray[np.float64]

Cell-centre depth coordinates measured from the model top.

Returns:
tuple[int, int]

Global zero-based indices of the two sensor cells.

pofff.utils.mapproperties._locate_corner_point_sources(cfg: PofffConfig, x: NDArray[float64], ztop: NDArray[float64]) None[source]#

Locate both injection sources on a corner-point grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xNDArray[np.float64]

Cell or plotting x coordinates in metres.

ztopNDArray[np.float64]

Cell-centre depth coordinates measured from the model top.

pofff.utils.mapproperties._locate_structured_sensors(cfg: PofffConfig, xcent: NDArray[float64], zcent: NDArray[float64]) tuple[int, int][source]#

Locate both observation sensors on a structured grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xcentNDArray[np.float64]

Cell-centre x coordinates in metres.

zcentNDArray[np.float64]

Cell-centre z coordinates in metres.

Returns:
tuple[int, int]

Global zero-based indices of the two sensor cells.

pofff.utils.mapproperties._locate_structured_sources(cfg: PofffConfig, xcent: NDArray[float64], zcent: NDArray[float64]) None[source]#

Locate both injection sources on a structured grid.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

xcentNDArray[np.float64]

Cell-centre x coordinates in metres.

zcentNDArray[np.float64]

Cell-centre z coordinates in metres.

pofff.utils.mapproperties._read_geological_polygons(cfg: PofffConfig) tuple[list[Polygon], list[list[float]]][source]#

Read geological points, line connectivity, and facies polygons.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

Returns:
tuple[list[Polygon], list[list[float]]]

Facies polygons and the geological point coordinates.

pofff.utils.mapproperties._read_horizon_lines(cfg: PofffConfig, points: list[list[float]]) list[list[list[float]]][source]#

Read and order geological horizon polylines.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

pointslist[list[float]]

Geological points represented by x and z coordinates in metres.

Returns:
list[list[list[float]]]

Geological horizons ordered from bottom to top.

pofff.utils.mapproperties._refine_vertical_coordinates(xci: NDArray[float64], zci: NDArray[float64], ncz: int, znr: NDArray[float64]) tuple[NDArray[float64], NDArray[float64], int, int][source]#

Subdivide geological layers by their vertical refinement factors.

Parameters:
xciNDArray[np.float64]

Unrefined corner-point x coordinates.

zciNDArray[np.float64]

Unrefined corner-point z coordinates.

nczint

Number of unrefined vertical cells.

znrNDArray[np.float64]

Vertical refinement factor for each geological layer.

Returns:
tuple[NDArray[np.float64], NDArray[np.float64], int, int]

Refined x and z coordinates and the new x and z cell counts.

pofff.utils.mapproperties._tensor(parts: list[int], dimension: float) NDArray[float64][source]#

Construct tensor-grid edges from per-region refinement counts.

Divide the physical dimension into equally sized regions, then subdivide each region according to its corresponding refinement count.

Parameters:
partslist[int]

Positive numbers of cells assigned to consecutive equal-sized regions.

dimensionfloat

Total physical length of the grid axis, in metres.

Returns:
NDArray[np.float64]

Ordered grid-edge coordinates from zero through dimension, in metres.

pofff.utils.mapproperties._write_cell_map(cfg: PofffConfig, simxcent: NDArray[float64], simzcent: NDArray[float64]) None[source]#

Map benchmark reporting cells to their nearest simulation cells.

The mapping is written as cellmap.npy below cfg.deck.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

simxcentNDArray[np.float64]

Simulation-cell x coordinates in global cell order.

simzcentNDArray[np.float64]

Simulation-cell z coordinates in global cell order.

pofff.utils.mapproperties.grid_and_properties(cfg: PofffConfig) None[source]#

Generate the selected grid and assign spatial model properties.

The function updates grid dimensions, generated OPM arrays, sensor and source indices, and the benchmark cell map on cfg.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.