Skip to content

Commit 47f2b44

Browse files
authored
Merge pull request #163 from daavid00/dev
Modernizing the docs and terminal output
2 parents 1051ed3 + 555dc88 commit 47f2b44

329 files changed

Lines changed: 74437 additions & 11625 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,16 @@ dune-*
173173
opm-*
174174

175175
# Examples outputs
176-
cssr
177-
debugging
178-
developing
179-
playground
180-
project
181-
examples/spe11b
176+
/cssr
177+
/debugging
178+
/developing
179+
/playground
180+
/project
181+
/examples/spe11b
182+
/my_spe11b
183+
/my_spe11b.toml
184+
/my_spe11b_co2m_i,1,k_t5.png
182185

183186
# Tests
184-
test_outputs
187+
/test_outputs
185188
tests/decks/spe11c/r2_cp_50m-50m-8mish/GRID.INC

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![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)
33
[![Build Status](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_windows.yml/badge.svg)](https://github.com/OPM/pyopmspe11/actions/workflows/ci_pyopmspe11_windows.yml)
44
[![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)
5-
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.11%20to%203.14-blue.svg"></a>
5+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.12%20to%203.14-blue.svg"></a>
66
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
77
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/license/mit/)
88
[![DOI](https://joss.theoj.org/papers/10.21105/joss.07357/status.svg)](https://doi.org/10.21105/joss.07357)
@@ -21,15 +21,13 @@ To install the _pyopmspe11_ executable from the development version:
2121
pip install git+https://github.com/OPM/pyopmspe11.git
2222
```
2323

24-
If you are interested in a specific version (e.g., v2026.04) or in modifying the source code, then you can clone the repository and install the Python requirements in a virtual environment with the following commands:
24+
If you are interested in modifying the source code, then you can clone the repository and install the Python requirements in a virtual environment with the following commands:
2525

2626
```bash
2727
# Clone the repo
2828
git clone https://github.com/OPM/pyopmspe11.git
2929
# Get inside the folder
3030
cd pyopmspe11
31-
# For a specific version (e.g., v2026.04), or skip this step (i.e., edge version)
32-
git checkout v2026.04
3331
# Create virtual environment (to specific Python, python3.14 -m venv vpyopmspe11)
3432
python3 -m venv vpyopmspe11
3533
# Activate virtual environment

convergence/convergence.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def run_command(command, wait=True):
6868
vals = int(np.ceil(len(SIZES) / 2))
6969
cols = int(2.5 * vals)
7070
run_command(
71-
f"plopm -i '{names.strip()}' -save {DOMAIN}_spatial_map_all -z 0 -v xco2l "
72-
f"-c cet_CET_CBTL1_r -clabel 'mass fraction of CO2 in liquid [-]' -d 16,{cols} "
73-
f"-cformat .2e -subfigs {vals},2 -cbsfax 0.35,0.97,0.3,0.02 -delax 1 -suptitle 0 "
71+
f"plopm -i '{names.strip()}' -fn {DOMAIN}_spatial_map_all -asp 0 -v xco2l "
72+
f"-c cet_CET_CBTL1_r -cbl 'mass fraction of CO2 in liquid [-]' -fs 16,{cols} "
73+
f"-cbf .2e -sg {vals},2 -cbp 0.35,0.97,0.3,0.02 -rdl 1 -st 0 "
7474
f"-t '{legend.strip()}'"
7575
)
7676

@@ -80,16 +80,16 @@ def run_command(command, wait=True):
8080
case_name = f"{DOMAIN}_cp{index}-z{size}mish-x{size}m"
8181
parallel_command += (
8282
f"plopm -i {case_name}/{case_name.upper()} "
83-
+ f"-save {DOMAIN}_spatial_map_{case_name} -z 0 -v xco2l "
84-
+ "-clabel 'mass fraction of CO2 in liquid [-]' -remove 1,1,1,1 "
85-
+ "-c cet_CET_CBTL1_r -d 16,5 -cformat .2e -b '[0,6.36e-2]' & "
83+
+ f"-fn {DOMAIN}_spatial_map_{case_name} -asp 0 -v xco2l "
84+
+ "-cbl 'mass fraction of CO2 in liquid [-]' -hide 1,1,1,1 "
85+
+ "-c cet_CET_CBTL1_r -fs 16,5 -cbf .2e -cl '[0,6.36e-2]' & "
8686
)
8787
run_command(parallel_command + "wait")
8888

8989
# Example of plotting a time series variable (from simulation files .SMSPEC)
9090
run_command(
91-
f"plopm -i '{names.strip()}' -v {QUANTITY} -save {DOMAIN}_{QUANTITY} -ylabel "
92-
f"'{QUANTITY} [s]' -tunits y -labels '{legend.strip()}' -xformat .0f -e solid -lw 4"
91+
f"plopm -i '{names.strip()}' -v {QUANTITY} -fn {DOMAIN}_{QUANTITY} -yl "
92+
f"'{QUANTITY} [s]' -tu y -llb '{legend.strip()}' -xf .0f -ls solid -lw 4"
9393
)
9494

9595
# Time series from CSV files
@@ -126,9 +126,9 @@ def run_command(command, wait=True):
126126
)
127127
variable = quantities[column_index].split(" ")[0]
128128
run_command(
129-
f"plopm -i '{input_names.strip()}' -c '{COLORS}' -csv '1,{column_index + 1}' "
130-
f"-save {DOMAIN}_{variable} -ylabel '{quantities[column_index]}' "
131-
f"-tunits y -labels '{case_legend.strip()}' -xformat .0f -e solid -lw 4"
129+
f"plopm -i '{input_names.strip()}' -c '{COLORS}' -cc '1,{column_index + 1}' "
130+
f"-fn {DOMAIN}_{variable} -yl '{quantities[column_index]}' "
131+
f"-tu y -llb '{case_legend.strip()}' -xf .0f -ls solid -lw 4"
132132
)
133133

134134
# Get the SPE11B benchmark data from the participants to compare our results
@@ -202,9 +202,9 @@ def run_command(command, wait=True):
202202
participant_names += f"{DOMAIN}_cp{index}-z{size}mish-x{size}m/spe11b_time_series "
203203
participant_colors += f"{COLORS.split(',')[index]},"
204204
run_command(
205-
f"plopm -i '{participant_names.strip()}' -csv '1,3' -c '{participant_colors.strip(',')}' "
206-
f"-save {DOMAIN}_mobA_adding_participants -y '[2.1e7,4e7]' -ylabel 'mobA [kg]' -tunits y "
207-
"-loc empty -xlog 1 -e solid -lw 2"
205+
f"plopm -i '{participant_names.strip()}' -cc '1,3' -c '{participant_colors.strip(',')}' "
206+
f"-fn {DOMAIN}_mobA_adding_participants -y '[2.1e7,4e7]' -yl 'mobA [kg]' -tu y "
207+
"-ll empty -xlog 1 -ls solid -lw 2"
208208
)
209209

210210
# Spatial maps into a single figure adding all SPE11B participants (from csvs)
@@ -221,8 +221,9 @@ def run_command(command, wait=True):
221221
grid_x = int(8 + np.ceil((len(SIZES) - 1) / 5))
222222
grid_y = int(15.5 + 2.5 * np.floor(len(SIZES) / 2))
223223
run_command(
224-
f"plopm -i '{map_names.strip()}' -csv '1,2,9' -save {DOMAIN}_spatial_map_adding_participants "
225-
"-z 0 -f 24 -b '[0,5e3]' -clabel 'total CO$_2$ mass [kg] at 500 years' -c cet_CET_CBTL1_r -d "
226-
f"60,{grid_y} -cformat .2e -subfigs {grid_x},5 -cbsfax 0.35,0.97,0.3,0.02 -delax 1 "
227-
f"-suptitle 0 -t '{map_titles.strip()}'"
224+
f"plopm -i '{map_names.strip()}' -cc '1,2,9' -fn {DOMAIN}_spatial_map_adding_participants "
225+
"-asp 0 -fz 24 -cl '[0,5e3]' -cbl 'total CO$_2$ mass [kg] at 500 years' "
226+
"-c cet_CET_CBTL1_r -fs "
227+
f"60,{grid_y} -cbf .2e -sg {grid_x},5 -cbp 0.35,0.97,0.3,0.02 -rdl 1 "
228+
f"-st 0 -t '{map_titles.strip()}'"
228229
)

dev-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
black
2+
numpydoc
23
mypy
4+
pydata_sphinx_theme
35
pylint
46
pytest-cov
57
pytest-xdist
68
ruff
79
sphinx
10+
sphinx_copybutton
11+
sphinx_design
812
sphinx-rtd-theme

docs/Makefile

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
# Minimal makefile for Sphinx documentation
2-
#
1+
SPHINXOPTS ?=
2+
SPHINXBUILD ?= sphinx-build
3+
SOURCEDIR = text
4+
BUILDDIR = _build
5+
APIDIR = text/api
36

4-
# You can set these variables from the command line, and also
5-
# from the environment for the first two.
6-
SPHINXOPTS =
7-
SPHINXBUILD = sphinx-build
8-
SOURCEDIR = text
9-
BUILDDIR = _build
7+
.PHONY: help clean api html linkcheck github
108

11-
# Put it first so that "make" without argument is like "make help".
129
help:
1310
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1411

15-
.PHONY: help Makefile
12+
clean:
13+
rm -rf "$(BUILDDIR)"
1614

17-
# Catch-all target: route all unknown targets to Sphinx using the new
18-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19-
%: Makefile
20-
sphinx-apidoc --private -e -f -o text ../src/pyopmspe11
21-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
15+
api:
16+
@mkdir -p "$(APIDIR)"
17+
sphinx-apidoc --private -e -f -o "$(APIDIR)" ../src/pyopmspe11
2218

23-
github:
24-
@make html
25-
cp -a _build/html/. .
19+
html: api
20+
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
linkcheck:
23+
@$(SPHINXBUILD) -M linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
24+
25+
github: html
26+
cp -a "$(BUILDDIR)/html/." .

docs/_images/cap.png

289 KB
Loading

docs/_images/contents.png

-17 KB
Loading

docs/_images/kr.png

528 KB
Loading
156 KB
Loading

docs/_images/output.png

396 KB
Loading

0 commit comments

Comments
 (0)