Metadata-Version: 2.4
Name: minires
Version: 0.3.1
Summary: Toy petroleum reservoir simulator using TPFA.
Keywords: reservoir-simulation,reservoir-engineering,petroleum,porous-media,two-phase-flow,waterflooding,darcy,finite-volume,tpfa,adjoint,history-matching,data-assimilation
Author: patnr
Author-email: patnr <patrick.n.raanes@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Dist: matplotlib>=3.8,<4
Requires-Dist: scipy~=1.10
Requires-Dist: tqdm~=4.65
Requires-Dist: struct-tools>=0.3
Requires-Python: >=3.12
Project-URL: Homepage, https://patnr.github.io/MiniRes/
Project-URL: Documentation, https://patnr.github.io/MiniRes/minires.html
Project-URL: Repository, https://github.com/patnr/MiniRes
Project-URL: Changelog, https://github.com/patnr/MiniRes/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/patnr/MiniRes/issues
Description-Content-Type: text/markdown

# MiniRes

<img src="https://raw.githubusercontent.com/patnr/MiniRes/main/logo.png" alt="The MiniRes logo" align="right" width="300"/>

A simple petroleum reservoir simulator
using TPFA (two-point flux approximation).
[**Documentation**](https://patnr.github.io/MiniRes/minires.html).

- **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** 2D uniform grid, immiscible, isothermal, and simple well models and operation.
- **Adjoint** model included; verified against finite differences.
- **Python**: [![PyPI](https://img.shields.io/pypi/v/minires?logo=pypi&logoColor=white)](https://pypi.org/project/minires/) (`pip install minires`), or demo it in a web browser via
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/patnr/MiniRes/blob/main/notebooks/colab.ipynb) (backend: Google)
  or [![WASM](https://img.shields.io/static/v1?label=WASM&message=by%20marimo&logo=webassembly&color=654ff0)](https://patnr.github.io/MiniRes/wasm/) (no backend!).
- **Fast**: similar to [JutulDarcy's](https://github.com/sintefmath/JutulDarcy.jl) (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)](http://folk.ntnu.no/andreas/papers/ResSimMatlab.pdf) 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: [![GitHub CI](https://github.com/patnr/MiniRes/actions/workflows/tests.yml/badge.svg)](https://github.com/patnr/MiniRes/actions),
  with many [examples](https://patnr.github.io/MiniRes/examples.html) doubling as regression tests.

![The Egg model: permeability, pressure, oil saturation, and the adjoint sensitivity of a producer's water cut](https://raw.githubusercontent.com/patnr/MiniRes/main/collage.png)

## Used by

Please let me know (or make a PR) if you use this in your work,
and I will add it to this list.

- [History matching tutorial](https://github.com/patnr/HistoryMatching)

## Contributions

To also get the examples and tests, clone instead, and install with [uv](https://docs.astral.sh/uv/), in editable mode:

```sh
git clone https://github.com/patnr/MiniRes.git
cd MiniRes
uv sync  # or: pip install -e .
uv run pytest
uv run ruff check
```
