Skip to content

Commit ef84fee

Browse files
authored
Merge pull request #152 from daavid00/dev
Updating Dockerfile and CI
2 parents 9635c2a + fbdce34 commit ef84fee

24 files changed

Lines changed: 144 additions & 109 deletions
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-pyopmspe11-docker:
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
timeout-minutes: 60
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Build Docker image
21+
run: docker build -t test-image .
22+
23+
- name: Run a simple example using pyopmspe11
24+
run: |
25+
docker run --rm \
26+
-u root \
27+
-v ${{ github.workspace }}:/workspace \
28+
-w /workspace \
29+
test-image \
30+
bash -c "
31+
pyopmspe11 -i examples/spe11b.toml \
32+
-o spe11b -m deck_flow -f 0
33+
"
34+
35+
- name: Check if the example run
36+
run: |
37+
file="${{ github.workspace }}/spe11b/SPE11B.UNRST"
38+
if [ -f "$file" ]; then
39+
echo "pyopmspe11 succeeded"
40+
else
41+
echo "pyopmspe11 failed"
42+
exit 1
43+
fi
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: macOS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-pyopmspe11-macos:
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
timeout-minutes: 60
14+
runs-on: macos-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install OPM Flow
21+
run: |
22+
brew install cssr-tools/opm/opm-simulators
23+
24+
- name: Install python requirements
25+
run: |
26+
python3 -m venv vpyopmspe11
27+
. vpyopmspe11/bin/activate
28+
echo "$PWD/vpyopmspe11/bin" >> $GITHUB_PATH
29+
pip install --upgrade pip setuptools wheel
30+
pip install -e .
31+
pip install -r dev-requirements.txt
32+
33+
- name: Run a simple example using pyopmspe11
34+
run: |
35+
pyopmspe11 -i examples/spe11b.toml -o spe11b -m deck_flow -f 0
36+
37+
- name: Check if the example run
38+
run: |
39+
file="${{ github.workspace }}/spe11b/SPE11B.UNRST"
40+
if [ -f "$file" ]; then
41+
echo "pyopmspe11 succeeded"
42+
else
43+
echo "pyopmspe11 failed"
44+
exit 1
45+
fi

.github/workflows/CI.yml renamed to .github/workflows/ci_pyopmspe11_ubuntu.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
name: Run pyopmspe11
1+
name: Ubuntu
22

33
on:
4-
push:
5-
branches:
6-
- main
74
pull_request:
85

96
jobs:
10-
run-pyopmspe11-local:
7+
run-pyopmspe11-ubuntu:
118
permissions:
129
contents: read
1310
pull-requests: write
1411
timeout-minutes: 60
1512
runs-on: ubuntu-latest
1613

1714
steps:
18-
- uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
2117

2218
- name: Set up Python 3.12
2319
uses: actions/setup-python@v2
@@ -45,14 +41,14 @@ jobs:
4541
4642
- name: Check code style and linting
4743
run: |
48-
black --target-version py312 --check src/ tests/ convergence/
44+
black --target-version py312 src/ tests/ convergence/ --check
4945
pylint src/ tests/ convergence/
5046
ruff check src/ tests/ convergence/
5147
mypy --ignore-missing-imports src/ tests/ convergence/
5248
5349
- name: Run the tests
5450
run: |
55-
pytest --cov=pyopmspe11 --exitfirst --cov-report term-missing --basetemp=test_outputs tests/
51+
pytest --cov=pyopmspe11 --cov-report term-missing --basetemp=test_outputs tests/ --exitfirst
5652
5753
- name: Build documentation
5854
run: |

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ghcr.io/astral-sh/uv:0.11.15 AS uv
2+
FROM openporousmedia/opmreleases:2026.04_amd64
3+
4+
USER root
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update \
9+
&& apt-get install -y --no-install-recommends software-properties-common libhdf5-dev git python3 libpython3-dev \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
COPY --from=uv /uv /usr/local/bin/uv
13+
14+
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
15+
ENV UV_CACHE_DIR=/opt/uv/cache
16+
17+
18+
RUN uv python install 3.14 && \
19+
uv venv /opt/venv --python 3.14 && \
20+
uv pip install --python /opt/venv/bin/python git+https://github.com/OPM/pyopmspe11.git
21+
22+
ENV PATH="/opt/venv/bin:${PATH}"
23+
24+
RUN chown -R opm:opm /opt/uv /opt/venv
25+
26+
USER opm
27+
WORKDIR /shared_host

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
[![Build Status](https://github.com/OPM/pyopmspe11/actions/workflows/CI.yml/badge.svg)](https://github.com/OPM/pyopmspe11/actions/workflows/CI.yml)
1+
[![Build Status](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_ubuntu.yml/badge.svg)](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_ubuntu.yml)
2+
[![Build Status](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_macos.yml/badge.svg)](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_macos.yml)
3+
[![Build Status](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_docker.yml/badge.svg)](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_docker.yml)
24
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.11%20to%203.14-blue.svg"></a>
35
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
46
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/license/mit/)

dockers/README.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

dockers/opm-spe11csp-ubuntu.Dockerfile

Lines changed: 0 additions & 38 deletions
This file was deleted.

docs/_sources/contributing.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Contribute to the software
3030
#. **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 delete all content from the `docs <https://github.com/cssr-tools/pyopmspe11/tree/main/docs>`_ folder except `Makefile <https://github.com/OPM/pyopmspe11/blob/main/docs/Makefile>`_, `text <https://github.com/OPM/pyopmspe11/blob/main/docs/text>`_, and `.nojekyll <https://github.com/OPM/pyopmspe11/blob/main/docs/.nojekyll>`_, after copy all contents from the docs/_build/html/ folder, and finally paste them in the `docs <https://github.com/cssr-tools/pyopmspe11/tree/main/docs>`_ folder)
3131

3232
.. tip::
33-
See the `CI.yml <https://github.com/cssr-tools/pyopmspe11/blob/main/.github/workflows/CI.yml>`_ script and the `Actions <https://github.com/cssr-tools/pyopmspe11/actions>`_ for installation of pyopmspe11, OPM Flow (binary packages), and dependencies, as well as the execution of the six previous steps in Ubuntu 24.04 using Python 3.12.
33+
See the `ci_pyopmspe11_ubuntu.yml <https://github.com/cssr-tools/pyopmspe11/blob/main/.github/workflows/ci_pyopmspe11_ubuntu.yml>`_ script and the `Actions <https://github.com/cssr-tools/pyopmspe11/actions>`_ for installation of pyopmspe11, OPM Flow (binary packages), and dependencies, as well as the execution of the six previous steps in Ubuntu 24.04 using Python 3.12.
3434
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 (a related tool to pyopmspe11), OPM Flow (source build), and dependencies in macOS 26 using Python 3.13.
3535
In addition for macOS, you need to add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pyopmspe11/build/opm-simulators/bin).
3636

docs/_sources/convergence.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ In general to generate a GIF and compare results, **plopm** can also be used. Fo
5454

5555
.. code-block:: bash
5656
57-
plopm -i 'spe11b/opm4/spe11b_spatial_map_PLOPMy spe11b/cau-kiel1/spe11b_spatial_map_PLOPMy' -r 0:1000:25 -csv '1,2,5' -m gif -interval 1000 -loop 1 -subfigs 2,1 -tunits years -t 'OPM4 CAU-KIEL1' -c cet_CET_CBTL1_r -clabel 'CO$_2$ mass fraction in liquid [-]' -cbsfax 0.35,0.87,0.3,0.02 -delax 1
57+
plopm -i 'spe11b/opm4/spe11b_spatial_map_PLOPMy spe11b/cau-kiel1/spe11b_spatial_map_PLOPMy' -r 0:1000:25 -csv '1,2,5' -m gif -interval 1000 -loop 1 -subfigs 2,1 -tunits y -t 'OPM4 CAU-KIEL1' -c cet_CET_CBTL1_r -clabel 'CO$_2$ mass fraction in liquid [-]' -cbsfax 0.35,0.87,0.3,0.02 -delax 1
5858
5959
.. image:: figs/csv.gif
6060

docs/_sources/examples.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Cp grids (11 and 18 levels)
7171
In a `recent paper <https://link.springer.com/article/10.1007/s11242-025-02275-0>`_ to history match the FluidFlower data using the laboratory images, a more regular coner-point grid
7272
was used consisting in 11 levels instead of 18 as the submitted results for the SPE11 benchmark. Then, the corner-point grid from that paper has been included in the
7373
**pyopmspe11** tool. To use this corner-point grid, then one needs to give an array of size 11 for the variable "z_n" in the toml files. For example, in the
74-
`spe11b.toml <https://github.com/OPM/pyopmspe11/blob/main/examples/spe11b.toml>`_ in the examples folder, setting z_n to [3, 2, 2, 2, 3, 2, 2, 8, 4, 8, 8, 1] and
74+
`spe11b.toml <https://github.com/OPM/pyopmspe11/blob/main/examples/spe11b.toml>`_ in the examples folder, setting z_n to [2, 2, 2, 3, 2, 2, 8, 4, 8, 8, 1] and
7575
saving the configuration file as spe11b_11-levels.toml, running them (we add the flag **-f 0** to generate the deck and simulation files in the output folder, i.e., no subfolders deck and flow), and using **plopm** to generate the figure:
7676

7777
.. code-block:: bash

0 commit comments

Comments
 (0)