pycopm.utils.refinement module#

Refine a corner-point grid and its reservoir properties.

class RefinementMaps(x, y, z, refined_cell_counts)[source]#

Bases: object

Store axis refinement values and subdivision counts.

Parameters:
  • x (NDArray)

  • y (NDArray)

  • z (NDArray)

  • refined_cell_counts (NDArray)

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.

refined_cell_counts: NDArray#

Number of refined cells generated from each original cell, flattened in (z, y, x) order.

create_refinement_maps(dck, cmdargs)[source]#

Create axis refinement maps and update output dimensions.

A refinement value of n divides an original interval into n + 1 intervals.

Parameters:
dck

Deck configuration whose output dimensions are updated.

cmdargs

Command arguments containing refinement, x_refinement, y_refinement, and z_refinement.

Returns:
RefinementMaps

Axis values and the number of subdivisions per original cell.

Parameters:
  • dck (ConfigViaDeck)

  • cmdargs (Namespace)

Return type:

RefinementMaps

refine_properties(dck, refinement, modified_deck)[source]#

Map reservoir properties onto the refined grid.

Properties are copied to generated cells. PORV is 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.

Returns:
generated_files

Names of the written include files.

Parameters:
  • dck (ConfigViaDeck)

  • refinement (RefinementMaps)

  • modified_deck (list[str])

Return type:

list[str]

create_coord_axis_map(refinement_values)[source]#

Create interpolation data for one COORD axis.

Parameters:
refinement_values

Number of additional cells in each original interval.

Returns:
source_indices, fractions

Original intervals and relative positions of refined grid points.

Parameters:

refinement_values (NDArray)

Return type:

tuple[NDArray, NDArray]

create_zcorn_axis_map(refinement_values)[source]#

Create interpolation data for one ZCORN axis.

Parameters:
refinement_values

Number of additional cells in each original interval.

Returns:
source_indices, fractions

Original intervals and relative corner positions in ZCORN order.

Parameters:

refinement_values (NDArray)

Return type:

tuple[NDArray, NDArray]

refine_zcorn_surface(source_surface, destination_surface, original_nx, original_ny, output_nx, output_ny, zcorn_x_indices, zcorn_y_indices, zcorn_x_fractions, zcorn_y_fractions)[source]#

Interpolate one ZCORN surface onto the refined horizontal grid.

Parameters:
source_surface

Flattened input surface with 4 * original_nx * original_ny values.

destination_surface

Preallocated output with 4 * output_nx * output_ny values, modified in place.

original_nx, original_ny

Original horizontal grid dimensions.

output_nx, output_ny

Refined horizontal grid dimensions.

zcorn_x_indices, zcorn_y_indices

Source interval indices for refined corners.

zcorn_x_fractions, zcorn_y_fractions

Relative interpolation positions within source intervals.

Parameters:
  • 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)

Return type:

None

refine_grid(dck, refinement)[source]#

Create and write the refined corner-point grid.

COORD and ZCORN values are linearly interpolated along the refined axes.

Parameters:
dck

Deck configuration containing original geometry and grid dimensions.

refinement

Axis refinement maps.

Parameters:
Return type:

None