pycopm.utils.generate_decks module#

Coordinate coarsening, refinement, submodel extraction, and grid transformations.

create_deck(dck, cmdargs)[source]#

Generate a modified OPM deck and its include files.

The selected workflow can preprocess the input deck, coarsen or refine the grid, extract a vicinity submodel, transform coordinates, and optionally run a validation dry run.

Parameters:
dck

Deck configuration populated from command-line arguments.

cmdargs

Parsed command arguments used to build coarsening or refinement maps.

Parameters:
  • dck (ConfigViaDeck)

  • cmdargs (Namespace)

Return type:

None

_correct_fluid_in_place(dck, modified_deck)[source]#

Adjust output pore volume to match input oil and gas in place.

Short Flow runs provide the fluid-in-place values used for two successive pore volume corrections.

Parameters:
dck

Deck configuration whose output_porv is updated.

modified_deck

Generated deck lines used to create the correction case.

Parameters:
  • dck (ConfigViaDeck)

  • modified_deck (list[str])

Return type:

None

_create_index_mappings(dck, vicinity, refinement, coarsening)[source]#

Create original-to-output mappings for each grid axis.

Depending on the selected workflow, the mappings represent coarse cells, submodel indices, or the first and last cells created by refinement.

Parameters:
dck

Deck configuration updated with the index mappings.

vicinity

Vicinity bounds for submodel extraction.

refinement

Per-axis refinement values.

coarsening

Per-axis coarsening values.

Parameters:
Return type:

None

_initialize_deck_data(dck)[source]#

Load dry-run grid and property data into the deck configuration.

The function opens EGRID, INIT, and optional restart files, determines grid dimensions, and collects available property keywords.

Parameters:
dck

Deck configuration updated with OPM files, dimensions, and keyword lists.

Parameters:

dck (ConfigViaDeck)

Return type:

None