runsim 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runsim-0.1.0/.github/workflows/publish.yml +42 -0
- runsim-0.1.0/.github/workflows/test.yml +38 -0
- runsim-0.1.0/.gitignore +18 -0
- runsim-0.1.0/.pre-commit-config.yaml +7 -0
- runsim-0.1.0/LICENSE +21 -0
- runsim-0.1.0/PKG-INFO +259 -0
- runsim-0.1.0/README.md +250 -0
- runsim-0.1.0/pyproject.toml +24 -0
- runsim-0.1.0/runsim/__init__.py +8 -0
- runsim-0.1.0/runsim/base.py +76 -0
- runsim-0.1.0/runsim/dumux.py +71 -0
- runsim-0.1.0/runsim/opm.py +93 -0
- runsim-0.1.0/runsim.sh +137 -0
- runsim-0.1.0/simulators/common.sh +28 -0
- runsim-0.1.0/simulators/dumux/Dockerfile +69 -0
- runsim-0.1.0/simulators/dumux/README.md +45 -0
- runsim-0.1.0/simulators/dumux/install.sh +216 -0
- runsim-0.1.0/simulators/dumux/run.sh +56 -0
- runsim-0.1.0/simulators/jutuldarcy/README.md +44 -0
- runsim-0.1.0/simulators/jutuldarcy/install.sh +233 -0
- runsim-0.1.0/simulators/jutuldarcy/run.sh +173 -0
- runsim-0.1.0/simulators/opm/Dockerfile +23 -0
- runsim-0.1.0/simulators/opm/README.md +56 -0
- runsim-0.1.0/simulators/opm/install-docker.sh +183 -0
- runsim-0.1.0/simulators/opm/install.sh +313 -0
- runsim-0.1.0/simulators/opm/run-docker.sh +145 -0
- runsim-0.1.0/simulators/opm/run.sh +135 -0
- runsim-0.1.0/simulators/pet/README.md +34 -0
- runsim-0.1.0/simulators/pet/install.sh +183 -0
- runsim-0.1.0/simulators/pet/run.sh +269 -0
- runsim-0.1.0/simulators/setup_env.sh +100 -0
- runsim-0.1.0/tests/__init__.py +0 -0
- runsim-0.1.0/tests/test_base.py +103 -0
- runsim-0.1.0/uv.lock +332 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v4
|
|
18
|
+
|
|
19
|
+
- name: Build package
|
|
20
|
+
run: uv build
|
|
21
|
+
|
|
22
|
+
- name: Upload artifacts
|
|
23
|
+
uses: actions/upload-artifact@v4
|
|
24
|
+
with:
|
|
25
|
+
name: dist
|
|
26
|
+
path: dist/
|
|
27
|
+
|
|
28
|
+
publish:
|
|
29
|
+
needs: build
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
environment: pypi
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
steps:
|
|
35
|
+
- name: Download artifacts
|
|
36
|
+
uses: actions/download-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
- name: Publish to PyPI
|
|
42
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v4
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
run: uv python install ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --dev
|
|
31
|
+
|
|
32
|
+
- name: Lint with ruff
|
|
33
|
+
run: |
|
|
34
|
+
uv run ruff check .
|
|
35
|
+
uv run ruff format --check .
|
|
36
|
+
|
|
37
|
+
- name: Test with pytest
|
|
38
|
+
run: uv run pytest
|
runsim-0.1.0/.gitignore
ADDED
runsim-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Roman Manasipov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
runsim-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: runsim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unified interface for running reservoir simulators
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# runsim
|
|
11
|
+
|
|
12
|
+
> **Note:** This package is under active development. APIs and CLI interfaces may change.
|
|
13
|
+
|
|
14
|
+
Unified runner for reservoir simulators, data assimilation, and optimization on macOS.
|
|
15
|
+
|
|
16
|
+
## Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
runsim/
|
|
20
|
+
├── runsim.sh # Unified CLI entry point
|
|
21
|
+
├── pyproject.toml # Python package config (uv + hatchling)
|
|
22
|
+
├── runsim/ # Python package (flat layout)
|
|
23
|
+
│ ├── __init__.py
|
|
24
|
+
│ ├── base.py # Abstract Simulator class
|
|
25
|
+
│ ├── opm.py # OPM Flow wrapper
|
|
26
|
+
│ └── dumux.py # DuMux wrapper (stub)
|
|
27
|
+
├── simulators/
|
|
28
|
+
│ ├── common.sh # Shared helpers + path resolution
|
|
29
|
+
│ ├── setup_env.sh # Create venv, install packages, Docker setup
|
|
30
|
+
│ ├── opm/ # OPM Flow simulator
|
|
31
|
+
│ │ ├── README.md
|
|
32
|
+
│ │ ├── install.sh # Build from source (macOS)
|
|
33
|
+
│ │ ├── install-docker.sh # Install via Docker
|
|
34
|
+
│ │ ├── run.sh # Run bundled test suite (native)
|
|
35
|
+
│ │ ├── run-docker.sh # Run bundled test suite (Docker)
|
|
36
|
+
│ │ └── Dockerfile
|
|
37
|
+
│ ├── pet/ # Python Ensemble Toolbox
|
|
38
|
+
│ │ ├── README.md
|
|
39
|
+
│ │ ├── install.sh # Download repos + pip install
|
|
40
|
+
│ │ └── run.sh # Run PET examples (DA/optimization)
|
|
41
|
+
│ ├── jutuldarcy/ # JutulDarcy simulator
|
|
42
|
+
│ │ ├── README.md
|
|
43
|
+
│ │ ├── install.sh # Install Python/Julia mode
|
|
44
|
+
│ │ └── run.sh # Run simulations
|
|
45
|
+
│ └── dumux/ # DuMux simulator
|
|
46
|
+
│ ├── README.md
|
|
47
|
+
│ ├── install.sh # Build from source (macOS)
|
|
48
|
+
│ ├── run.sh # Run simulations
|
|
49
|
+
│ └── Dockerfile
|
|
50
|
+
└── .venv/ # Python virtual environment (auto-created)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Set up environment (venv + packages + OPM Docker)
|
|
57
|
+
./runsim.sh setup
|
|
58
|
+
|
|
59
|
+
# 2. List available PET examples
|
|
60
|
+
./runsim.sh pet --list
|
|
61
|
+
|
|
62
|
+
# 3. Run an example
|
|
63
|
+
./runsim.sh pet Quadratic # Analytic (no Docker needed)
|
|
64
|
+
./runsim.sh pet 3dBox/tiny # OPM Flow (~2 min)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## CLI
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
./runsim.sh <command> [args...]
|
|
71
|
+
|
|
72
|
+
Commands:
|
|
73
|
+
flow [flow-args...] Run native OPM Flow (passthrough to binary)
|
|
74
|
+
flow-docker [flow-args...] Run OPM Flow via Docker (passthrough)
|
|
75
|
+
jutuldarcy [args...] Run JutulDarcy simulation
|
|
76
|
+
dumux [args...] Run DuMux simulation
|
|
77
|
+
dumux-docker [args...] Run DuMux via Docker
|
|
78
|
+
pet [options] <example> Run PET example (data assimilation / optimization)
|
|
79
|
+
setup Bootstrap environment (venv, PET, Docker)
|
|
80
|
+
help Show help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Running Simulators
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# OPM Flow (native) -- passthrough to flow binary
|
|
87
|
+
./runsim.sh flow --version
|
|
88
|
+
./runsim.sh flow --output-dir=./out SPE1CASE1.DATA
|
|
89
|
+
|
|
90
|
+
# OPM Flow (Docker)
|
|
91
|
+
./runsim.sh flow-docker --version
|
|
92
|
+
./runsim.sh flow-docker --output-dir=./out SPE1CASE1.DATA
|
|
93
|
+
|
|
94
|
+
# JutulDarcy
|
|
95
|
+
./runsim.sh jutuldarcy --test
|
|
96
|
+
./runsim.sh jutuldarcy /path/to/DECK.DATA
|
|
97
|
+
|
|
98
|
+
# DuMux
|
|
99
|
+
./runsim.sh dumux /path/to/executable
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Running PET Examples
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
./runsim.sh pet --list # List available examples
|
|
106
|
+
./runsim.sh pet LinearModel # Analytic DA
|
|
107
|
+
./runsim.sh pet 3dBox/tiny # 10x10x2 grid (~2 min)
|
|
108
|
+
./runsim.sh pet --simulator flow 3dBox/tiny # Native OPM Flow (default)
|
|
109
|
+
./runsim.sh pet --simulator flow-docker 3dBox/tiny # Docker
|
|
110
|
+
./runsim.sh pet 3SpotRobust --variant bhp # Specific variant
|
|
111
|
+
./runsim.sh pet --clean 3dBox/tiny # Clean outputs then run
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Bundled Test Suites
|
|
115
|
+
|
|
116
|
+
Per-simulator test suites are available via direct script access:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
./simulators/opm/run.sh # Native OPM, all cases
|
|
120
|
+
./simulators/opm/run-docker.sh # Docker, all cases
|
|
121
|
+
./simulators/jutuldarcy/run.sh --test # JutulDarcy SPE1
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Simulators
|
|
125
|
+
|
|
126
|
+
### OPM Flow (Docker) -- Recommended for quick start
|
|
127
|
+
|
|
128
|
+
Runs via Docker on any platform. Simplest setup.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
./simulators/opm/install-docker.sh # Pull image + create flow wrapper
|
|
132
|
+
./simulators/opm/install-docker.sh --test # + run SPE1 validation
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
> Apple Silicon note: The Docker image is `linux/amd64` and runs under Rosetta/QEMU emulation.
|
|
136
|
+
|
|
137
|
+
### OPM Flow (Native macOS)
|
|
138
|
+
|
|
139
|
+
Full ARM-native performance. Builds Dune 2.10 + OPM from source.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
./simulators/opm/install.sh # Full build (~30-60 min, skips if installed)
|
|
143
|
+
./simulators/opm/install.sh --deps-only # Homebrew + Dune only
|
|
144
|
+
./simulators/opm/install.sh --test # Build + SPE1 test
|
|
145
|
+
./simulators/opm/install.sh --rebuild # Force full rebuild
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Requires: Xcode CLI tools, Homebrew, cmake, boost, suite-sparse, cjson, fmt.
|
|
149
|
+
|
|
150
|
+
### JutulDarcy
|
|
151
|
+
|
|
152
|
+
Differentiable reservoir simulator (Julia). Two modes available:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
./simulators/jutuldarcy/install.sh # Python mode (pip install jutuldarcy)
|
|
156
|
+
./simulators/jutuldarcy/install.sh --julia # Julia mode (JutulDarcy.jl + juliacall)
|
|
157
|
+
./simulators/jutuldarcy/install.sh --both # Both modes
|
|
158
|
+
./simulators/jutuldarcy/install.sh --test # Install + verify
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### DuMux
|
|
162
|
+
|
|
163
|
+
DUNE-based porous media simulator. Builds from source.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
./simulators/dumux/install.sh # Full build (shares Dune with OPM if available)
|
|
167
|
+
./simulators/dumux/install.sh --deps-only # Homebrew + Dune only
|
|
168
|
+
./simulators/dumux/install.sh --rebuild # Force full rebuild
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### PET (Python Ensemble Toolbox)
|
|
172
|
+
|
|
173
|
+
Download PET repositories and install Python packages:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
./simulators/pet/install.sh # Download repos + pip install PET/SimulatorWrap
|
|
177
|
+
./simulators/pet/install.sh --status # Show which repos/packages are present
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Verifying Installations
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
./runsim.sh flow --version # e.g. "flow 2026.04-pre"
|
|
184
|
+
./runsim.sh flow-docker --version # e.g. "flow 2025.10"
|
|
185
|
+
|
|
186
|
+
# JutulDarcy (Python mode)
|
|
187
|
+
.venv/bin/python -c "import jutuldarcy; print(jutuldarcy.__version__)"
|
|
188
|
+
|
|
189
|
+
# runsim Python package
|
|
190
|
+
.venv/bin/python -c "from runsim import OPMFlow; print(OPMFlow().version())"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Python Package
|
|
194
|
+
|
|
195
|
+
The `runsim` package provides a programmatic interface to simulators:
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
from runsim import OPMFlow
|
|
199
|
+
|
|
200
|
+
sim = OPMFlow() # auto-detect native binary
|
|
201
|
+
sim = OPMFlow(mode="docker") # use Docker wrapper
|
|
202
|
+
|
|
203
|
+
# Check availability
|
|
204
|
+
print(sim.version()) # "flow 2026.04-pre"
|
|
205
|
+
print(sim.is_available()) # True
|
|
206
|
+
|
|
207
|
+
# Run a simulation
|
|
208
|
+
result = sim.run("SPE1CASE1.DATA", output_dir="./output")
|
|
209
|
+
print(result.returncode) # 0 on success
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## PET Examples
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
EXAMPLE TYPE SIMULATOR NOTES
|
|
216
|
+
─────── ──── ───────── ─────
|
|
217
|
+
LinearModel DA none
|
|
218
|
+
3dBox/tiny DA flow needs data generation
|
|
219
|
+
3dBox/small DA flow needs data generation
|
|
220
|
+
3dBox/medium DA flow needs data generation
|
|
221
|
+
3dBox/large DA flow needs data generation
|
|
222
|
+
3dBox/flowrock DA flow needs data generation
|
|
223
|
+
Spe11b DA flow needs data generation
|
|
224
|
+
3Spot Opt flow
|
|
225
|
+
3SpotRobust Opt flow variants: bhp, rate
|
|
226
|
+
3SpotEcalc Opt flow
|
|
227
|
+
5SpotInverted Opt flow
|
|
228
|
+
5SpotLineSearch Opt flow
|
|
229
|
+
Rosenbrock Opt none
|
|
230
|
+
Quadratic Opt none
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Type: **DA** = Data Assimilation (ES-MDA), **Opt** = Optimization
|
|
234
|
+
|
|
235
|
+
## Dependencies
|
|
236
|
+
|
|
237
|
+
- **Python 3.11+**
|
|
238
|
+
- **uv** (recommended) or pip
|
|
239
|
+
- **Docker Desktop** (for OPM Flow Docker mode)
|
|
240
|
+
- [PET](https://github.com/Python-Ensemble-Toolbox) -- data assimilation framework
|
|
241
|
+
- [SimulatorWrap](https://github.com/Python-Ensemble-Toolbox) -- simulator wrappers
|
|
242
|
+
- [OPM Flow](https://opm-project.org/) -- reservoir simulator
|
|
243
|
+
- [JutulDarcy.jl](https://github.com/sintefmath/JutulDarcy.jl) -- differentiable simulator (optional)
|
|
244
|
+
- [DuMux](https://dumux.org/) -- porous media simulator (optional)
|
|
245
|
+
|
|
246
|
+
## Parent Repository Layout
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
project/
|
|
250
|
+
├── runsim/ # This project
|
|
251
|
+
├── pet-repos/
|
|
252
|
+
│ ├── PET-main/ # Python Ensemble Toolbox source
|
|
253
|
+
│ ├── SimulatorWrap-main/ # Simulator wrapper source
|
|
254
|
+
│ └── Examples-main/ # PET example cases
|
|
255
|
+
├── opm-repos/
|
|
256
|
+
│ └── opm-data-master/ # Standard OPM test data (SPE1-9, Norne)
|
|
257
|
+
├── opm-build/ # Native OPM build artifacts (if built)
|
|
258
|
+
└── dumux-build/ # Native DuMux build artifacts (if built)
|
|
259
|
+
```
|
runsim-0.1.0/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# runsim
|
|
2
|
+
|
|
3
|
+
> **Note:** This package is under active development. APIs and CLI interfaces may change.
|
|
4
|
+
|
|
5
|
+
Unified runner for reservoir simulators, data assimilation, and optimization on macOS.
|
|
6
|
+
|
|
7
|
+
## Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
runsim/
|
|
11
|
+
├── runsim.sh # Unified CLI entry point
|
|
12
|
+
├── pyproject.toml # Python package config (uv + hatchling)
|
|
13
|
+
├── runsim/ # Python package (flat layout)
|
|
14
|
+
│ ├── __init__.py
|
|
15
|
+
│ ├── base.py # Abstract Simulator class
|
|
16
|
+
│ ├── opm.py # OPM Flow wrapper
|
|
17
|
+
│ └── dumux.py # DuMux wrapper (stub)
|
|
18
|
+
├── simulators/
|
|
19
|
+
│ ├── common.sh # Shared helpers + path resolution
|
|
20
|
+
│ ├── setup_env.sh # Create venv, install packages, Docker setup
|
|
21
|
+
│ ├── opm/ # OPM Flow simulator
|
|
22
|
+
│ │ ├── README.md
|
|
23
|
+
│ │ ├── install.sh # Build from source (macOS)
|
|
24
|
+
│ │ ├── install-docker.sh # Install via Docker
|
|
25
|
+
│ │ ├── run.sh # Run bundled test suite (native)
|
|
26
|
+
│ │ ├── run-docker.sh # Run bundled test suite (Docker)
|
|
27
|
+
│ │ └── Dockerfile
|
|
28
|
+
│ ├── pet/ # Python Ensemble Toolbox
|
|
29
|
+
│ │ ├── README.md
|
|
30
|
+
│ │ ├── install.sh # Download repos + pip install
|
|
31
|
+
│ │ └── run.sh # Run PET examples (DA/optimization)
|
|
32
|
+
│ ├── jutuldarcy/ # JutulDarcy simulator
|
|
33
|
+
│ │ ├── README.md
|
|
34
|
+
│ │ ├── install.sh # Install Python/Julia mode
|
|
35
|
+
│ │ └── run.sh # Run simulations
|
|
36
|
+
│ └── dumux/ # DuMux simulator
|
|
37
|
+
│ ├── README.md
|
|
38
|
+
│ ├── install.sh # Build from source (macOS)
|
|
39
|
+
│ ├── run.sh # Run simulations
|
|
40
|
+
│ └── Dockerfile
|
|
41
|
+
└── .venv/ # Python virtual environment (auto-created)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 1. Set up environment (venv + packages + OPM Docker)
|
|
48
|
+
./runsim.sh setup
|
|
49
|
+
|
|
50
|
+
# 2. List available PET examples
|
|
51
|
+
./runsim.sh pet --list
|
|
52
|
+
|
|
53
|
+
# 3. Run an example
|
|
54
|
+
./runsim.sh pet Quadratic # Analytic (no Docker needed)
|
|
55
|
+
./runsim.sh pet 3dBox/tiny # OPM Flow (~2 min)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## CLI
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
./runsim.sh <command> [args...]
|
|
62
|
+
|
|
63
|
+
Commands:
|
|
64
|
+
flow [flow-args...] Run native OPM Flow (passthrough to binary)
|
|
65
|
+
flow-docker [flow-args...] Run OPM Flow via Docker (passthrough)
|
|
66
|
+
jutuldarcy [args...] Run JutulDarcy simulation
|
|
67
|
+
dumux [args...] Run DuMux simulation
|
|
68
|
+
dumux-docker [args...] Run DuMux via Docker
|
|
69
|
+
pet [options] <example> Run PET example (data assimilation / optimization)
|
|
70
|
+
setup Bootstrap environment (venv, PET, Docker)
|
|
71
|
+
help Show help
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Running Simulators
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# OPM Flow (native) -- passthrough to flow binary
|
|
78
|
+
./runsim.sh flow --version
|
|
79
|
+
./runsim.sh flow --output-dir=./out SPE1CASE1.DATA
|
|
80
|
+
|
|
81
|
+
# OPM Flow (Docker)
|
|
82
|
+
./runsim.sh flow-docker --version
|
|
83
|
+
./runsim.sh flow-docker --output-dir=./out SPE1CASE1.DATA
|
|
84
|
+
|
|
85
|
+
# JutulDarcy
|
|
86
|
+
./runsim.sh jutuldarcy --test
|
|
87
|
+
./runsim.sh jutuldarcy /path/to/DECK.DATA
|
|
88
|
+
|
|
89
|
+
# DuMux
|
|
90
|
+
./runsim.sh dumux /path/to/executable
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Running PET Examples
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
./runsim.sh pet --list # List available examples
|
|
97
|
+
./runsim.sh pet LinearModel # Analytic DA
|
|
98
|
+
./runsim.sh pet 3dBox/tiny # 10x10x2 grid (~2 min)
|
|
99
|
+
./runsim.sh pet --simulator flow 3dBox/tiny # Native OPM Flow (default)
|
|
100
|
+
./runsim.sh pet --simulator flow-docker 3dBox/tiny # Docker
|
|
101
|
+
./runsim.sh pet 3SpotRobust --variant bhp # Specific variant
|
|
102
|
+
./runsim.sh pet --clean 3dBox/tiny # Clean outputs then run
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Bundled Test Suites
|
|
106
|
+
|
|
107
|
+
Per-simulator test suites are available via direct script access:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
./simulators/opm/run.sh # Native OPM, all cases
|
|
111
|
+
./simulators/opm/run-docker.sh # Docker, all cases
|
|
112
|
+
./simulators/jutuldarcy/run.sh --test # JutulDarcy SPE1
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Simulators
|
|
116
|
+
|
|
117
|
+
### OPM Flow (Docker) -- Recommended for quick start
|
|
118
|
+
|
|
119
|
+
Runs via Docker on any platform. Simplest setup.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
./simulators/opm/install-docker.sh # Pull image + create flow wrapper
|
|
123
|
+
./simulators/opm/install-docker.sh --test # + run SPE1 validation
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> Apple Silicon note: The Docker image is `linux/amd64` and runs under Rosetta/QEMU emulation.
|
|
127
|
+
|
|
128
|
+
### OPM Flow (Native macOS)
|
|
129
|
+
|
|
130
|
+
Full ARM-native performance. Builds Dune 2.10 + OPM from source.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
./simulators/opm/install.sh # Full build (~30-60 min, skips if installed)
|
|
134
|
+
./simulators/opm/install.sh --deps-only # Homebrew + Dune only
|
|
135
|
+
./simulators/opm/install.sh --test # Build + SPE1 test
|
|
136
|
+
./simulators/opm/install.sh --rebuild # Force full rebuild
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Requires: Xcode CLI tools, Homebrew, cmake, boost, suite-sparse, cjson, fmt.
|
|
140
|
+
|
|
141
|
+
### JutulDarcy
|
|
142
|
+
|
|
143
|
+
Differentiable reservoir simulator (Julia). Two modes available:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
./simulators/jutuldarcy/install.sh # Python mode (pip install jutuldarcy)
|
|
147
|
+
./simulators/jutuldarcy/install.sh --julia # Julia mode (JutulDarcy.jl + juliacall)
|
|
148
|
+
./simulators/jutuldarcy/install.sh --both # Both modes
|
|
149
|
+
./simulators/jutuldarcy/install.sh --test # Install + verify
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### DuMux
|
|
153
|
+
|
|
154
|
+
DUNE-based porous media simulator. Builds from source.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
./simulators/dumux/install.sh # Full build (shares Dune with OPM if available)
|
|
158
|
+
./simulators/dumux/install.sh --deps-only # Homebrew + Dune only
|
|
159
|
+
./simulators/dumux/install.sh --rebuild # Force full rebuild
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### PET (Python Ensemble Toolbox)
|
|
163
|
+
|
|
164
|
+
Download PET repositories and install Python packages:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
./simulators/pet/install.sh # Download repos + pip install PET/SimulatorWrap
|
|
168
|
+
./simulators/pet/install.sh --status # Show which repos/packages are present
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Verifying Installations
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
./runsim.sh flow --version # e.g. "flow 2026.04-pre"
|
|
175
|
+
./runsim.sh flow-docker --version # e.g. "flow 2025.10"
|
|
176
|
+
|
|
177
|
+
# JutulDarcy (Python mode)
|
|
178
|
+
.venv/bin/python -c "import jutuldarcy; print(jutuldarcy.__version__)"
|
|
179
|
+
|
|
180
|
+
# runsim Python package
|
|
181
|
+
.venv/bin/python -c "from runsim import OPMFlow; print(OPMFlow().version())"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Python Package
|
|
185
|
+
|
|
186
|
+
The `runsim` package provides a programmatic interface to simulators:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from runsim import OPMFlow
|
|
190
|
+
|
|
191
|
+
sim = OPMFlow() # auto-detect native binary
|
|
192
|
+
sim = OPMFlow(mode="docker") # use Docker wrapper
|
|
193
|
+
|
|
194
|
+
# Check availability
|
|
195
|
+
print(sim.version()) # "flow 2026.04-pre"
|
|
196
|
+
print(sim.is_available()) # True
|
|
197
|
+
|
|
198
|
+
# Run a simulation
|
|
199
|
+
result = sim.run("SPE1CASE1.DATA", output_dir="./output")
|
|
200
|
+
print(result.returncode) # 0 on success
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## PET Examples
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
EXAMPLE TYPE SIMULATOR NOTES
|
|
207
|
+
─────── ──── ───────── ─────
|
|
208
|
+
LinearModel DA none
|
|
209
|
+
3dBox/tiny DA flow needs data generation
|
|
210
|
+
3dBox/small DA flow needs data generation
|
|
211
|
+
3dBox/medium DA flow needs data generation
|
|
212
|
+
3dBox/large DA flow needs data generation
|
|
213
|
+
3dBox/flowrock DA flow needs data generation
|
|
214
|
+
Spe11b DA flow needs data generation
|
|
215
|
+
3Spot Opt flow
|
|
216
|
+
3SpotRobust Opt flow variants: bhp, rate
|
|
217
|
+
3SpotEcalc Opt flow
|
|
218
|
+
5SpotInverted Opt flow
|
|
219
|
+
5SpotLineSearch Opt flow
|
|
220
|
+
Rosenbrock Opt none
|
|
221
|
+
Quadratic Opt none
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Type: **DA** = Data Assimilation (ES-MDA), **Opt** = Optimization
|
|
225
|
+
|
|
226
|
+
## Dependencies
|
|
227
|
+
|
|
228
|
+
- **Python 3.11+**
|
|
229
|
+
- **uv** (recommended) or pip
|
|
230
|
+
- **Docker Desktop** (for OPM Flow Docker mode)
|
|
231
|
+
- [PET](https://github.com/Python-Ensemble-Toolbox) -- data assimilation framework
|
|
232
|
+
- [SimulatorWrap](https://github.com/Python-Ensemble-Toolbox) -- simulator wrappers
|
|
233
|
+
- [OPM Flow](https://opm-project.org/) -- reservoir simulator
|
|
234
|
+
- [JutulDarcy.jl](https://github.com/sintefmath/JutulDarcy.jl) -- differentiable simulator (optional)
|
|
235
|
+
- [DuMux](https://dumux.org/) -- porous media simulator (optional)
|
|
236
|
+
|
|
237
|
+
## Parent Repository Layout
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
project/
|
|
241
|
+
├── runsim/ # This project
|
|
242
|
+
├── pet-repos/
|
|
243
|
+
│ ├── PET-main/ # Python Ensemble Toolbox source
|
|
244
|
+
│ ├── SimulatorWrap-main/ # Simulator wrapper source
|
|
245
|
+
│ └── Examples-main/ # PET example cases
|
|
246
|
+
├── opm-repos/
|
|
247
|
+
│ └── opm-data-master/ # Standard OPM test data (SPE1-9, Norne)
|
|
248
|
+
├── opm-build/ # Native OPM build artifacts (if built)
|
|
249
|
+
└── dumux-build/ # Native DuMux build artifacts (if built)
|
|
250
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "runsim"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Unified interface for running reservoir simulators"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = ["numpy"]
|
|
8
|
+
|
|
9
|
+
[build-system]
|
|
10
|
+
requires = ["hatchling"]
|
|
11
|
+
build-backend = "hatchling.build"
|
|
12
|
+
|
|
13
|
+
[dependency-groups]
|
|
14
|
+
dev = ["pytest", "ruff", "pre-commit"]
|
|
15
|
+
|
|
16
|
+
[tool.ruff]
|
|
17
|
+
target-version = "py311"
|
|
18
|
+
line-length = 99
|
|
19
|
+
|
|
20
|
+
[tool.ruff.lint]
|
|
21
|
+
select = ["E", "F", "I", "UP"]
|
|
22
|
+
|
|
23
|
+
[tool.pytest.ini_options]
|
|
24
|
+
testpaths = ["tests"]
|