Skip to content

Commit

Permalink
Merge pull request #15 from daavid00/developing
Browse files Browse the repository at this point in the history
Back-coupling example in the docs
  • Loading branch information
daavid00 authored Aug 13, 2024
2 parents 2f1af9c + ba49c59 commit b214315
Show file tree
Hide file tree
Showing 23 changed files with 201 additions and 81 deletions.
29 changes: 0 additions & 29 deletions buildopm.sh

This file was deleted.

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/fpr_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/pressure_plopm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions docs/_sources/configuration_file.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ the location of a point of interest to compare results, and the z position of th
Killough hysteresis model on the gas relative permeability.

.. note::
The functionality for back-coupling in line 22 is under development, see/run `back-coupling.txt <https://github.com/cssr-tools/expreccs/blob/main/tests/configs/back-coupling.txt>`_
if you are curious.
The functionality for back-coupling in line 22 is under development, see the :ref:`back_coupling` if you are curious.

.. figure:: figs/grids.png

Expand Down
44 changes: 42 additions & 2 deletions docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Examples
Example 1
---------

We consider the configuration file 'example1.txt' in the
We consider the configuration file `example1.txt <https://github.com/cssr-tools/expreccs/blob/main/examples/example1.txt>`_ in the
examples folder (the animation in the `Github home page <https://github.com/cssr-tools/expreccs>`_ was based on this configuration file).
If the results are to be saved in a folder called 'hello_world', this is achieved by the following command:

Expand Down Expand Up @@ -74,4 +74,44 @@ the pressures are projected.

.. code-block:: bash
expreccs -e name_of_folder_for_the_regional_model,name_of_folder_for_the_site_model
expreccs -e name_of_folder_for_the_regional_model,name_of_folder_for_the_site_model
.. _back_coupling:

Back-coupling (under development)
---------------------------------

We consider the configuration file `example1_back.txt <https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt>`_ in the examples folder.
The plan is to update properties (e.g., transmissibility multipliers) in the regional model from features (e.g., faults) in the site model (i.e., not included in the regional model).
By running:

.. code-block:: bash
expreccs -i example1_back.txt -o back-coupling -m all -p yes
This is one of the generated figures:

.. image:: ./figs/back-coupling_summary_BPR_regional_reference.png

The figures in the postprocessing includes the results for the first two iterations and the last one (in this case 9 since the number of
iteration is set to 10 in line 22 of the `configuration_file <https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt>`_). To visualize/compare results
between any of the iterations, we can use our friend `plopm <https://github.com/cssr-tools/plopm>`_.

.. tip::
You can install plopm by executing in the terminal: pip install git+https://github.com/cssr-tools/plopm.git.

For example, to show the difference in the spatial maps for pressure at iteration 4 and 7 at the third restart, this is achieved by executing:

.. code-block:: bash
plopm -i back-coupling/output/regional_7/regional_7,back-coupling/output/regional_4/regional_4 -v pressure -r 3 -s ,,1 -c rainbow -n "lambda x, _: f'{x:.2f}'" -d 5,5
.. image:: ./figs/pressure_plopm.png

And to show the comparison for the summary vector FPR for iterations 1, 5, 7, and 9:

.. code-block:: bash
plopm -i back-coupling/output/regional_1/regional_1,back-coupling/output/regional_5/regional_5,back-coupling/output/regional_7/regional_7,back-coupling/output/regional_9/regional_9 -v fpr -d 5,5 -f 10
.. image:: ./figs/fpr_plopm.png
3 changes: 1 addition & 2 deletions docs/configuration_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ <h2>Reservoir-related parameters<a class="headerlink" href="#reservoir-related-p
Killough hysteresis model on the gas relative permeability.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The functionality for back-coupling in line 22 is under development, see/run <a class="reference external" href="https://github.com/cssr-tools/expreccs/blob/main/tests/configs/back-coupling.txt">back-coupling.txt</a>
if you are curious.</p>
<p>The functionality for back-coupling in line 22 is under development, see the <a class="reference internal" href="examples.html#back-coupling"><span class="std std-ref">Back-coupling (under development)</span></a> if you are curious.</p>
</div>
<figure class="align-default" id="id1">
<img alt="_images/grids.png" src="_images/grids.png" />
Expand Down
31 changes: 30 additions & 1 deletion docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<li class="toctree-l2"><a class="reference internal" href="#example-1">Example 1</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-2">Example 2</a></li>
<li class="toctree-l2"><a class="reference internal" href="#generic-under-development">Generic (under development)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#back-coupling-under-development">Back-coupling (under development)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html">expreccs Python API</a></li>
Expand Down Expand Up @@ -90,7 +91,7 @@
<h1>Examples<a class="headerlink" href="#examples" title="Link to this heading"></a></h1>
<section id="example-1">
<h2>Example 1<a class="headerlink" href="#example-1" title="Link to this heading"></a></h2>
<p>We consider the configuration file example1.txt in the
<p>We consider the configuration file <a class="reference external" href="https://github.com/cssr-tools/expreccs/blob/main/examples/example1.txt">example1.txt</a> in the
examples folder (the animation in the <a class="reference external" href="https://github.com/cssr-tools/expreccs">Github home page</a> was based on this configuration file).
If the results are to be saved in a folder called ‘hello_world’, this is achieved by the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>expreccs<span class="w"> </span>-i<span class="w"> </span>example1.txt<span class="w"> </span>-o<span class="w"> </span>hello_world
Expand Down Expand Up @@ -157,6 +158,34 @@ <h2>Generic (under development)<a class="headerlink" href="#generic-under-develo
</pre></div>
</div>
</section>
<section id="back-coupling-under-development">
<span id="back-coupling"></span><h2>Back-coupling (under development)<a class="headerlink" href="#back-coupling-under-development" title="Link to this heading"></a></h2>
<p>We consider the configuration file <a class="reference external" href="https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt">example1_back.txt</a> in the examples folder.
The plan is to update properties (e.g., transmissibility multipliers) in the regional model from features (e.g., faults) in the site model (i.e., not included in the regional model).
By running:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>expreccs<span class="w"> </span>-i<span class="w"> </span>example1_back.txt<span class="w"> </span>-o<span class="w"> </span>back-coupling<span class="w"> </span>-m<span class="w"> </span>all<span class="w"> </span>-p<span class="w"> </span>yes
</pre></div>
</div>
<p>This is one of the generated figures:</p>
<img alt="_images/back-coupling_summary_BPR_regional_reference.png" src="_images/back-coupling_summary_BPR_regional_reference.png" />
<p>The figures in the postprocessing includes the results for the first two iterations and the last one (in this case 9 since the number of
iteration is set to 10 in line 22 of the <a class="reference external" href="https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt">configuration_file</a>). To visualize/compare results
between any of the iterations, we can use our friend <a class="reference external" href="https://github.com/cssr-tools/plopm">plopm</a>.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>You can install plopm by executing in the terminal: pip install git+https://github.com/cssr-tools/plopm.git.</p>
</div>
<p>For example, to show the difference in the spatial maps for pressure at iteration 4 and 7 at the third restart, this is achieved by executing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>back-coupling/output/regional_7/regional_7,back-coupling/output/regional_4/regional_4<span class="w"> </span>-v<span class="w"> </span>pressure<span class="w"> </span>-r<span class="w"> </span><span class="m">3</span><span class="w"> </span>-s<span class="w"> </span>,,1<span class="w"> </span>-c<span class="w"> </span>rainbow<span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;lambda x, _: f&#39;{x:.2f}&#39;&quot;</span><span class="w"> </span>-d<span class="w"> </span><span class="m">5</span>,5
</pre></div>
</div>
<img alt="_images/pressure_plopm.png" src="_images/pressure_plopm.png" />
<p>And to show the comparison for the summary vector FPR for iterations 1, 5, 7, and 9:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>back-coupling/output/regional_1/regional_1,back-coupling/output/regional_5/regional_5,back-coupling/output/regional_7/regional_7,back-coupling/output/regional_9/regional_9<span class="w"> </span>-v<span class="w"> </span>fpr<span class="w"> </span>-d<span class="w"> </span><span class="m">5</span>,5<span class="w"> </span>-f<span class="w"> </span><span class="m">10</span>
</pre></div>
</div>
<img alt="_images/fpr_plopm.png" src="_images/fpr_plopm.png" />
</section>
</section>


Expand Down
1 change: 1 addition & 0 deletions docs/expreccs.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Link to this hea
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="expreccs.visualization.reading.html">expreccs.visualization.reading module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.define_cases"><code class="docutils literal notranslate"><span class="pre">define_cases()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.handle_smsp_time"><code class="docutils literal notranslate"><span class="pre">handle_smsp_time()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.manage_names"><code class="docutils literal notranslate"><span class="pre">manage_names()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.opm_arrays"><code class="docutils literal notranslate"><span class="pre">opm_arrays()</span></code></a></li>
Expand Down
1 change: 1 addition & 0 deletions docs/expreccs.visualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="expreccs.visualization.reading.html">expreccs.visualization.reading module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.define_cases"><code class="docutils literal notranslate"><span class="pre">define_cases()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.handle_smsp_time"><code class="docutils literal notranslate"><span class="pre">handle_smsp_time()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.manage_names"><code class="docutils literal notranslate"><span class="pre">manage_names()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="expreccs.visualization.reading.html#expreccs.visualization.reading.opm_arrays"><code class="docutils literal notranslate"><span class="pre">opm_arrays()</span></code></a></li>
Expand Down
14 changes: 14 additions & 0 deletions docs/expreccs.visualization.reading.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@
<span id="expreccs-visualization-reading-module"></span><h1>expreccs.visualization.reading module<a class="headerlink" href="#module-expreccs.visualization.reading" title="Link to this heading"></a></h1>
<p>
Script to read OPM Flow output files</p>
<dl class="py function">
<dt class="sig sig-object py" id="expreccs.visualization.reading.define_cases">
<span class="sig-prename descclassname"><span class="pre">expreccs.visualization.reading.</span></span><span class="sig-name descname"><span class="pre">define_cases</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dic</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">folders</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#expreccs.visualization.reading.define_cases" title="Link to this definition"></a></dt>
<dd><p>Only plot the first two and last cases for the back-coupling</p>
<dl>
<dt>Args:</dt><dd><p>dic (dict): Global dictionary</p>
<p>fol (str): Name of the output folder</p>
<p>folders (list): Names of the cases</p>
</dd>
<dt>Returns:</dt><dd><p>dic (dict): Modified global dictionary</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="expreccs.visualization.reading.handle_smsp_time">
<span class="sig-prename descclassname"><span class="pre">expreccs.visualization.reading.</span></span><span class="sig-name descname"><span class="pre">handle_smsp_time</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dic</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">res</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#expreccs.visualization.reading.handle_smsp_time" title="Link to this definition"></a></dt>
Expand Down
4 changes: 4 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ <h2 id="C">C</h2>

<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="expreccs.visualization.reading.html#expreccs.visualization.reading.define_cases">define_cases() (in module expreccs.visualization.reading)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="expreccs.utils.reg_sit_given_decks.html#expreccs.utils.reg_sit_given_decks.dynamic_mapping">dynamic_mapping() (in module expreccs.utils.reg_sit_given_decks)</a>
</li>
Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ <h1>Welcome to expreccs’s documentation!<a class="headerlink" href="#welcome-t
<li class="toctree-l2"><a class="reference internal" href="examples.html#example-1">Example 1</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#example-2">Example 2</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#generic-under-development">Generic (under development)</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#back-coupling-under-development">Back-coupling (under development)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html">expreccs Python API</a><ul>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions docs/text/configuration_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ the location of a point of interest to compare results, and the z position of th
Killough hysteresis model on the gas relative permeability.

.. note::
The functionality for back-coupling in line 22 is under development, see/run `back-coupling.txt <https://github.com/cssr-tools/expreccs/blob/main/tests/configs/back-coupling.txt>`_
if you are curious.
The functionality for back-coupling in line 22 is under development, see the :ref:`back_coupling` if you are curious.

.. figure:: figs/grids.png

Expand Down
44 changes: 42 additions & 2 deletions docs/text/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Examples
Example 1
---------

We consider the configuration file 'example1.txt' in the
We consider the configuration file `example1.txt <https://github.com/cssr-tools/expreccs/blob/main/examples/example1.txt>`_ in the
examples folder (the animation in the `Github home page <https://github.com/cssr-tools/expreccs>`_ was based on this configuration file).
If the results are to be saved in a folder called 'hello_world', this is achieved by the following command:

Expand Down Expand Up @@ -74,4 +74,44 @@ the pressures are projected.

.. code-block:: bash
expreccs -e name_of_folder_for_the_regional_model,name_of_folder_for_the_site_model
expreccs -e name_of_folder_for_the_regional_model,name_of_folder_for_the_site_model
.. _back_coupling:

Back-coupling (under development)
---------------------------------

We consider the configuration file `example1_back.txt <https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt>`_ in the examples folder.
The plan is to update properties (e.g., transmissibility multipliers) in the regional model from features (e.g., faults) in the site model (i.e., not included in the regional model).
By running:

.. code-block:: bash
expreccs -i example1_back.txt -o back-coupling -m all -p yes
This is one of the generated figures:

.. image:: ./figs/back-coupling_summary_BPR_regional_reference.png

The figures in the postprocessing includes the results for the first two iterations and the last one (in this case 9 since the number of
iteration is set to 10 in line 22 of the `configuration_file <https://github.com/cssr-tools/expreccs/blob/main/examples/example1_back.txt>`_). To visualize/compare results
between any of the iterations, we can use our friend `plopm <https://github.com/cssr-tools/plopm>`_.

.. tip::
You can install plopm by executing in the terminal: pip install git+https://github.com/cssr-tools/plopm.git.

For example, to show the difference in the spatial maps for pressure at iteration 4 and 7 at the third restart, this is achieved by executing:

.. code-block:: bash
plopm -i back-coupling/output/regional_7/regional_7,back-coupling/output/regional_4/regional_4 -v pressure -r 3 -s ,,1 -c rainbow -n "lambda x, _: f'{x:.2f}'" -d 5,5
.. image:: ./figs/pressure_plopm.png

And to show the comparison for the summary vector FPR for iterations 1, 5, 7, and 9:

.. code-block:: bash
plopm -i back-coupling/output/regional_1/regional_1,back-coupling/output/regional_5/regional_5,back-coupling/output/regional_7/regional_7,back-coupling/output/regional_9/regional_9 -v fpr -d 5,5 -f 10
.. image:: ./figs/fpr_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/text/figs/fpr_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/text/figs/pressure_plopm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/example1_back.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pres #Use free/closed/porv/porvproj/flux/pres/pres2p/well
7000 7000 0 #Sensor position x, y, and z to assess the error over time w.r.t the reference solution [m]
0 #The function for the reservoir surface
0 0 #Add hysteresis (1/0) and salinity (value [1E-3 kg-M/kg])
3 #Number of interations for back-coupling
10 #Number of interations for back-coupling

"""Set the saturation functions"""
krw * ((sw - swi) / (1.0 - sni -swi)) ** nkrw #Wetting rel perm saturation function [-]
Expand Down
Loading

0 comments on commit b214315

Please sign in to comment.