Skip to content

Commit

Permalink
Support for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
daavid00 committed Nov 29, 2023
1 parent 4fa99d3 commit 3f582b7
Show file tree
Hide file tree
Showing 45 changed files with 672 additions and 134 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ cython_debug/
# Environment
vpyopmspe11

# OPM
dune-*
opm-*

# Examples outputs
tests/configs/test_compare
tests/configs/output
Expand All @@ -173,4 +177,5 @@ tests/configs/spe11c
examples/spe11a
examples/spe11b
examples/spe11c
developing
developing
debugging
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ Here we use the [_OPM-Flow_](https://opm-project.org/?page_id=19) simulator.
You will first need to install
* Flow (https://opm-project.org, Release 2023.10 or current master branches)

To build dune and the corresponding OPM master branches from source (e.g., you are a macOS user), you can run the script
`./build_dune_and_opm-flow.bash`, which in turn should build flow in the folder
./build/opm-simulators/bin/flow (for macOS users the dependecies such as boost can be installed using brew or macports).

You can install the requirements in a virtual environment with the following commands:
You can install the Python requirements in a virtual environment with the following commands:

```bash
# Clone the repo
Expand All @@ -37,8 +33,10 @@ pip install -e .
pip install -r dev-requirements.txt
```

See the [_CI.yml_](https://github.com/OPM/pyopmspe11/blob/main/.github/workflows/CI.yml) script
for installation of OPM Flow and the pyopmspe11 package in Linux.
See the [_CI.yml_](https://github.com/OPM/pyopmspe11/blob/main/.github/workflows/CI.yml) script
for installation of OPM Flow (binary packages) and the pyopmspe11 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 resdata Python package is not available via pip install. Then before installation, remove resdata from the `requierements.txt`, then proceed with the Python requirements installation, install the OPM Flow dependencies (using macports or brew), and once inside the vpyopmspe11 Python environment, run the `./build_dune_and_opm-flow.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).

## Running pyopmspe11
You can run _pyopmspe11_ as a single command line:
Expand All @@ -48,7 +46,7 @@ pyopmspe11 -i some_input.txt -o some_output_folder
Run `pyopmspe11 --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
folders.
folders. For macOS users, then always add the flag `-u opm` (resdata is the default one).

## Getting started
See the [_documentation_](https://OPM.github.io/pyopmspe11/introduction.html).
Expand Down
8 changes: 6 additions & 2 deletions build_dune_and_opm-flow.bash → build_opm-flow_macOS.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ do
git clone https://github.com/OPM/opm-$repo.git
done

source vpyopmspe11/bin/activate

mkdir build

for repo in common grid models
do
mkdir build/opm-$repo
cd build/opm-$repo
cmake -DUSE_MPI=0 -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
cmake -DPYTHON_EXECUTABLE=$(which python) -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
cd ../..
done
Expand All @@ -33,4 +35,6 @@ mkdir build/opm-simulators
cd build/opm-simulators
cmake -DUSE_MPI=0 -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 ../..
cd ../..

echo "export PYTHONPATH=\$PYTHONPATH:$CURRENT_DIRECTORY/build/opm-common/build/python" >> $CURRENT_DIRECTORY/vpyopmspe11/bin/activate
Binary file added docs/_images/ad-micp.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 added docs/_images/expreccs.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 added docs/_images/pymm.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 added docs/_images/pyopmnearwell.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Welcome to pyopmspe11's documentation!
examples
api
output_folder
related
about

Indices and tables
Expand Down
1 change: 1 addition & 0 deletions docs/_sources/introduction.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ where
- \-g, \-\-generate: Write only the 'dense', 'sparse', 'performance', 'dense_performance', 'performance_sparse', 'dense_sparse', or 'all' ('performance_sparse' by default).
- \-r, \-\-resolution: Number of x, y, and z elements to write the data ('100,10,50' by default).
- \-t, \-\-time: Time interval for the spatial maps (spe11a [h]; spe11b/c [y]) ('5' by default).
- \-u, \-\-use: Using the 'opm' or 'resdata' python package ('resdata' by default).
- \-c, \-\-compare: Generate a common plot for the current folders for 'spe11a', 'spe11b', or 'spe11c' ('' by default).

Installation
Expand Down
42 changes: 42 additions & 0 deletions docs/_sources/related.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
=======
Related
=======

Below are some packages following the same configuration-file-to-postprocessing-folder approach;
check them out :).

*************
pyopmnearwell
*************

.. image:: ./figs/pyopmnearwell.gif
:scale: 50%

`A framework to simulate near well dynamics using OPM Flow <https://github.com/daavid00/pyopmnearwell>`_.

********
expreccs
********

.. image:: ./figs/expreccs.gif
:scale: 50%

`Expansion of ResourCes for CO2 Storage on the Horda Platform <https://github.com/daavid00/expreccs>`_.

*******
ad-micp
*******

.. image:: ./figs/ad-micp.gif
:scale: 40%

`A module to study CO2 leakage remediation by microbially induced calcite precipitation (MICP) <https://github.com/daavid00/ad-micp>`_.

****
pymm
****

.. image:: ./figs/pymm.gif
:scale: 15%

`An open-source image-based framework for CFD in microsystems <https://github.com/daavid00/pymm>`_.
5 changes: 3 additions & 2 deletions docs/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="author" title="About these documents" href="#" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Output folder" href="output_folder.html" />
<link rel="prev" title="Related" href="related.html" />
</head>

<body class="wy-body-for-nav">
Expand Down Expand Up @@ -49,6 +49,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">About pyopmspe11</a></li>
</ul>

Expand Down Expand Up @@ -89,7 +90,7 @@ <h1>About pyopmspe11<a class="headerlink" href="#about-pyopmspe11" title="Link t
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="output_folder.html" class="btn btn-neutral float-left" title="Output folder" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="related.html" class="btn btn-neutral float-left" title="Related" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>

<hr/>
Expand Down
1 change: 1 addition & 0 deletions docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions docs/configuration_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
12 changes: 12 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down Expand Up @@ -82,6 +83,7 @@ <h1 id="index">Index</h1>
| <a href="#D"><strong>D</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
Expand Down Expand Up @@ -123,6 +125,8 @@ <h2 id="D">D</h2>
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyopmspe11.utils.mapproperties.html#pyopmspe11.utils.mapproperties.get_cell_info">get_cell_info() (in module pyopmspe11.utils.mapproperties)</a>
</li>
<li><a href="pyopmspe11.utils.mapproperties.html#pyopmspe11.utils.mapproperties.get_lines">get_lines() (in module pyopmspe11.utils.mapproperties)</a>
</li>
</ul></td>
Expand All @@ -142,6 +146,14 @@ <h2 id="I">I</h2>
</ul></td>
</tr></table>

<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyopmspe11.utils.mapproperties.html#pyopmspe11.utils.mapproperties.locate_wells">locate_wells() (in module pyopmspe11.utils.mapproperties)</a>
</li>
</ul></td>
</tr></table>

<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down
8 changes: 8 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down Expand Up @@ -109,6 +110,13 @@ <h1>Welcome to pyopmspe11’s documentation!<a class="headerlink" href="#welcome
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a><ul>
<li class="toctree-l2"><a class="reference internal" href="related.html#pyopmnearwell">pyopmnearwell</a></li>
<li class="toctree-l2"><a class="reference internal" href="related.html#expreccs">expreccs</a></li>
<li class="toctree-l2"><a class="reference internal" href="related.html#ad-micp">ad-micp</a></li>
<li class="toctree-l2"><a class="reference internal" href="related.html#pymm">pymm</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>
</div>
Expand Down
2 changes: 2 additions & 0 deletions docs/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down Expand Up @@ -107,6 +108,7 @@ <h2>Overview<a class="headerlink" href="#overview" title="Link to this heading">
<li><p>-g, --generate: Write only the ‘dense’, ‘sparse’, ‘performance’, ‘dense_performance’, ‘performance_sparse’, ‘dense_sparse’, or ‘all’ (‘performance_sparse’ by default).</p></li>
<li><p>-r, --resolution: Number of x, y, and z elements to write the data (‘100,10,50’ by default).</p></li>
<li><p>-t, --time: Time interval for the spatial maps (spe11a [h]; spe11b/c [y]) (‘5’ by default).</p></li>
<li><p>-u, --use: Using the ‘opm’ or ‘resdata’ python package (‘resdata’ by default).</p></li>
<li><p>-c, --compare: Generate a common plot for the current folders for ‘spe11a’, ‘spe11b’, or ‘spe11c’ (’’ by default).</p></li>
</ul>
</section>
Expand Down
1 change: 1 addition & 0 deletions docs/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
5 changes: 3 additions & 2 deletions docs/output_folder.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="About pyopmspe11" href="about.html" />
<link rel="next" title="Related" href="related.html" />
<link rel="prev" title="pyopmspe11.utils.writefile module" href="pyopmspe11.utils.writefile.html" />
</head>

Expand Down Expand Up @@ -50,6 +50,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down Expand Up @@ -105,7 +106,7 @@ <h1>Output folder<a class="headerlink" href="#output-folder" title="Link to this
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="pyopmspe11.utils.writefile.html" class="btn btn-neutral float-left" title="pyopmspe11.utils.writefile module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="about.html" class="btn btn-neutral float-right" title="About pyopmspe11" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="related.html" class="btn btn-neutral float-right" title="Related" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

<hr/>
Expand Down
1 change: 1 addition & 0 deletions docs/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions docs/pyopmspe11.core.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions docs/pyopmspe11.core.pyopmspe11.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">pyopmspe11 Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="output_folder.html">Output folder</a></li>
<li class="toctree-l1"><a class="reference internal" href="related.html">Related</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About pyopmspe11</a></li>
</ul>

Expand Down
Loading

0 comments on commit 3f582b7

Please sign in to comment.