pycopm.utils.refinement module
Refine a corner-point grid and its reservoir properties.
- class pycopm.utils.refinement.RefinementMaps(x: NDArray, y: NDArray, z: NDArray, refined_cell_counts: NDArray)
Bases:
objectStore axis refinement values and subdivision counts.
- refined_cell_counts: NDArray
Number of refined cells generated from each original cell, flattened in
(z, y, x)order.
- x: NDArray
Number of additional cells created from each original x interval.
- y: NDArray
Number of additional cells created from each original y interval.
- z: NDArray
Number of additional cells created from each original z interval.
- pycopm.utils.refinement.create_coord_axis_map(refinement_values: NDArray) tuple[NDArray, NDArray]
Create interpolation data for one COORD axis.
- Parameters:
refinement_values – Number of additional cells in each original interval.
- Returns:
Original intervals and relative positions of refined grid points.
- Return type:
source_indices, fractions
- pycopm.utils.refinement.create_refinement_maps(dck: ConfigViaDeck, cmdargs) RefinementMaps
Create axis refinement maps and update output dimensions.
A refinement value of
ndivides an original interval inton + 1intervals.- Parameters:
dck – Deck configuration whose output dimensions are updated.
cmdargs – Command arguments containing
refinement,x_refinement,y_refinement, andz_refinement.
- Returns:
Axis values and the number of subdivisions per original cell.
- Return type:
- pycopm.utils.refinement.create_zcorn_axis_map(refinement_values: NDArray) tuple[NDArray, NDArray]
Create interpolation data for one ZCORN axis.
- Parameters:
refinement_values – Number of additional cells in each original interval.
- Returns:
Original intervals and relative corner positions in ZCORN order.
- Return type:
source_indices, fractions
- pycopm.utils.refinement.refine_grid(dck: ConfigViaDeck, refinement: RefinementMaps) None
Create and write the refined corner-point grid.
COORDandZCORNvalues are linearly interpolated along the refined axes.- Parameters:
dck – Deck configuration containing original geometry and grid dimensions.
refinement – Axis refinement maps.
- pycopm.utils.refinement.refine_properties(dck: ConfigViaDeck, refinement: RefinementMaps, modified_deck: list[str]) None
Map reservoir properties onto the refined grid.
Properties are copied to generated cells.
PORVis divided equally among them to preserve each original cell’s pore volume.- Parameters:
dck – Deck configuration containing source properties and output dimensions.
refinement – Refinement maps created by
create_refinement_maps().modified_deck – Deck lines updated with generated property includes.
- pycopm.utils.refinement.refine_zcorn_surface(source_surface: NDArray, destination_surface: NDArray, original_nx: int, original_ny: int, output_nx: int, output_ny: int, zcorn_x_indices: NDArray, zcorn_y_indices: NDArray, zcorn_x_fractions: NDArray, zcorn_y_fractions: NDArray) None
Interpolate one ZCORN surface onto the refined horizontal grid.
- Parameters:
source_surface – Flattened input surface with
4 * original_nx * original_nyvalues.destination_surface – Preallocated output with
4 * output_nx * output_nyvalues, modified in place.original_nx – Original horizontal grid dimensions.
original_ny – Original horizontal grid dimensions.
output_nx – Refined horizontal grid dimensions.
output_ny – Refined horizontal grid dimensions.
zcorn_x_indices – Source interval indices for refined corners.
zcorn_y_indices – Source interval indices for refined corners.
zcorn_x_fractions – Relative interpolation positions within source intervals.
zcorn_y_fractions – Relative interpolation positions within source intervals.