Skip to content

Commit 20928f8

Browse files
authored
Merge pull request #3 from daavid00/developing
Updating the documentation
2 parents 18fadb3 + 6c695aa commit 20928f8

Some content is hidden

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

49 files changed

+1367
-324
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@
44
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
55
<img src="docs/text/figs/pycopm.gif" width="900" height="200">
66

7-
# pycopm: An open-source coarsening framework for OPM Flow
7+
# pycopm: An open-source coarsening framework for OPM Flow geological models
88

9-
This repository contains runscripts to create coarser models from given input decks.
10-
Here we use the [_OPM-Flow_](https://opm-project.org/?page_id=19) simulator.
9+
## Main feature
10+
Creation of coarser models from given input decks.
1111

1212
## Installation
1313
You will first need to install
1414
* Flow (https://opm-project.org, Release 2024.04 or current master branches)
1515

16-
You can install the Python requirements in a virtual environment with the following commands:
16+
To install the _pycopm_ executable in an existing Python environment:
17+
18+
```bash
19+
pip install git+https://github.com/cssr-tools/pycopm.git
20+
```
21+
22+
If you are interested in modifying the source code, then you can clone the repository and
23+
install the Python requirements in a virtual environment with the following commands:
1724

1825
```bash
1926
# Clone the repo
@@ -32,7 +39,7 @@ pip install -e .
3239
pip install -r dev-requirements.txt
3340
```
3441

35-
See the [_CI.yml_](https://github.com/OPM/pycopm/blob/main/.github/workflows/CI.yml) script for installation of OPM Flow (binary packages) and the pycopm package. If you are a Linux user (including the Windows subsystem for Linux), then you could try to build Flow from the master branches with mpi support, by running the script `./build_opm-flow_mpi.bash`, which in turn should build flow in the folder ./build/opm-simulators/bin/flow (you first need to install the [_OPM-Flow-prerequisites_](https://opm-project.org/?page_id=239)).
42+
See the [_CI.yml_](https://github.com/OPM/pycopm/blob/main/.github/workflows/CI.yml) script for installation of OPM Flow (binary packages) and the pycopm package. If you are a Linux user (including the Windows subsystem for Linux), then you could try to build Flow from the master branches with mpi support, by running the script `./build_opm-flow_mpi.bash`, which in turn should build flow in the folder ./build/opm-simulators/bin/flow (you first need to install the [_OPM-Flow-prerequisites_](https://opm-project.org/?page_id=239)).
3643

3744
For macOS users, use at least a Python version of 3.10 (due to resdata), and run the `./build_opm-flow_macOS.bash` to build OPM Flow (the [_OPM-Flow-prerequisites_](https://opm-project.org/?page_id=239) can be installed via brew or macports).
3845

@@ -44,9 +51,4 @@ pycopm -i some_input -o some_output_folder
4451
Run `pycopm --help` to see all possible command line argument options.
4552

4653
## Getting started
47-
See the [_documentation_](https://cssr-tools.github.io/pycopm/introduction.html).
48-
49-
## Citing
50-
If you use _pycopm_ in your research, please cite the following publication:
51-
52-
Sandve, T.H., Lorentzen, R.J., Landa-Marbán, D., Fossum, K., 2024. Closed-loop reservoir management using fast data-calibrated coarse models. In: ECMOR 2024, 1. European Association of Geoscientists & Engineers, 1–14.
54+
See the [_examples_](https://cssr-tools.github.io/pycopm/examples.html) in the [_documentation_](https://cssr-tools.github.io/pycopm/introduction.html).

docs/_images/contents.png

-14.4 KB
Loading

docs/_images/output_generic.png

90.8 KB
Loading

docs/_images/plopm.png

565 KB
Loading

docs/_images/smeia.png

267 KB
Loading

docs/_sources/about.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ About pycopm
55
.. image:: ./figs/droganim.gif
66
:scale: 65%
77

8-
The **pycopm** tool for coarsening geological models is being funded by the `Center for Sustainable Subsurface Resources (CSSR) <https://cssr.no>`_ [project no. 331841].
8+
**pycopm**, a tool for coarsening OPM Flow geological models, is being funded by the `Center for Sustainable Subsurface Resources (CSSR) <https://cssr.no>`_ [project no. 331841].
99
This is work in progress.
1010
Contributions are more than welcome using the fork and pull request approach.

docs/_sources/configuration_file.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
==================
22
Configuration file
33
==================
4+
.. Note::
5+
The configuration files allow to set the integrated studies (coarsening and history matching)
6+
only for the drogon and norne model. To use **pycopm** in any given OPM Flow geological model
7+
to generate the coarser files, this can be achieve without a configuration file, but setting
8+
the parameters via command lines (see the :ref:`overview` or run `pycopm -h` for the definition
9+
of the argument options, and the :doc:`examples <./examples>`.)
10+
11+
412
Here we use as an example one of the configuration files used in the tests
513
(see `ert.txt <https://github.com/crrs-tools/pycopm/blob/main/tests/configs/ert.txt>`_).
614
The first input parameter is:

docs/_sources/examples.rst.txt

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
Examples
33
********
44

5-
==================
6-
Configuration file
7-
==================
5+
=======================
6+
Via configuration files
7+
=======================
8+
9+
Drogon
10+
------
811

912
The `examples <https://github.com/cssr-tools/pycopm/blob/main/examples>`_ folder contains configuration files
1013
to perform HM studies in drogon and norne. For example, by executing inside the `example folder for drogon <https://github.com/cssr-tools/pycopm/blob/main/examples/drogon>`_:
@@ -18,16 +21,59 @@ The following are the drogon model from `opm-tests <https://github.com/OPM/opm-t
1821
.. figure:: figs/drogon_coarser.png
1922

2023

21-
==========
22-
Input deck
23-
==========
24+
==================
25+
Via OPM Flow decks
26+
==================
27+
28+
SPE10
29+
-----
2430

2531
See/run the `test_generic_deck.py <https://github.com/cssr-tools/pycopm/blob/main/tests/test_generic_deck.py>`_
2632
for an example where **pycopm** is used to coarse the
27-
`SPE10_MODEL2 model <https://github.com/OPM/opm-data/tree/master/spe10model2>`_ by downloading the files and running:
33+
`SPE10_MODEL2 model <https://github.com/OPM/opm-data/tree/master/spe10model2>`_ by downloading the OPM files and running:
2834

2935
.. code-block:: bash
3036
3137
pycopm -i SPE10_MODEL2.DATA -o coarser -c 4,8,2
3238
33-
.. figure:: figs/spe10_model2_coarser.png
39+
.. figure:: figs/spe10_model2_coarser.png
40+
41+
Porosity values for the (left) original and (right) coarsed SPE10 model.
42+
43+
Smeaheia
44+
--------
45+
46+
By downloading the `Smeaheia simulation model <https://co2datashare.org/dataset/smeaheia-dataset>`_,
47+
then:
48+
49+
.. code-block:: bash
50+
51+
pycopm -i Statoil_Feasibility_sim_model_with_depletion_KROSS_INJ_SECTOR_20.DATA -o . -c 5,4,3 -a mode -j 1000
52+
53+
will generate a coarser model 5 times in the x direction, 4 in the y direction, and 3 in the z direction, where the mode is
54+
used to decide if a coarser cell should be active or inactive. The jump (-j) is set to a higher value (1000) to avoid removal
55+
of grid connections (this is a tunning value to remove generated connections between neighbours in the coarse model).
56+
57+
We can execute a dry run of OPM Flow to generate the grid and static variables of the coarser model:
58+
59+
.. code-block:: bash
60+
61+
flow STATOIL_FEASIBILITY_SIM_MODEL_WITH_DEPLETION_KROSS_INJ_SECTOR_20_PYCOPM.DATA --enable-dry-run=true
62+
63+
We use our `plopm <https://github.com/cssr-tools/plopm>`_ friend to generate PNG figures:
64+
65+
.. code-block:: bash
66+
67+
plopm -i STATOIL_FEASIBILITY_SIM_MODEL_WITH_DEPLETION_KROSS_INJ_SECTOR_20_PYCOPM -s ,,0
68+
69+
.. figure:: figs/smeia.png
70+
71+
Porosity values for the (left) original and (right) coarsed model.
72+
73+
.. tip::
74+
You can install plopm by executing in the terminal: pip install git+https://github.com/cssr-tools/plopm.git.
75+
76+
.. note::
77+
In the current implementation of the **pycopm** tool, the handling of properties that require definitions of i,j,k indices
78+
(e.g., FAULTS, WELLSPECS) are assumed to be define in the main .DATA deck. Then, in order to use **pycopm** for simulation models
79+
where these properties are define via include files, replace those includes in the .DATA deck with the actual content of the include files.

docs/_sources/introduction.rst.txt

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ Introduction
55
.. image:: ./figs/pycopm.gif
66

77
This documentation describes the content of the **pycopm** package.
8-
The numerical studies are performed using the `Flow <https://opm-project.org/?page_id=19>`_ simulator.
98

109
Concept
1110
-------
12-
Simplified and flexible framework for coarsening geological models. The initial implementation
13-
included two available models in `opm-tests <https://github.com/OPM/opm-tests>`_: `norne <https://github.com/OPM/opm-tests/tree/master/norne>`_
11+
Simplified and flexible framework to create coarser OPM Flow geological models.
12+
13+
Roadmap
14+
-------
15+
In the initial development of the framework, the focus was two available models in `opm-tests <https://github.com/OPM/opm-tests>`_: `norne <https://github.com/OPM/opm-tests/tree/master/norne>`_
1416
and `drogon <https://github.com/OPM/opm-tests/tree/master/drogon>`_, where the coarser models are used to perform history matching studies using
15-
the Ensemble based reservoir tool `ERT <https://ert.readthedocs.io/en/latest/>`_, via a :doc:`configuration file <./configuration_file>`. The current
16-
available options for parameters to HM are the saturation functions using the LET model and permeabilities. The plan is to extend the functionality to
17-
set up history matching/optimization studies using either `ERT <https://ert.readthedocs.io/en/latest/>`_, `PET <https://python-ensemble-toolbox.github.io/PET/>`_,
18-
or `everest <https://github.com/equinor/everest>`_.
17+
the Ensemble based reservoir tool `ERT <https://ert.readthedocs.io/en/latest/>`_, via a :doc:`configuration file <./configuration_file>`.
18+
19+
The current development of **pycopm** focuses on only creating coarser models (i.e., all needed input files to run OPM Flow) by only giving the OPM Flow input files
20+
(i.e., avoiding the manual work to create templates as it was done for drogon and norne). This allows for flexibility to adapt the generated coarser decks in your
21+
favourite history matching/optimization tool (e.g., `ERT <https://ert.readthedocs.io/en/latest/>`_, `PET <https://python-ensemble-toolbox.github.io/PET/>`_, `everest <https://github.com/equinor/everest>`_).
1922

20-
In addition, current work focuces on creating coarser grids by only giving the input files
21-
(i.e., avoiding the manual work to create templates as done for drogon and norne); see the :doc:`examples <./examples>`.
23+
.. _overview:
2224

2325
Overview
2426
--------
@@ -30,14 +32,27 @@ The current implementation supports the following executable with the argument o
3032
3133
where
3234

33-
- \-i, \-input: The base name of the :doc:`configuration file <./configuration_file>` or the name of the deck (`input.txt` by default).
34-
- \-o, \-output: The base name of the :doc:`output folder <./output_folder>` (`output` by default).
35-
- \-f, \-flow: Path to OPM Flow (`flow` by default).
36-
- \-c, \-coarsening: Level of coarsening in the x, y, and z dir (`2,2,2` by default)
35+
- \-i: The base name of the :doc:`configuration file <./configuration_file>` or the name of the deck (`input.txt` by default).
36+
- \-o: The base name of the :doc:`output folder <./output_folder>` (`output` by default).
37+
- \-f: OPM Flow full path to executable or just `flow` (`flow` by default).
38+
- \-c: Level of coarsening in the x, y, and z dir (`2,2,2` by default).
39+
- \-a: Use min, max, or mode to scale the actnum (`min` by default).
40+
- \-j: Tunning parameter to avoid creation of nnc on the structural faults (`2.` by default).
41+
- \-x: Vector of x-coarsening (`` by default).
42+
- \-y: Vector of y-coarsening (`` by default).
43+
- \-z: Vector of z-coarsening (`` by default).
44+
- \-e: Use `utf8` or `ISO-8859-1` encoding to read the deck (`ISO-8859-1` by default).
3745

3846
Installation
3947
------------
4048
See the `Github page <https://github.com/cssr-tools/pycopm>`_.
4149

4250
.. tip::
4351
Check the `CI.yml <https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/CI.yml>`_ file.
52+
53+
Getting started
54+
---------------
55+
See the :doc:`examples <./examples>`.
56+
57+
.. tip::
58+
Check the `tests <https://github.com/cssr-tools/pycopm/blob/main/tests>`_.

docs/_sources/output_folder.rst.txt

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22
Output folder
33
=============
44

5-
The following screenshot shows the generated ERT configuration file and folders in the selected output folder after executing **pycopm**.
5+
Via configuration files
6+
-----------------------
7+
As described in the :doc:`introduction <./introduction>`, in the early development of **pycopm**
8+
the focus was on history matching studies using `ERT <https://ert.readthedocs.io/en/latest/>`_ for the
9+
`norne <https://github.com/OPM/opm-tests/tree/master/norne>`_ and `drogon <https://github.com/OPM/opm-tests/tree/master/drogon>`_ geological models
10+
via a :doc:`configuration file <./configuration_file>`.
11+
12+
The following screenshot shows the generated ERT configuration file and folders in the selected output folder after executing **pycopm**
13+
on the drogon model.
614

715
.. figure:: figs/output.png
816

917
(Left) example of generated files after executing **pycopm** and (right) some of the figures in the postprocessing folder.
1018

1119
The generate ert.ert file can be run directly calling ERT for further studies, and some useful plots and files
12-
are generated in the postprocessing folder. The OPM simulation results can be visualized using `ResInsight <https://resinsight.org>`_ .
13-
Then after running **pycopm**, one could modify the generated OPM coarser related files in the preprocessing folder to adapt to
14-
further existing frameworks (e.g., `PET <https://python-ensemble-toolbox.github.io/PET/>`_, `everest <https://github.com/equinor/everest>`_).
20+
are generated in the postprocessing folder. The OPM simulation results can be visualized using `ResInsight <https://resinsight.org>`_.
21+
22+
Via an OPM Flow input deck
23+
--------------------------
24+
The current development of **pycopm** focuces on only creating coarser models (i.e., all needed input files to run OPM Flow) by only giving the OPM Flow input files.
25+
26+
The following screenshot shows the input deck and generated files in the selected output folder (coarser for this example) after executing **pycopm** on the SPE10 model (see the
27+
`test_generic_deck.py <https://github.com/cssr-tools/pycopm/blob/main/tests/test_generic_deck.py>`_) file.
28+
29+
.. figure:: figs/output_generic.png
30+
31+
Then, after running **pycopm**, one could adapt the generated files with the coarser geological model in your
32+
favourite history matching/optimization tool (e.g., `ERT <https://ert.readthedocs.io/en/latest/>`_, `PET <https://python-ensemble-toolbox.github.io/PET/>`_, `everest <https://github.com/equinor/everest>`_).

0 commit comments

Comments
 (0)