A lean petroleum reservoir simulator using TPFA (two-point flux approximation). Documentation.
-
Small: all of its physics fit in
core.py's 400 lines of code. - Capable: two-phase, slight compressibility, BHP control, well paths, irregular outlines and faults (inactive cells), aquifers – but a toy: 2D uniform grid, immiscible, isothermal, and simple well models and operation.
- Adjoint model included; verified against finite differences.
-
Python:
(
pip install minires), or demo it in a web browser via(backend: Google) or
(no backend!).
-
Fast: similar to JutulDarcy's (but no JIT startup/wait) at equal accuracy on 2D two-phase cases of size
$100$ –$10^5$ . - Reliable: reproduces the numbers of the Matlab code (2007) from NTNU/Sintef by Jørg E. Aarnes, Tore Gimse, and Knut–Andreas Lie. Further validated against Buckley–Leverett's analytic solution, ECLIPSE's numbers on the Egg model and JutulDarcy's on quarter five-spot, SPE-10, and Egg.
-
Tested extensively:
, with many examples doubling as regression tests.
Please let me know (or make a PR) if you use this in your work, and I will add it to this list.
To also get the examples and tests, clone instead, and install with uv, in editable mode:
git clone https://github.com/patnr/MiniRes.git
cd MiniRes
uv sync # or: pip install -e .
uv run pytest
uv run ruff checkAI (in particular Claude Code) has already played a major role in developing
the recent features here, so AI-generated contributions are welcome.
But there is a strong focus on minimising slop, meaning that the changes should be
as small as the job allows, and written in the style of what surrounds them.
CLAUDE.md carries conventions and a good deal of what has already been tried and rejected.

