pycopm.utils.generate_decks module

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

pycopm.utils.generate_decks._correct_fluid_in_place(dck: ConfigViaDeck, modified_deck: list[str]) None

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.

pycopm.utils.generate_decks._create_index_mappings(dck: ConfigViaDeck, vicinity: VicinityMaps, refinement: RefinementMaps, coarsening: CoarseningMaps) None

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.

pycopm.utils.generate_decks._initialize_deck_data(dck: ConfigViaDeck) None

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.

pycopm.utils.generate_decks.create_deck(dck: ConfigViaDeck, cmdargs) None

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.