Skip to content

Commit

Permalink
Updates to 2024.04
Browse files Browse the repository at this point in the history
  • Loading branch information
daavid00 committed Aug 7, 2024
1 parent b434fe3 commit ae4af12
Show file tree
Hide file tree
Showing 138 changed files with 3,619 additions and 1,137 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ prototyping/
cssr/
presentation/
paper/
playground/
project/
.vscode/

2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ include src/pyopmnearwell/templates/co2store/*
include src/pyopmnearwell/templates/common/*
include src/pyopmnearwell/templates/h2store/*
include src/pyopmnearwell/templates/saltprec/*
include src/pyopmnearwell/templates/standardwell/*
include src/pyopmnearwell/templates/standardwell_impl/*
include src/pyopmnearwell/utils/*
include src/pyopmnearwell/visualization/*
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://github.com/cssr-tools/pyopmnearwell/actions/workflows/CI.yml/badge.svg)](https://github.com/cssr-tools/pyopmnearwell/actions/workflows/CI.yml)
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10%20|%203.11-blue.svg"></a>
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%20|%203.11|%203.12-blue.svg"></a>
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![DOI](https://zenodo.org/badge/662625461.svg)](https://zenodo.org/doi/10.5281/zenodo.10266790)
Expand All @@ -13,9 +13,16 @@ using the [_OPM-Flow_](https://opm-project.org/?page_id=19) simulator.

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

You can install the requirements in a virtual environment with the following commands:
To install the _pyopmnearwell_ executable in an existing Python environment:

```bash
pip install git+https://github.com/cssr-tools/pyopmnearwell.git
```

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:

```bash
# Clone the repo
Expand All @@ -28,16 +35,14 @@ python3 -m venv vpyopmnearwell
source vpyopmnearwell/bin/activate
# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
# Install the pyopmnearwell package (in editable mode for contributions/modifications; otherwise, pip install .)
# Install the pyopmnearwell package
pip install -e .
# For contributions/testing/linting, install the dev-requirements
pip install -r dev-requirements.txt
```

See the [_CI.yml_](https://github.com/cssr-tools/pyopmnearwell/blob/main/.github/workflows/CI.yml) script
for installation of OPM Flow (binary packages) and the pyopmnearwell 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.

For macOS users with the latest chips (M1/M2, guessing also M3?), the ecl, resdata, and opm Python packages are not available via pip install. Then before installation, remove them from the `requirements.txt`, then proceed with the Python requirements installation, install the OPM Flow dependencies (using macports or brew), and once inside the vpyopmnearwell Python environment, run the `./build_opm-flow_macOS.bash`, and deactivate and activate the virtual environment (this script builds OPM Flow as well as the opm Python package, and it exports the required PYTHONPATH).
See the [_installation_](https://cssr-tools.github.io/pyopmnearwell/examples.html) for further details on building OPM Flow from the master branches
in Linux, Windows, and macOS.

## Running pyopmnearwell
You can run _pyopmnearwell_ as a single command line:
Expand All @@ -47,11 +52,10 @@ pyopmnearwell -i some_input.txt -o some_output_folder
Run `pyopmnearwell --help` to see all possible command line
argument options. Inside the `some_input.txt` file you provide the path to the
flow executable and simulation parameters. See the .txt files in the `examples/`,
`tests/geometries/`, and `tests/models/` folders. For macOS users, then use the flag
`-p opm` for plotting (resdata is the default one).
`tests/geometries/`, and `tests/models/` folders.

## Getting started
See the [_documentation_](https://cssr-tools.github.io/pyopmnearwell/introduction.html).
See the [_examples_](https://cssr-tools.github.io/pyopmnearwell/examples.html) in the [_documentation_](https://cssr-tools.github.io/pyopmnearwell/introduction.html).

## About pyopmnearwell
The pyopmnearwell package is being funded by the [_HPC Simulation Software for the Gigatonne Storage Challenge project_](https://www.norceresearch.no/en/projects/hpc-simulation-software-for-the-gigatonne-storage-challenge) [project number 622059] and [_Center for Sustainable Subsurface Resources (CSSR)_](https://cssr.no)
Expand Down
40 changes: 0 additions & 40 deletions build_opm-flow_macOS.bash

This file was deleted.

27 changes: 0 additions & 27 deletions build_opm-flow_mpi.bash

This file was deleted.

6 changes: 3 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
black
pylint
numpydoc
mypy
pylint
pytest-cov
sphinx
sphinx-rtd-theme
pytest
sphinx-rtd-theme
Binary file modified docs/_images/contents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/plopm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/pycopm.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/pyopmspe11.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/_sources/api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The scripts in the utils folder process the input configuration file, creates th
write the input files by using the scripts in the templates folder, and execute OPM Flow. The scripts in
the visualization folder contains files for the postprocessing of the results to generate figures (.png) to show
comparisons between the different runs/parts of the geological model such as well injectivity (WI) and
2D spatial maps for the last time step simulated. The ml folder is under development, see the files in the
'examples/cemracs2023/peaceman_well-model_nn' if you are curious.
2D spatial maps for the last time step simulated. The ml folder constains scripts used in
`this repository <https://github.com/cssr-tools/ML_near_well>`_.

.. figure:: figs/contents.png

Expand Down
8 changes: 8 additions & 0 deletions docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ The following are some of the plots created by the **pyopmnearwell** executable:

Permeability (top), CO2 injection schedule (middle), and saturation values over time on the cells along the well location
at three different locations (bottom).

Publications
------------
For the simulation results published in `this paper <https://onepetro.org/SPEBERG/proceedings/24BERG/1-24BERG/D011S012R010/544194>`_
about the impact of intermittency on salt precipitation during CO2 injection, see/run
`these configuration files <https://github.com/cssr-tools/pyopmnearwell/blob/main/publications>`_.

For a study where **pyopmnearwell** is used to generated a machine-learned near-well model, `click here <https://github.com/cssr-tools/ML_near_well>`_.
1 change: 1 addition & 0 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Welcome to pyopmnearwell's documentation!
:maxdepth: 4

introduction
installation
configuration_file
examples
api
Expand Down
128 changes: 128 additions & 0 deletions docs/_sources/installation.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
============
Installation
============

Python package
--------------

To install the **pyopmnearwell** executable in an existing Python environment:

.. code-block:: bash
pip install git+https://github.com/cssr-tools/pyopmnearwell.git
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:

.. code-block:: console
# Clone the repo
git clone https://github.com/cssr-tools/pyopmnearwell.git
# Get inside the folder
cd pyopmnearwell
# Create virtual environment
python3 -m venv vpyopmnearwell
# Activate virtual environment
source vpyopmnearwell/bin/activate
# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
# Install the pyopmnearwell package
pip install -e .
# For contributions/testing/linting, install the dev-requirements
pip install -r dev-requirements.txt
OPM Flow
--------
You also need to install:

* OPM Flow (https://opm-project.org, Release 2024.04 or current master branches)

.. tip::

See the `CI.yml <https://github.com/cssr-tools/pyopmnearwell/blob/main/.github/workflows/CI.yml>`_ script
for installation of OPM Flow (binary packages) and the pyopmnearwell package in Linux.

Source build in Linux/Windows
+++++++++++++++++++++++++++++
If you are a Linux user (including the Windows subsystem for Linux), then you could try to build Flow (after installing the `prerequisites <https://opm-project.org/?page_id=239>`_) from the master branches with mpi support by running
in the terminal the following lines (which in turn should build flow in the folder ./build/opm-simulators/bin/flow.):

.. code-block:: console
CURRENT_DIRECTORY="$PWD"
for repo in common grid models simulators
do
git clone https://github.com/OPM/opm-$repo.git
done
mkdir build
for repo in common grid models
do
mkdir build/opm-$repo
cd build/opm-$repo
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
make -j5 opm$repo
cd ../..
done
mkdir build/opm-simulators
cd build/opm-simulators
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid;$CURRENT_DIRECTORY/build/opm-models" $CURRENT_DIRECTORY/opm-simulators
make -j5 flow
cd ../..
.. tip::

You can create a .sh file (e.g., build_opm_mpi.sh), copy the previous lines, and run in the terminal **source build_opm_mpi.sh**

Regarding the plotting functionality, it is possible to use the opm python package instead of resdata (e.g., it seems the opm Python package
is faster than resdata to read large simulation files). To use opm, you first need to install it, by executing in the terminal **pip install opm**.

Source build in macOS
+++++++++++++++++++++
For macOS, there are no available binary packages, so OPM Flow needs to be built from source, in addition to the dune libraries and the opm Python
package (see the `prerequisites <https://opm-project.org/?page_id=239>`_, which can be installed using macports or brew). This can be achieved by the following lines:

.. code-block:: console
CURRENT_DIRECTORY="$PWD"
for module in common geometry grid istl
do git clone https://gitlab.dune-project.org/core/dune-$module.git --branch v2.9.1
done
for module in common geometry grid istl
do ./dune-common/bin/dunecontrol --only=dune-$module cmake -DCMAKE_DISABLE_FIND_PACKAGE_MPI=1
./dune-common/bin/dunecontrol --only=dune-$module make -j5
done
for repo in common grid models simulators
do
git clone https://github.com/OPM/opm-$repo.git
done
source vpyopmnearwell/bin/activate
mkdir build
for repo in common grid models
do
mkdir build/opm-$repo
cd build/opm-$repo
cmake -DPYTHON_EXECUTABLE=$(which python) -DWITH_NDEBUG=1 -DUSE_MPI=0 -DOPM_ENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
make -j5 opm$repo
cd ../..
done
mkdir build/opm-simulators
cd build/opm-simulators
cmake -DUSE_MPI=0 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid;$CURRENT_DIRECTORY/build/opm-models" $CURRENT_DIRECTORY/opm-simulators
make -j5 flow
cd ../..
echo "export PYTHONPATH=\$PYTHONPATH:$CURRENT_DIRECTORY/build/opm-common/build/python" >> $CURRENT_DIRECTORY/vpyopmnearwell/bin/activate
This builds OPM Flow as well as the opm Python package, and it exports the required PYTHONPATH. Then after execution, deactivate and activate the Python virtual environment.
10 changes: 1 addition & 9 deletions docs/_sources/introduction.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Introduction

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

Concept
-------
Expand Down Expand Up @@ -44,14 +44,6 @@ where
- \-s, \-scale: Scale for the x axis in the figures: 'normal' or 'log' ('normal' by default).
- \-m, \-model: Simulated model (5th row in the configuration file). This is used for the plotting compare method (it gets overwritten by the configuration file) ('co2store' by default).

Installation
------------

See the `Github page <https://github.com/cssr-tools/pyopmnearwell>`_.

.. tip::
Check the `CI.yml <https://github.com/cssr-tools/pyopmnearwell/blob/main/.github/workflows/CI.yml>`_ file.

.. warning::
The H2CH4 template in the h2store model folder is under development and it is based on an input deck available in
`opm-tests <https://github.com/OPM/opm-tests/blob/master/diffusion/BO_DIFFUSE_CASE1.DATA>`_. In addition, the templates
Expand Down
8 changes: 8 additions & 0 deletions docs/_sources/pyopmnearwell.ml.analysis.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pyopmnearwell.ml.analysis module
================================

.. automodule:: pyopmnearwell.ml.analysis
:members:
:undoc-members:
:show-inheritance:
:private-members:
8 changes: 0 additions & 8 deletions docs/_sources/pyopmnearwell.ml.data.rst.txt

This file was deleted.

8 changes: 8 additions & 0 deletions docs/_sources/pyopmnearwell.ml.resdata_dataset.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pyopmnearwell.ml.resdata\_dataset module
========================================

.. automodule:: pyopmnearwell.ml.resdata_dataset
:members:
:undoc-members:
:show-inheritance:
:private-members:
5 changes: 4 additions & 1 deletion docs/_sources/pyopmnearwell.ml.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ Submodules
.. toctree::
:maxdepth: 4

pyopmnearwell.ml.data
pyopmnearwell.ml.analysis
pyopmnearwell.ml.ensemble
pyopmnearwell.ml.integration
pyopmnearwell.ml.kerasify
pyopmnearwell.ml.nn
pyopmnearwell.ml.resdata_dataset
pyopmnearwell.ml.scaler_layers
pyopmnearwell.ml.upscale
pyopmnearwell.ml.utils

Module contents
---------------
Expand Down
8 changes: 8 additions & 0 deletions docs/_sources/pyopmnearwell.ml.upscale.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pyopmnearwell.ml.upscale module
===============================

.. automodule:: pyopmnearwell.ml.upscale
:members:
:undoc-members:
:show-inheritance:
:private-members:
Loading

0 comments on commit ae4af12

Please sign in to comment.