Skip to content

Commit e6372a8

Browse files
committed
Python opm now available for macOS
1 parent 333f8ec commit e6372a8

34 files changed

+85
-228
lines changed

.github/workflows/ci_pycopm_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
4444
- name: Install pycopm
4545
run: |
46-
pip install -e .[opm]
46+
pip install -e .
4747
4848
- name: Check code style and linting
4949
run: |

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ Contributions are more than welcome using the fork and pull request approach
1313
1. Work on your own fork of the main repo
1414
1. In the main repo execute:
1515
1. **pip install -r dev-requirements.txt** (this installs the [_dev-requirements.txt_](https://github.com/cssr-tools/pycopm/blob/main/dev-requirements.txt))
16-
1. **pip install opm** (this does not work in macOS, then follow the steps in [_source build in macOS_](https://cssr-tools.github.io/pycopm/installation.html#source-build-in-macos))
1716
1. **black src/ tests/** (this formats the code)
1817
1. **pylint src/ tests/** (this analyses the code, and might rise issues that need to be fixed before the pull request)
1918
1. **mypy --ignore-missing-imports src/ tests/** (this is a static checker, and might rise issues that need to be fixed before the pull request)
2019
1. **pytest --cov=pycopm --cov-report term-missing tests/** (this runs locally the tests, and might rise issues that need to be fixed before the pull request)
2120
1. **pycopm -i examples/decks/HELLO_WORLD.DATA -c 5,5,1 -m all -o output** (this runs the hello world example, which succeeds if the file output/HELLO_WORLD_PYCOPM.EGRID is created)
2221
1. **pushd docs & make html** (this generates the documentation, and might rise issues that need to be fixed before the pull request; if the build succeeds and if the contribution changes the documentation, then copy all content from the docs/_build/html/ folder and replace the files in the [_docs_](https://github.com/cssr-tools/pycopm/tree/main/docs) folder)
23-
* Tip for Linux users: See the [_ci_pycopm_ubuntu.yml_](https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml) script and the [_Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the eight previous steps in Ubuntu 24.04 using Python 3.11.
22+
* Tip for Linux users: See the [_ci_pycopm_ubuntu.yml_](https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml) script and the [_Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.11.
2423
* Tip for macOS users: See the [_ci_pycopm_macos_.yml_](https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml) script and the [_OPM-Flow_macOS Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.13. Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/--flow** (see [_ci_pycopm_macos.yml_](https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L76)).
2524
1. Squash your commits into a single commit (see this [_nice tutorial_](https://gist.github.com/lpranam/4ae996b0a4bc37448dc80356efbca7fa) if you are not familiar with this)
2625
1. Push your commit and make a pull request

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Creation of OPM Flow geological models from provided input decks with options fo
1212

1313
## Installation
1414
You will first need to install
15-
* OPM Flow (https://opm-project.org, Release 2025.04 or current master branches)
15+
* OPM Flow (https://opm-project.org, Release 2025.10 or current master branches)
1616

1717
To install the _pycopm_ executable from the development version:
1818

@@ -41,7 +41,7 @@ pip install -e .
4141
pip install -r dev-requirements.txt
4242
```
4343

44-
See the [_installation_](https://cssr-tools.github.io/pycopm/installation.html) for further details on building OPM Flow from the master branches in Linux, Windows (via [_WSL_](https://learn.microsoft.com/en-us/windows/wsl/)), and macOS, as well as the (optional) [_opm Python package_](https://pypi.org/project/opm/).
44+
See the [_installation_](https://cssr-tools.github.io/pycopm/installation.html) for further details on building OPM Flow from the master branches in Linux, Windows (via [_WSL_](https://learn.microsoft.com/en-us/windows/wsl/)), and macOS.
4545

4646
## Running pycopm
4747
You can run _pycopm_ as a single command line:

docs/_images/pofff.png

1.91 MB
Loading

docs/_sources/contributing.rst.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Contribute to the software
2222
#. In the main repo execute:
2323

2424
#. **pip install -r dev-requirements.txt** (this installs the `dev-requirements.txt <https://github.com/cssr-tools/pycopm/blob/main/dev-requirements.txt>`_)
25-
#. **pip install opm** (this does not work in macOS, then follow the steps in `source build in macOS <https://cssr-tools.github.io/pycopm/installation.html#source-build-in-macos>`_)
2625
#. **black src/ tests/** (this formats the code)
2726
#. **pylint src/ tests/** (this analyses the code, and might rise issues that need to be fixed before the pull request)
2827
#. **mypy --ignore-missing-imports src/ tests/** (this is a static checker, and might rise issues that need to be fixed before the pull request)
@@ -31,9 +30,9 @@ Contribute to the software
3130
#. **pushd docs & make html** (this generates the documentation, and might rise issues that need to be fixed before the pull request; if the build succeeds and if the contribution changes the documentation, then copy all content from the docs/_build/html/ folder and replace the files in the `docs <https://github.com/cssr-tools/pycopm/tree/main/docs>`_ folder)
3231

3332
.. tip::
34-
See the `ci_pycopm_ubuntu.yml <https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml>`_ script and the `Actions <https://github.com/cssr-tools/pycopm/actions>`_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the eight previous steps in Ubuntu 24.04 using Python 3.11.
33+
See the `ci_pycopm_ubuntu.yml <https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml>`_ script and the `Actions <https://github.com/cssr-tools/pycopm/actions>`_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.11.
3534
For macOS users, see the `ci_pycopm_macos.yml <https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml>`_ script and the `OPM-Flow_macOS Actions <https://github.com/cssr-tools/pycopm/actions>`_ for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.13.
36-
Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/--flow** (see `this script <https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L76>`_).
35+
Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/--flow** (see `this script <https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L72>`_).
3736

3837
#. Squash your commits into a single commit (see this `nice tutorial <https://gist.github.com/lpranam/4ae996b0a4bc37448dc80356efbca7fa>`_ if you are not familiar with this)
3938
#. Push your commit and make a pull request

docs/_sources/installation.rst.txt

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,13 @@ OPM Flow
5050
--------
5151
You also need to install:
5252

53-
* OPM Flow (https://opm-project.org, Release 2025.04 or current master branches)
53+
* OPM Flow (https://opm-project.org, Release 2025.10 or current master branches)
5454

5555
.. tip::
5656

5757
See the `ci_pycopm_ubuntu.yml <https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml>`_ script
5858
for installation of OPM Flow (binary packages) and the pycopm package in Ubuntu.
5959

60-
.. note::
61-
62-
For not macOS users, to install the optional Python opm package (this is an alternative
63-
to `resdata <https://github.com/equinor/resdata>`_, both are use to read OPM output files; while resdata is easier to
64-
install in macOS, opm seems to be faster; the default is `-u resdata`), execute in the terminal
65-
66-
**pip install opm**
67-
68-
This is equivalent to execute **pip install -e .[opm]** in the installation process.
69-
70-
For macOS users, see :ref:`macOS`.
71-
7260
Source build in Linux/Windows
7361
+++++++++++++++++++++++++++++
7462
If you are a Linux user (including the Windows subsystem for Linux, see `this link <https://learn.microsoft.com/en-us/windows/python/web-frameworks>`_
@@ -109,16 +97,12 @@ with brew the prerequisites can be installed by:
10997

11098
.. code-block:: console
11199
112-
brew install boost@1.85 cmake openblas suite-sparse python@3.13
113-
114-
.. note::
115-
boost 1.89.0 was made available recently (August 14th, 2025), which it is not compatible with OPM Flow (yet).
116-
Then, we install boost 1.85, and add the cmake path to the boost include folder, as shown in the bash lines below.
100+
brew install boost openblas suite-sparse python@3.13 cmake
117101
118102
In addition, it is recommended to uprade and update your macOS to the latest available versions (the following steps have
119103
worked for macOS Tahoe 26.0.1 with Apple clang version 17.0.0).
120104
After the prerequisites are installed and the vpyocpm Python environment is created (see :ref:`vpycopm`),
121-
then building OPM Flow and the opm Python package can be achieved with the following bash lines:
105+
then building OPM Flow can be achieved with the following bash lines:
122106

123107
.. code-block:: console
124108
@@ -139,31 +123,21 @@ then building OPM Flow and the opm Python package can be achieved with the follo
139123
do git clone https://github.com/OPM/opm-$repo.git
140124
mkdir build/opm-$repo
141125
cd build/opm-$repo
142-
cmake -DPYTHON_EXECUTABLE=$(which python) -DOPM_ENABLE_PYTHON=ON -DWITH_NDEBUG=1 -DUSE_MPI=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/opt/homebrew/opt/boost@1.85/include;$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
143-
if [[ $repo == common ]]; then
144-
make -j5 opm$repo
145-
make -j5 opmcommon_python
146-
elif [[ $repo == simulators ]]; then
126+
cmake -DUSE_MPI=0 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
127+
if [[ $repo == simulators ]]; then
147128
make -j5 flow
148129
else
149130
make -j5 opm$repo
150131
fi
151132
cd ../..
152133
done
153134
154-
echo "export PYTHONPATH=\$PYTHONPATH:$CURRENT_DIRECTORY/build/opm-common/python" >> $CURRENT_DIRECTORY/vpycopm/bin/activate
155135
echo "export PATH=\$PATH:$CURRENT_DIRECTORY/build/opm-simulators/bin" >> $CURRENT_DIRECTORY/vpycopm/bin/activate
156136
157137
deactivate
158138
source vpycopm/bin/activate
159139
160-
This builds OPM Flow as well as the OPM Python library, and it exports the required PYTHONPATH to the opm Python package and the path to the flow executable.
161-
162-
.. note::
163-
You can test if flow works by typing in the terminal `./build/opm-simulators/bin/flow --help`. In addition, you can add `build/opm-simulators/bin` to your path
164-
to execute it as flow. You can also test that the Python package opm works by executing `python -c "import opm"`. If for any reason the installation of the Python
165-
opm package was not sucessful, still all functionality of **pycopm** is available, just do not execute **pycopm** with the flag `-u opm` (see the note in
166-
:ref:`opmflow` for a brief comment about the Python packages resdata and opm).
140+
This builds OPM Flow, and it exports the path to the flow executable.
167141

168142
.. tip::
169143
See `this repository <https://github.com/daavid00/OPM-Flow_macOS>`_ dedicated to build OPM Flow from source in the latest macOS (GitHub actions), and tested with **pycopm**.

docs/_sources/introduction.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ where
5959
-e Use 'utf8' or 'ISO-8859-1' encoding to read the deck ('ISO-8859-1' by default).
6060
-ijk Given i,j,k indices in the input model, return the modified i,j,k corresponding positions ('' by default; if not empty, e.g., '1,2,3', then there will not be generation of modified files, only the i,j,k mapped indices in the terminal).
6161
-d Options to transform the x,y,z coordinates: 'translate [10,-5,4]' adds the values in meters to the coordinates, 'scale [1,2,3]' multiplies the coordinates by the given values respectively, and 'rotatexy 45' applies a rotation in degrees in the xy plane (rotatexz and rotateyz applies a rotation around the y and x axis respectively) ('' by default).
62-
-u Use the resdata or opm Python libraries ('resdata' by default).
62+
-u Use the resdata or opm Python libraries ('opm' by default).
6363
-explicit Set to 1 to explicitly write the cell values in the SOLUTION section in the deck ('0' by default).
6464
-warnings Set to 1 to show Python warnings ('0' by default).

docs/_sources/related.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ pyopmspe11
1313

1414
`A Python framework using OPM Flow for the CSP SPE11 benchmark project <https://github.com/OPM/pyopmspe11>`_.
1515

16+
*****
17+
pofff
18+
*****
19+
20+
.. image:: ./figs/pofff.png
21+
22+
`An image-based history-matching framework for the FluidFlower Benchmark using OPM Flow <https://github.com/cssr-tools/pofff>`_.
23+
1624
*************
1725
pyopmnearwell
1826
*************

docs/contributing.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ <h2>Contribute to the software<a class="headerlink" href="#contribute-to-the-sof
108108
<blockquote>
109109
<div><ol class="arabic simple">
110110
<li><p><strong>pip install -r dev-requirements.txt</strong> (this installs the <a class="reference external" href="https://github.com/cssr-tools/pycopm/blob/main/dev-requirements.txt">dev-requirements.txt</a>)</p></li>
111-
<li><p><strong>pip install opm</strong> (this does not work in macOS, then follow the steps in <a class="reference external" href="https://cssr-tools.github.io/pycopm/installation.html#source-build-in-macos">source build in macOS</a>)</p></li>
112111
<li><p><strong>black src/ tests/</strong> (this formats the code)</p></li>
113112
<li><p><strong>pylint src/ tests/</strong> (this analyses the code, and might rise issues that need to be fixed before the pull request)</p></li>
114113
<li><p><strong>mypy –ignore-missing-imports src/ tests/</strong> (this is a static checker, and might rise issues that need to be fixed before the pull request)</p></li>
@@ -118,9 +117,9 @@ <h2>Contribute to the software<a class="headerlink" href="#contribute-to-the-sof
118117
</ol>
119118
<div class="admonition tip">
120119
<p class="admonition-title">Tip</p>
121-
<p>See the <a class="reference external" href="https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml">ci_pycopm_ubuntu.yml</a> script and the <a class="reference external" href="https://github.com/cssr-tools/pycopm/actions">Actions</a> for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the eight previous steps in Ubuntu 24.04 using Python 3.11.
120+
<p>See the <a class="reference external" href="https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml">ci_pycopm_ubuntu.yml</a> script and the <a class="reference external" href="https://github.com/cssr-tools/pycopm/actions">Actions</a> for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.11.
122121
For macOS users, see the <a class="reference external" href="https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml">ci_pycopm_macos.yml</a> script and the <a class="reference external" href="https://github.com/cssr-tools/pycopm/actions">OPM-Flow_macOS Actions</a> for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.13.
123-
Note that if you do not add the directory containing the OPM Flow executable to your system’s PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags <strong>-f/–flow</strong> (see <a class="reference external" href="https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L76">this script</a>).</p>
122+
Note that if you do not add the directory containing the OPM Flow executable to your system’s PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags <strong>-f/–flow</strong> (see <a class="reference external" href="https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L72">this script</a>).</p>
124123
</div>
125124
</div></blockquote>
126125
</li>

docs/genindex.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ <h2 id="G">G</h2>
176176
<h2 id="H">H</h2>
177177
<table style="width: 100%" class="indextable genindextable"><tr>
178178
<td style="width: 33%; vertical-align: top;"><ul>
179+
<li><a href="pycopm.utils.parser_deck.html#pycopm.utils.parser_deck.handle_aquancon">handle_aquancon() (in module pycopm.utils.parser_deck)</a>
180+
</li>
179181
<li><a href="pycopm.utils.parser_deck.html#pycopm.utils.parser_deck.handle_aqucon">handle_aqucon() (in module pycopm.utils.parser_deck)</a>
180182
</li>
181183
<li><a href="pycopm.utils.parser_deck.html#pycopm.utils.parser_deck.handle_aqunum">handle_aqunum() (in module pycopm.utils.parser_deck)</a>

0 commit comments

Comments
 (0)