Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

# pofff: An open-source image-based history-matching framework for the FluidFlower benchmark study using OPM Flow

<img src="docs/text/figs/pofff.png" width="830" height="247">
<center><img src="docs/text/figs/pofff+plopm_xco2l.gif" width="830" height="auto" /></center>
<center><img src="docs/text/figs/pofff.png" width="830" height="auto"></center>

This repository contains runscripts to simulate CO2 injection in the
[_fluidflower benchmark system_](https://fluidflower.w.uib.no) using the
Expand Down
Binary file removed docs/_images/plopm_xco2l.gif
Binary file not shown.
Binary file added docs/_images/pofff+plopm_xco2l.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ Then the following GIF is generated by:

.. code-block:: bash

pofff -i appendixb.toml -o plopm -m single -c '5e-2' -f none
plopm -v xco2l -i plopm/PLOPM -d 8,2.5 -mask satnum -m gif -dpi 1000 -f 12 -loop 1 -cformat .2f -cbsfax 0.30,0.01,0.4,0.02 -remove 0,0,1,0 -interval 437.5 -maskthr 1e-5 -tunits h
pofff -i appendixb.toml -o plopm+pofff -m single -c '5e-2' -f none
plopm -v xco2l -i 'pofff+plopm/POFFF+PLOPM' -d 16,5 -mask satnum -m gif -dpi 1000 -f 20 -loop 1 -cformat .1e -cbsfax 0.30,0.01,0.4,0.02 -interval 437.5 -maskthr 1e-5 -tunits h -cnum 5 -clabel 'CO$_2$ mass fraction in liquid [-]' -t 'FluidFlower simulation (GitHub/cssr-tools/pofff),'

.. image:: ./figs/plopm_xco2l.gif
.. figure:: figs/pofff+plopm_xco2l.gif

The total simulation time for this GIF (five days of experiment) using eight CPUs for OPM Flow in a Mac is **LESS THAN TWO MINUTES!!!**



See the `plopm online docmunetation <https://cssr-tools.github.io/plopm/>`_ for additional information of supported flag parameters to generate customized PNGs and GIFs.
11 changes: 8 additions & 3 deletions docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ <h2>Visualization<a class="headerlink" href="#visualization" title="Link to this
</div>
<p>Then the following GIF is generated by:</p>
<blockquote>
<div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pofff<span class="w"> </span>-i<span class="w"> </span>appendixb.toml<span class="w"> </span>-o<span class="w"> </span>plopm<span class="w"> </span>-m<span class="w"> </span>single<span class="w"> </span>-c<span class="w"> </span><span class="s1">&#39;5e-2&#39;</span><span class="w"> </span>-f<span class="w"> </span>none
plopm<span class="w"> </span>-v<span class="w"> </span>xco2l<span class="w"> </span>-i<span class="w"> </span>plopm/PLOPM<span class="w"> </span>-d<span class="w"> </span><span class="m">8</span>,2.5<span class="w"> </span>-mask<span class="w"> </span>satnum<span class="w"> </span>-m<span class="w"> </span>gif<span class="w"> </span>-dpi<span class="w"> </span><span class="m">1000</span><span class="w"> </span>-f<span class="w"> </span><span class="m">12</span><span class="w"> </span>-loop<span class="w"> </span><span class="m">1</span><span class="w"> </span>-cformat<span class="w"> </span>.2f<span class="w"> </span>-cbsfax<span class="w"> </span><span class="m">0</span>.30,0.01,0.4,0.02<span class="w"> </span>-remove<span class="w"> </span><span class="m">0</span>,0,1,0<span class="w"> </span>-interval<span class="w"> </span><span class="m">437</span>.5<span class="w"> </span>-maskthr<span class="w"> </span>1e-5<span class="w"> </span>-tunits<span class="w"> </span>h
<div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pofff<span class="w"> </span>-i<span class="w"> </span>appendixb.toml<span class="w"> </span>-o<span class="w"> </span>plopm+pofff<span class="w"> </span>-m<span class="w"> </span>single<span class="w"> </span>-c<span class="w"> </span><span class="s1">&#39;5e-2&#39;</span><span class="w"> </span>-f<span class="w"> </span>none
plopm<span class="w"> </span>-v<span class="w"> </span>xco2l<span class="w"> </span>-i<span class="w"> </span><span class="s1">&#39;pofff+plopm/POFFF+PLOPM&#39;</span><span class="w"> </span>-d<span class="w"> </span><span class="m">16</span>,5<span class="w"> </span>-mask<span class="w"> </span>satnum<span class="w"> </span>-m<span class="w"> </span>gif<span class="w"> </span>-dpi<span class="w"> </span><span class="m">1000</span><span class="w"> </span>-f<span class="w"> </span><span class="m">20</span><span class="w"> </span>-loop<span class="w"> </span><span class="m">1</span><span class="w"> </span>-cformat<span class="w"> </span>.1e<span class="w"> </span>-cbsfax<span class="w"> </span><span class="m">0</span>.30,0.01,0.4,0.02<span class="w"> </span>-interval<span class="w"> </span><span class="m">437</span>.5<span class="w"> </span>-maskthr<span class="w"> </span>1e-5<span class="w"> </span>-tunits<span class="w"> </span>h<span class="w"> </span>-cnum<span class="w"> </span><span class="m">5</span><span class="w"> </span>-clabel<span class="w"> </span><span class="s1">&#39;CO$_2$ mass fraction in liquid [-]&#39;</span><span class="w"> </span>-t<span class="w"> </span><span class="s1">&#39;FluidFlower simulation (GitHub/cssr-tools/pofff),&#39;</span>
</pre></div>
</div>
</div></blockquote>
<img alt="_images/plopm_xco2l.gif" src="_images/plopm_xco2l.gif" />
<figure class="align-default" id="id3">
<img alt="_images/pofff%2Bplopm_xco2l.gif" src="_images/pofff%2Bplopm_xco2l.gif" />
<figcaption>
<p><span class="caption-text">The total simulation time for this GIF (five days of experiment) using eight CPUs for OPM Flow in a Mac is <strong>LESS THAN TWO MINUTES!!!</strong></span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>See the <a class="reference external" href="https://cssr-tools.github.io/plopm/">plopm online docmunetation</a> for additional information of supported flag parameters to generate customized PNGs and GIFs.</p>
</section>
</section>
Expand Down
2 changes: 1 addition & 1 deletion docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ <h2 id="P">P</h2>
</ul></li>
<li><a href="pofff.visualization.everert.html#pofff.visualization.everert.plot_cumulative_misfit">plot_cumulative_misfit() (in module pofff.visualization.everert)</a>
</li>
<li><a href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_missmatch">plot_hm_missmatch() (in module pofff.visualization.everert)</a>
<li><a href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_mismatch">plot_hm_mismatch() (in module pofff.visualization.everert)</a>
</li>
<li><a href="pofff.visualization.everert.html#pofff.visualization.everert.plot_misfit">plot_misfit() (in module pofff.visualization.everert)</a>
</li>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/pofff.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Link to this hea
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.main"><code class="docutils literal notranslate"><span class="pre">main()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.parse_args"><code class="docutils literal notranslate"><span class="pre">parse_args()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_cumulative_misfit"><code class="docutils literal notranslate"><span class="pre">plot_cumulative_misfit()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_missmatch"><code class="docutils literal notranslate"><span class="pre">plot_hm_missmatch()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_mismatch"><code class="docutils literal notranslate"><span class="pre">plot_hm_mismatch()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_misfit"><code class="docutils literal notranslate"><span class="pre">plot_misfit()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_observable_distribution"><code class="docutils literal notranslate"><span class="pre">plot_observable_distribution()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_optimization"><code class="docutils literal notranslate"><span class="pre">plot_optimization()</span></code></a></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/pofff.visualization.everert.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pofff.visualization.everert.plot_hm_missmatch">
<span class="sig-prename descclassname"><span class="pre">pofff.visualization.everert.</span></span><span class="sig-name descname"><span class="pre">plot_hm_missmatch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pofff.visualization.everert.Config" title="pofff.visualization.everert.Config"><span class="pre">Config</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">state</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pofff.visualization.everert.EnsembleState" title="pofff.visualization.everert.EnsembleState"><span class="pre">EnsembleState</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pofff.visualization.everert.plot_hm_missmatch" title="Link to this definition"></a></dt>
<dt class="sig sig-object py" id="pofff.visualization.everert.plot_hm_mismatch">
<span class="sig-prename descclassname"><span class="pre">pofff.visualization.everert.</span></span><span class="sig-name descname"><span class="pre">plot_hm_mismatch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pofff.visualization.everert.Config" title="pofff.visualization.everert.Config"><span class="pre">Config</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">state</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pofff.visualization.everert.EnsembleState" title="pofff.visualization.everert.EnsembleState"><span class="pre">EnsembleState</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pofff.visualization.everert.plot_hm_mismatch" title="Link to this definition"></a></dt>
<dd><p>Plot ensemble-mean misfit per iteration.</p>
</dd></dl>

Expand Down
2 changes: 1 addition & 1 deletion docs/pofff.visualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.main"><code class="docutils literal notranslate"><span class="pre">main()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.parse_args"><code class="docutils literal notranslate"><span class="pre">parse_args()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_cumulative_misfit"><code class="docutils literal notranslate"><span class="pre">plot_cumulative_misfit()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_missmatch"><code class="docutils literal notranslate"><span class="pre">plot_hm_missmatch()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_hm_mismatch"><code class="docutils literal notranslate"><span class="pre">plot_hm_mismatch()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_misfit"><code class="docutils literal notranslate"><span class="pre">plot_misfit()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_observable_distribution"><code class="docutils literal notranslate"><span class="pre">plot_observable_distribution()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pofff.visualization.everert.html#pofff.visualization.everert.plot_optimization"><code class="docutils literal notranslate"><span class="pre">plot_optimization()</span></code></a></li>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions docs/text/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ Then the following GIF is generated by:

.. code-block:: bash

pofff -i appendixb.toml -o plopm -m single -c '5e-2' -f none
plopm -v xco2l -i plopm/PLOPM -d 8,2.5 -mask satnum -m gif -dpi 1000 -f 12 -loop 1 -cformat .2f -cbsfax 0.30,0.01,0.4,0.02 -remove 0,0,1,0 -interval 437.5 -maskthr 1e-5 -tunits h
pofff -i appendixb.toml -o plopm+pofff -m single -c '5e-2' -f none
plopm -v xco2l -i 'pofff+plopm/POFFF+PLOPM' -d 16,5 -mask satnum -m gif -dpi 1000 -f 20 -loop 1 -cformat .1e -cbsfax 0.30,0.01,0.4,0.02 -interval 437.5 -maskthr 1e-5 -tunits h -cnum 5 -clabel 'CO$_2$ mass fraction in liquid [-]' -t 'FluidFlower simulation (GitHub/cssr-tools/pofff),'

.. image:: ./figs/plopm_xco2l.gif
.. figure:: figs/pofff+plopm_xco2l.gif

The total simulation time for this GIF (five days of experiment) using eight CPUs for OPM Flow in a Mac is **LESS THAN TWO MINUTES!!!**



See the `plopm online docmunetation <https://cssr-tools.github.io/plopm/>`_ for additional information of supported flag parameters to generate customized PNGs and GIFs.
Binary file removed docs/text/figs/plopm_xco2l.gif
Binary file not shown.
Binary file added docs/text/figs/pofff+plopm_xco2l.gif
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/ert.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ krn="(max(0, (1 - sw - sni) / (1 - sni))) ** nkrn" #Non-wetting rel perm
cap="pen * ((sw-swi) / (1-swi)) ** (-(1.0 / npen))" #Capillary pressure saturation function [Pa]

# Ert
ertargs = "test_run" # Command line for Ert: gui, test_run, ensemble_experiment, ensemble_smoother, iterative_ensemble_smoother, and es_mda
ertargs = "es_mda --weights 1" # Command line for Ert: gui, test_run, ensemble_experiment, ensemble_smoother, iterative_ensemble_smoother, and es_mda
min_realizations_success = 0 # Minimum number of simulations that must have succeeded for the simulation to be regarded as a success.
ensembles = 8 # Number of members in each ensemble
random_seed = 7 # Set a specific seed for reproducibility; a value of 0 means no seed (rng for everest and random_seed for ert)
Expand Down
2 changes: 1 addition & 1 deletion examples/everest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cap="pen * ((sw-swi) / (1-swi)) ** (-(1.0 / npen))" #Capillary pressure s

# Everest
min_realizations_success = 0 # Minimum number of simulations that must have succeeded for the simulation to be regarded as a success
max_function_evaluations = 2 # Maximum number of simulations
max_function_evaluations = 20 # Maximum number of simulations
rng = 7 # Set a specific seed for reproducibility; a value of 0 means no seed (rng for everest and random_seed for ert)
cores = 8 # Maximum number of simulations running in parallel
maxtime = 120 # Maximum runtime in seconds of a realization; a value of 0 means unlimited runtime
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
dependencies = [
"alive-progress",
"ert<=21.0.6",
"ert<=21.0.7",
"iterative_ensemble_smoother",
"mako",
"matplotlib",
Expand All @@ -36,7 +36,7 @@ dependencies = [
"scipy",
"shapely"
]
requires-python = ">=3.11"
requires-python = ">=3.12"

[project.scripts]
pofff = "pofff.core.pofff:main"
Expand Down
4 changes: 0 additions & 4 deletions src/pofff/fluidflower/general/evaluation/emd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def calculateEMD(inFileName1, inFileName2):
a_flat = a.flatten(order="F")
b_flat = b.flatten(order="F")

# Cell centers of all cells - x and y coordinates.
cc_x = np.zeros((Nx, Ny), dtype=float).flatten("F")
cc_y = np.zeros((Nx, Ny), dtype=float).flatten("F")

cc_x, cc_y = np.meshgrid(np.arange(Nx), np.arange(Ny), indexing="ij")

cc_x_flat = cc_x.flatten("F") / Nx * 2.8 + 5e-3 * 280 / Nx
Expand Down
4 changes: 0 additions & 4 deletions src/pofff/jobs/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ def calculate_emd(file_1, file_2):
a_flat = a_1.flatten(order="F")
b_flat = b_1.flatten(order="F")

# --- Cell center coordinates (fixed definition) ---
cc_x = np.zeros((n_x, n_z), dtype=float).flatten("F")
cc_y = np.zeros((n_x, n_z), dtype=float).flatten("F")

cc_x, cc_y = np.meshgrid(np.arange(n_x), np.arange(n_z), indexing="ij")

cc_x_flat = cc_x.flatten("F") / n_x * 2.8 + 5e-3 * 280 / n_x
Expand Down
8 changes: 4 additions & 4 deletions src/pofff/visualization/everert.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def plot_misfit(cfg: Config, state: EnsembleState):
ax.set_title(
r"$O_{i,j}=\frac{1}{2N_{obs}}\sum_n^{N_{obs}}((d^{n}_{i,j}-d^{n})/\sigma_n)^2$"
)
save_figure(fig, cfg.path / "figures/dist_missmatch.png")
save_figure(fig, cfg.path / "figures/dist_mismatch.png")


def plot_parameter_distributions(cfg: Config, state: EnsembleState):
Expand Down Expand Up @@ -542,7 +542,7 @@ def plot_observable_distribution(cfg: Config, state: EnsembleState):
save_figure(fig, cfg.path / "figures/dist_observable.png")


def plot_hm_missmatch(cfg: Config, state: EnsembleState):
def plot_hm_mismatch(cfg: Config, state: EnsembleState):
"""Plot ensemble-mean misfit per iteration."""
fig, ax = plt.subplots()

Expand All @@ -561,7 +561,7 @@ def plot_hm_missmatch(cfg: Config, state: EnsembleState):
ax.set_xticks(range(state.n_i))
ax.legend()

save_figure(fig, cfg.path / "figures/hm_missmatch.png")
save_figure(fig, cfg.path / "figures/hm_mismatch.png")


def plot_cumulative_misfit(cfg: Config, state: EnsembleState, tab20):
Expand Down Expand Up @@ -670,7 +670,7 @@ def main():
read_realisation(cfg, state, i, j)

plot_simulation_ensemble(cfg, state, tab20)
plot_hm_missmatch(cfg, state)
plot_hm_mismatch(cfg, state)
plot_misfit(cfg, state)
plot_observable_distribution(cfg, state)
plot_parameter_distributions(cfg, state)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_2_ert.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ def test_ert(tmp_path, monkeypatch):
check=True,
)
base = tmp_path / "ert" / "figures"
assert (base / "hm_missmatch.png").is_file()
assert (base / "hm_mismatch.png").is_file()
assert (base / "best_simulation" / "spatial_map_0.25h.csv").is_file()
Loading