Skip to content

Commit

Permalink
Merge pull request #9 from OPM/development
Browse files Browse the repository at this point in the history
Correction to the computation of  normalized total variation of the c…
  • Loading branch information
daavid00 authored Dec 17, 2023
2 parents b6dbb9f + 927ecfb commit 59e33c6
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 24 deletions.
Binary file modified docs/_images/spe11b_performance.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 modified docs/_images/spe11b_performance_finner.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 modified docs/_images/spe11b_sparse_data.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 modified docs/_images/spe11b_sparse_data_finner.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 docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ with grid size of the same order as requested for reporting the spatial data in

.. code-block:: bash
pyopmspe11 -i spe11b.txt -o spe11b_cartesian -m all -g all -r 840,1,120 -t 5
pyopmspe11 -i spe11b.txt -o spe11b_finner -m all -g all -r 840,1,120 -t 5
the following are some of the generated figures:

Expand Down
2 changes: 1 addition & 1 deletion docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h2>Presentation<a class="headerlink" href="#presentation" title="Link to this h
</div>
<p>Then <a class="reference external" href="https://github.com/OPM/pyopmspe11/blob/main/examples">examples/finner_grids</a> folder contains configuration files
with grid size of the same order as requested for reporting the spatial data in the benchmark, as well as the required injection schedules. For example, by executing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pyopmspe11<span class="w"> </span>-i<span class="w"> </span>spe11b.txt<span class="w"> </span>-o<span class="w"> </span>spe11b_cartesian<span class="w"> </span>-m<span class="w"> </span>all<span class="w"> </span>-g<span class="w"> </span>all<span class="w"> </span>-r<span class="w"> </span><span class="m">840</span>,1,120<span class="w"> </span>-t<span class="w"> </span><span class="m">5</span>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pyopmspe11<span class="w"> </span>-i<span class="w"> </span>spe11b.txt<span class="w"> </span>-o<span class="w"> </span>spe11b_finner<span class="w"> </span>-m<span class="w"> </span>all<span class="w"> </span>-g<span class="w"> </span>all<span class="w"> </span>-r<span class="w"> </span><span class="m">840</span>,1,120<span class="w"> </span>-t<span class="w"> </span><span class="m">5</span>
</pre></div>
</div>
<p>the following are some of the generated figures:</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/text/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ with grid size of the same order as requested for reporting the spatial data in

.. code-block:: bash
pyopmspe11 -i spe11b.txt -o spe11b_cartesian -m all -g all -r 840,1,120 -t 5
pyopmspe11 -i spe11b.txt -o spe11b_finner -m all -g all -r 840,1,120 -t 5
the following are some of the generated figures:

Expand Down
Binary file modified docs/text/figs/spe11b_performance.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 modified docs/text/figs/spe11b_performance_finner.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 modified docs/text/figs/spe11b_sparse_data.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 modified docs/text/figs/spe11b_sparse_data_finner.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 src/pyopmspe11/core/pyopmspe11.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def pyopmspe11():
# Write used opm related files
opm_files(dic)

if dic["mode"] in ["all", "deck_flow", "deck_flow_data", "deck_flow_plot"]:
if dic["mode"] in ["all", "flow", "deck_flow", "deck_flow_data", "deck_flow_plot"]:
# Run the simulations
simulations(dic, dic["fol"].upper(), "flow")

Expand Down
45 changes: 26 additions & 19 deletions src/pyopmspe11/visualization/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ def performance(dic):
dic["text"].append(
f"{time:.3e}, "
+ f"{dic['tstep']:.3e}, "
+ f"{sum((fsteps[i] for i in dic['map_info'] if i==j)):.3e}, "
+ f"{sum(fsteps[i] for i in dic['map_info'] if i==j):.3e}, "
+ f"{GAS_DEN_REF*fgip[dic['map_rsteps'][j]-1]:.3e}, "
+ f"{dic['dof'] * dic['nocellsa']:.3e}, "
+ f"{dic['nliters']:.3e}, "
+ f"{sum((nress[i] for i in dic['map_info'] if i==j)):.3e}, "
+ f"{sum(nress[i] for i in dic['map_info'] if i==j):.3e}, "
+ f"{dic['liniters']:.3e}, "
+ f"{sum((runtimes[i] for i in dic['map_info'] if i==j)):.3e}, "
+ f"{sum((tlinsols[i] for i in dic['map_info'] if i==j)):.3e}"
+ f"{sum(runtimes[i] for i in dic['map_info'] if i==j):.3e}, "
+ f"{sum(tlinsols[i] for i in dic['map_info'] if i==j):.3e}"
)
with open(
f"{dic['where']}/{dic['case']}_performance_time_series.csv",
Expand Down Expand Up @@ -398,32 +398,39 @@ def write_sparse_data(dic):
rss * rho * (1.0 - sga) * por * GAS_DEN_REF / WAT_DEN_REF
for (rss, rho, sga, por) in zip(r_s, rhow, sgas, dic["porva"])
]
h2o_l = [
(1 - sga) * rho * por for (sga, rho, por) in zip(sgas, rhow, dic["porva"])
]
dic["xcw"] = [co2 / (co2 + h2o) for (co2, h2o) in zip(co2_d, h2o_l)]
dic["xcw_max"] = max(dic["xcw"][i] for i in dic["boxc"])
if dic["xcw_max"] != 0:
dic["xcw"] = [xcw / dic["xcw_max"] for xcw in dic["xcw"]]
dic["ip1c"] = dic["pressure"][j][dic["sensor1"]] * 1e5 # Pa
dic["ip2c"] = dic["pressure"][j][dic["sensor2"]] * 1e5
dic["moba"] = sum((co2_g[i] * krp[i] for i in dic["boxa"]))
dic["imma"] = sum((co2_g[i] * krm[i] for i in dic["boxa"]))
dic["dissa"] = sum((co2_d[i] for i in dic["boxa"]))
dic["moba"] = sum(co2_g[i] * krp[i] for i in dic["boxa"])
dic["imma"] = sum(co2_g[i] * krm[i] for i in dic["boxa"])
dic["dissa"] = sum(co2_d[i] for i in dic["boxa"])
dic["seala"] = sum(
((co2_g[i] + co2_d[i]) * dic["facie1"][i] for i in dic["boxa"])
(co2_g[i] + co2_d[i]) * dic["facie1"][i] for i in dic["boxa"]
)
dic["mobb"] = sum((co2_g[i] * krp[i] for i in dic["boxb"]))
dic["immb"] = sum((co2_g[i] * krm[i] for i in dic["boxb"]))
dic["dissb"] = sum((co2_d[i] for i in dic["boxb"]))
dic["mobb"] = sum(co2_g[i] * krp[i] for i in dic["boxb"])
dic["immb"] = sum(co2_g[i] * krm[i] for i in dic["boxb"])
dic["dissb"] = sum(co2_d[i] for i in dic["boxb"])
dic["sealb"] = sum(
((co2_g[i] + co2_d[i]) * dic["facie1"][i] for i in dic["boxb"])
(co2_g[i] + co2_d[i]) * dic["facie1"][i] for i in dic["boxb"]
)
dic["sealtot"] = sum(((co2_g[i] + co2_d[i]) for i in dic["facie1ind"]))
dic["sealtot"] = sum((co2_g[i] + co2_d[i]) for i in dic["facie1ind"])
if dic["case"] != "spe11c":
dic["m_c"] = sum(
abs((r_s[i_x] - r_s[i]) * dic["dz"][i])
+ abs((r_s[i_z] - r_s[i]) * dic["dx"][i])
abs((dic["xcw"][i_x] - dic["xcw"][i]) * dic["dz"][i])
+ abs((dic["xcw"][i_z] - dic["xcw"][i]) * dic["dx"][i])
for (i, i_x, i_z) in zip(dic["boxc"], dic["boxc_x"], dic["boxc_z"])
)
else:
dic["m_c"] = sum(
abs((r_s[i_x] - r_s[i]) * dic["dy"][i] * dic["dz"][i])
+ abs((r_s[i_y] - r_s[i]) * dic["dx"][i] * dic["dz"][i])
+ abs((r_s[i_z] - r_s[i]) * dic["dx"][i] * dic["dy"][i])
abs((dic["xcw"][i_x] - dic["xcw"][i]) * dic["dy"][i] * dic["dz"][i])
+ abs((dic["xcw"][i_y] - dic["xcw"][i]) * dic["dx"][i] * dic["dz"][i])
+ abs((dic["xcw"][i_z] - dic["xcw"][i]) * dic["dx"][i] * dic["dy"][i])
for (i, i_x, i_y, i_z) in zip(
dic["boxc"], dic["boxc_x"], dic["boxc_y"], dic["boxc_z"]
)
Expand All @@ -436,7 +443,7 @@ def write_sparse_data(dic):
f",{dic['sealtot']:.3e}"
)
if dic["case"] != "spe11a":
dic["boundtot"] = sum(((co2_g[i] + co2_d[i]) for i in dic["boundariesind"]))
dic["boundtot"] = sum((co2_g[i] + co2_d[i]) for i in dic["boundariesind"])
text[-1] += f",{dic['boundtot']:.3e}"

with open(
Expand Down

0 comments on commit 59e33c6

Please sign in to comment.