Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@ authors:
affiliations:
- name: NORCE Research AS, Bergen, Norway
index: 1
date: 15 January 2026
date: 24 January 2026
bibliography: paper.bib
---

# Summary

Reservoir simulations are essential for optimizing resource management, facilitating accurate predictions and informed decision-making in the energy industry. The ability to rapidly update geological models is crucial in the dynamic field of reservoir management. `pycopm` serves as a geomodeling tool for quickly tailoring geological models. Its functionality includes grid coarsening, extraction of selected zones in the reservoir (submodels), localized grid refinements, and affine transformations on grid spatial locations, including scaling, rotation, and translation. The impact of `pycopm` is expected to extend far beyond its initial application to coarse two wide recognized open datasets ([Norne](https://github.com/OPM/opm-tests/tree/master/norne) and [Drogon](https://github.com/OPM/opm-tests/tree/master/drogon)) in a history matching application [@2024sandve], due to its user-friendly features (i.e., generation of different models from provided input files via command flags) and recent extension to refinements, submodels, and transformations (e.g., studies focusing on grid refinement, upscaling/coarsening approaches, pressure interference between site models within a regional aquifer, and faster debugging of numerical issues in large models).
Reservoir simulations are essential for optimizing resource management, facilitating accurate predictions and informed decision-making in the energy industry. The ability to rapidly update geological models is crucial in the dynamic field of reservoir management. `pycopm` serves as a geomodeling tool for quickly tailoring geological models. Its functionality includes grid coarsening, extraction of selected zones in the reservoir (submodels), localized grid refinements, and affine transformations on grid spatial locations, including scaling, rotation, and translation. The impact of `pycopm` has extended far beyond its initial application to coarse two wide recognized open datasets ([Norne](https://github.com/OPM/opm-tests/tree/master/norne) and [Drogon](https://github.com/OPM/opm-tests/tree/master/drogon)) in a history matching application [@2024sandve], due to its user-friendly features (i.e., generation of different models from provided input files via command flags) and recent extension to refinements, submodels, and transformations (e.g., studies focusing on grid refinement, upscaling/coarsening approaches, pressure interference between site models within a regional aquifer, and faster debugging of numerical issues in large models).

![Graphical representation of pycopm's functionality ([here](https://cssr-tools.github.io/pycopm/examples.html#graphical-abstract) are details to reproduce this).](paper.png){ width=100% }

# Statement of need

Simulation models can be substantial, typically encompassing millions of cells, and can be quite complex due to the number of wells and faults, defined by cell indices in the x, y and z direction (i,j,k nomenclature). While manually modifying small input decks is feasible, it becomes impractical for large models. [ResInsight](https://resinsight.org) is an open-source C++ tool designed for postprocessing reservoir models and simulations. It provides capabilities to export simulation models, including grid refinements and submodels. However, to the author's knowledge, the main input deck with the modified i,j,k locations is not generated, and there is no build-in functionality to coarsen models or apply general afine transformations. Additionally, the installation of ResInsight for macOS users is not straightforward, and the tool struggles with models that have small grid sizes (below 1 mm) and cases with a large number of cells (over 100 million). These challenges inspired the development of `pycopm`, a user-friendly Python tool designed to taylor geological models from provided input decks.
Simulation models can be substantial, typically encompassing millions of cells, and can be quite complex due to the number of wells and faults, defined by cell indices in the x, y, and z direction (i,j,k nomenclature). While manually modifying small input decks is feasible, it becomes impractical for large models. In addition, these models commonly rely on corner‑point grids defined through pillars and horizons, and they may include further geometric modifications specified through deck keywords. Such representations are not intuitive to manipulate, particularly for users who are not familiar with the internal structure of simulation decks.


These challenges inspired the development of `pycopm`, a user-friendly Python tool designed to taylor geological models from provided input decks. `pycopm` is intended for researchers, engineers, and students who need to apply model transformations such as coarsening, refinement, submodel extraction, and structural adjustments. The coarsening and refinement capabilities are especially relevant in current workflows, since multi‑fidelity modeling has become an active and widely adopted research direction that requires the flexibility to generate models with different levels of complexity.

# State of the field

[opm-upscaling](https://github.com/OPM/opm-upscaling) is part of the [OPM initiative](https://opm-project.org/?page_id=23), and provides a set of C++ tools focused on single-phase and steady-state upscaling of capillary pressure and relative permeability. However, it does not include functionality for grid refinement or affine transformations, and its upscaling routines operate mainly on the grid structure. As a result, users must manually adjust the remaining components of the deck to match the new i, j, and k indices. Examples include updating the locations of wells, numerical aquifers, and other model elements.


[ResInsight](https://resinsight.org) is an open-source C++ tool designed for postprocessing reservoir models and simulations. It can export modified simulation grids and supports operations such as grid refinement and submodel extraction. Nevertheless, it does not generate an updated input deck reflecting the modified i, j, and k coordinates. It also lacks built-in capabilities for model coarsening or for applying general affine transformations. Users on macOS may encounter installation challenges, and the software has difficulty handling models with very small cell dimensions (below 1 mm) or with very large cell counts (greater than 100 million).


To the author's knowledge, prior to the development of `pycopm` there was no integrated Python-based solution that combined coarsening, refinement, submodel extraction, and geometric transformations for modifying geological models compatible with OPM Flow. Python offers a significantly more accessible environment than C++, which lowers the entry barrier for researchers, engineers, and students who need flexible model manipulation tools.

# Software design

Expand All @@ -38,6 +51,9 @@ Two key properties in a reservoir model are its storage capacity, measured by po

`pycopm` leverages well-stablished and excellent Python libraries. The Python package numpy [@2020NumPy-Array] forms the basis for performing arrays operations. The pandas package [@the_pandas_development_team], is used for handling cell clusters, specifically employing the methods in pandas.Series.groupby. The Shapely package [@Gillies_Shapely_2025], particularly the contains_xy, is fundamental for submodel implementation to locate grid cells within a given polygon. To parse the output binary files of OPM Flow, the [opm](https://pypi.org/project/opm/) Python libraries is utilized. The primary methods developed in `pycopm` include handling of corner-point grids, upscaling transmissibilities in complex models with faults (non-neighbouring connections) and inactive cells, projecting pore volumes on submodel boundaries, interpolating to extend definition of i,j,k dependent properties (e.g., wells, faults) in grid refinement, and parsing and writing input decks.


Interaction with the tool is performed through a terminal executable named `pycopm`, which provides a set of command-line flags (27 at the time of writing; see the online documentation for the [current list](https://cssr-tools.github.io/pycopm/introduction.html#overview)). These flags control the desired functionality, such as specifying the input deck, defining how the model should be modified, and selecting the output file name. This design enables users to chain multiple operations by further editing the generated decks. For example, a user may refine a model first and subsequently extract a submodel. An illustrative example is provided in [test_4_submodel.py](https://github.com/cssr-tools/pycopm/blob/main/tests/test_4_submodel.py) in the project repository. Advanced users who are familiar with Python can access the underlying functionality directly through Python scripts. This provides greater flexibility for integrating the tool into more sophisticated workflows and for customizing model transformations to meet specific research or engineering needs.

# Research impact statement

`pycopm` is intended for researchers, engineers, and students, and is already being adopted across several projects at NORCE Research AS and Equinor ASA. The user base is growing, with increased activity observed across multiple locations. GitHub traffic insights also show a steady rise in repository clones, indicating expanding interest and usage.
Expand Down