Skip to content

Commit

Permalink
resdata dependency instead of ecl
Browse files Browse the repository at this point in the history
  • Loading branch information
daavid00 committed Nov 22, 2023
1 parent 77bf6f2 commit 7fdb30a
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
pull_request:

jobs:
run-pyff-local:
run-pyopmspe11-local:
timeout-minutes: 30
strategy:
fail-fast: false
Expand Down
16 changes: 6 additions & 10 deletions docs/_sources/configuration_file.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,13 @@ The following entries define the properties of the different facies:
PERM4 506.625 PORO4 0.20 THCONR4 1.25
PERM5 1013.25 PORO5 0.25 THCONR5 0.92
PERM6 2026.50 PORO6 0.35 THCONR6 0.26
PERM7 0 PORO7 1E-6 THCONR7 2.00
PERM7 0 PORO7 0 THCONR7 2.00
.. figure:: figs/kr.png
.. figure:: figs/cap.png

Visualization in ResInsight of the relative permeability and capillary pressure functions in the facie 1.

.. note::
For spe11b/c, adding a small value of porosity in facie 7 (i.e., 1E-6 in this example), allows to include the termal effects
from the caprock (facie 7).

***********************
Well-related parameters
***********************
Expand All @@ -127,11 +123,11 @@ The last part of the configuration file sets the wells radius, location, and the
"""Define the injection values ([hours] for spe11a; [years] for spe11b/c)"""
"""injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ..."""
995 995 1 0 0 10 0 0 10
5 5 1 0 0 10 0 0 10
25 5 1 1 50 10 0 0 10
25 5 1 1 50 10 1 50 10
950 5 1 0 0 10 0 0 10
995 995 1 0 0 10 0 0 10
5 5 1 0 0 10 0 0 10
25 5 .1 1 50 10 0 0 10
25 5 .1 1 50 10 1 50 10
950 5 1 0 0 10 0 0 10
.. warning::
Keep the linebreak between the sections (in the current implementation this is used for the reading of the parameters).
17 changes: 6 additions & 11 deletions docs/configuration_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ <h2>Soil-related parameters<a class="headerlink" href="#soil-related-parameters"
<span class="linenos">40</span><span class="n">PERM4</span> <span class="mf">506.625</span> <span class="n">PORO4</span> <span class="mf">0.20</span> <span class="n">THCONR4</span> <span class="mf">1.25</span>
<span class="linenos">41</span><span class="n">PERM5</span> <span class="mf">1013.25</span> <span class="n">PORO5</span> <span class="mf">0.25</span> <span class="n">THCONR5</span> <span class="mf">0.92</span>
<span class="linenos">42</span><span class="n">PERM6</span> <span class="mf">2026.50</span> <span class="n">PORO6</span> <span class="mf">0.35</span> <span class="n">THCONR6</span> <span class="mf">0.26</span>
<span class="linenos">43</span><span class="n">PERM7</span> <span class="mi">0</span> <span class="n">PORO7</span> <span class="mf">1E-6</span> <span class="n">THCONR7</span> <span class="mf">2.00</span>
<span class="linenos">43</span><span class="n">PERM7</span> <span class="mi">0</span> <span class="n">PORO7</span> <span class="mi">0</span> <span class="n">THCONR7</span> <span class="mf">2.00</span>
</pre></div>
</div>
<figure class="align-default">
Expand All @@ -186,11 +186,6 @@ <h2>Soil-related parameters<a class="headerlink" href="#soil-related-parameters"
<p><span class="caption-text">Visualization in ResInsight of the relative permeability and capillary pressure functions in the facie 1.</span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
</figcaption>
</figure>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For spe11b/c, adding a small value of porosity in facie 7 (i.e., 1E-6 in this example), allows to include the termal effects
from the caprock (facie 7).</p>
</div>
</section>
<section id="well-related-parameters">
<h2>Well-related parameters<a class="headerlink" href="#well-related-parameters" title="Link to this heading"></a></h2>
Expand All @@ -202,11 +197,11 @@ <h2>Well-related parameters<a class="headerlink" href="#well-related-parameters"
<span class="linenos">49</span>
<span class="linenos">50</span><span class="sd">&quot;&quot;&quot;Define the injection values ([hours] for spe11a; [years] for spe11b/c)&quot;&quot;&quot;</span>
<span class="linenos">51</span><span class="sd">&quot;&quot;&quot;injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ...&quot;&quot;&quot;</span>
<span class="linenos">52</span><span class="mi">995</span> <span class="mi">995</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">53</span> <span class="mi">5</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">54</span> <span class="mi">25</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">55</span> <span class="mi">25</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span>
<span class="linenos">56</span><span class="mi">950</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">52</span><span class="mi">995</span> <span class="mi">995</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">53</span> <span class="mi">5</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">54</span> <span class="mi">25</span> <span class="mi">5</span> <span class="mf">.1</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
<span class="linenos">55</span> <span class="mi">25</span> <span class="mi">5</span> <span class="mf">.1</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span> <span class="mi">1</span> <span class="mi">50</span> <span class="mi">10</span>
<span class="linenos">56</span><span class="mi">950</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">10</span>
</pre></div>
</div>
<div class="admonition warning">
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions docs/text/configuration_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,13 @@ The following entries define the properties of the different facies:
PERM4 506.625 PORO4 0.20 THCONR4 1.25
PERM5 1013.25 PORO5 0.25 THCONR5 0.92
PERM6 2026.50 PORO6 0.35 THCONR6 0.26
PERM7 0 PORO7 1E-6 THCONR7 2.00
PERM7 0 PORO7 0 THCONR7 2.00
.. figure:: figs/kr.png
.. figure:: figs/cap.png

Visualization in ResInsight of the relative permeability and capillary pressure functions in the facie 1.

.. note::
For spe11b/c, adding a small value of porosity in facie 7 (i.e., 1E-6 in this example), allows to include the termal effects
from the caprock (facie 7).

***********************
Well-related parameters
***********************
Expand All @@ -127,11 +123,11 @@ The last part of the configuration file sets the wells radius, location, and the
"""Define the injection values ([hours] for spe11a; [years] for spe11b/c)"""
"""injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ..."""
995 995 1 0 0 10 0 0 10
5 5 1 0 0 10 0 0 10
25 5 1 1 50 10 0 0 10
25 5 1 1 50 10 1 50 10
950 5 1 0 0 10 0 0 10
995 995 1 0 0 10 0 0 10
5 5 1 0 0 10 0 0 10
25 5 .1 1 50 10 0 0 10
25 5 .1 1 50 10 1 50 10
950 5 1 0 0 10 0 0 10
.. warning::
Keep the linebreak between the sections (in the current implementation this is used for the reading of the parameters).
6 changes: 3 additions & 3 deletions examples/spe11b.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PERM3 202.650 PORO3 0.20 THCONR3 1.25
PERM4 506.625 PORO4 0.20 THCONR4 1.25
PERM5 1013.25 PORO5 0.25 THCONR5 0.92
PERM6 2026.50 PORO6 0.35 THCONR6 0.26
PERM7 0 PORO7 1E-6 THCONR7 2.00
PERM7 0 PORO7 0 THCONR7 2.00

"""Wells radius and position"""
"""radius, x, y, and z position [m] (final positions as well for spe11c)"""
Expand All @@ -51,6 +51,6 @@ PERM7 0 PORO7 1E-6 THCONR7 2.00
"""injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ..."""
995 995 199 0 0 10 0 0 10
5 5 5 0 0 10 0 0 10
25 5 1 1 0.035 10 0 0 10
25 5 1 1 0.035 10 1 0.035 10
25 5 .1 1 0.035 10 0 0 10
25 5 .1 1 0.035 10 1 0.035 10
950 5 1 0 0 10 0 0 10
6 changes: 3 additions & 3 deletions examples/spe11c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PERM3 202.650 PORO3 0.20 THCONR3 1.25
PERM4 506.625 PORO4 0.20 THCONR4 1.25
PERM5 1013.25 PORO5 0.25 THCONR5 0.92
PERM6 2026.50 PORO6 0.35 THCONR6 0.26
PERM7 0 PORO7 1E-6 THCONR7 2.00
PERM7 0 PORO7 0 THCONR7 2.00

"""Wells radius and position"""
"""radius, x, y, and z position [m] (final positions as well for spe11c)"""
Expand All @@ -51,6 +51,6 @@ PERM7 0 PORO7 1E-6 THCONR7 2.00
"""injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ..."""
995 995 199 0 0 10 0 0 10
5 5 5 0 0 10 0 0 10
25 5 1 1 50 10 0 0 10
25 5 1 1 50 10 1 50 10
25 5 .1 1 50 10 0 0 10
25 5 .1 1 50 10 1 50 10
950 5 1 0 0 10 0 0 10
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ecl
mako
matplotlib
resdata
shapely
2 changes: 1 addition & 1 deletion src/pyopmspe11/core/pyopmspe11.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def pyopmspe11():
initial(dic)
os.chdir(f"{dic['exe']}/{dic['fol']}/deck")
simulations(dic, "INITIAL", "flow")

print("Files used to generate the corner-point grid (INITIAL.* files)")
# Get the sand and well positions
dic = positions(dic)

Expand Down
12 changes: 7 additions & 5 deletions src/pyopmspe11/templates/common/deck_initial.mako
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUNSPEC
DIMENS
${dic["noCells"][0]} 1 ${dic["noCells"][2]} /

OIL
GAS
WATER
CO2STORE

EQLDIMS
Expand All @@ -17,7 +17,7 @@ TABDIMS
/

WELLDIMS
10 60 10 20 /
/

UNIFOUT
----------------------------------------------------------------------------
Expand All @@ -43,17 +43,19 @@ PERMX PERMZ /
----------------------------------------------------------------------------
PROPS
----------------------------------------------------------------------------
SGOF
SGWFN
0. 0. 1. 0.
1. 1. 0. 0. /
----------------------------------------------------------------------------
SOLUTION
----------------------------------------------------------------------------
EQUIL
0 2 10 /
0 1 0 /

RPTRST
BASIC=2 /
----------------------------------------------------------------------------
SCHEDULE
----------------------------------------------------------------------------
----------------------------------------------------------------------------
TSTEP
1E-4 /
6 changes: 3 additions & 3 deletions src/pyopmspe11/utils/mapproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import csv
import numpy as np
import pandas as pd
from ecl.grid import EclGrid
from resdata.grid import Grid
from shapely.geometry import Polygon


Expand Down Expand Up @@ -182,7 +182,7 @@ def corner_point_handling_spe11a(dic):
"""
well1, well2, sensor1, sensor2 = [], [], [], []
gridf = EclGrid(f"{dic['exe']}/{dic['fol']}/flow/INITIAL.EGRID")
gridf = Grid(f"{dic['exe']}/{dic['fol']}/flow/INITIAL.EGRID")
dic["wellijk"] = [[] for _ in range(len(dic["wellCoord"]))]
for cell in gridf.cells():
fgl = pd.Series(
Expand Down Expand Up @@ -230,7 +230,7 @@ def corner_point_handling_spe11bc(dic):
"""
well1, well2, sensor1, sensor2, xtemp = [], [], [], [], []
gridf = EclGrid(f"{dic['exe']}/{dic['fol']}/flow/INITIAL.EGRID")
gridf = Grid(f"{dic['exe']}/{dic['fol']}/flow/INITIAL.EGRID")
dic["wellijk"] = [[] for _ in range(len(dic["wellCoord"]))]
for cell in gridf.cells():
xtemp.append(cell.coordinate[0])
Expand Down
1 change: 1 addition & 0 deletions src/pyopmspe11/utils/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def plotting(dic):
"-p " + f"{dic['fol']}",
"-d " + f"{dic['spe11']}",
"-g " + f"{dic['generate']}",
"-r " + f"{dic['resolution']}",
"-t " + f"{dic['time_data']}",
]
print(" ".join(plot_exe))
Expand Down
15 changes: 9 additions & 6 deletions src/pyopmspe11/visualization/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from io import StringIO
import numpy as np
import pandas as pd
from ecl.grid import EclGrid
from ecl.eclfile import EclFile
from ecl.summary import EclSum
from resdata.grid import Grid
from resdata.resfile import ResdataFile
from resdata.summary import Summary

GAS_DEN_REF = 1.86843
WAT_DEN_REF = 998.108
Expand Down Expand Up @@ -82,15 +82,15 @@ def main():
dic["nocellsr"] = dic["nxyz"][0] * dic["nxyz"][1] * dic["nxyz"][2]
case = "./" + dic["path"] + "/flow/" + f"{dic['path'].upper()}"
for name in ["unrst", "init"]:
dic[f"{name}"] = EclFile(case + f".{name.upper()}")
dic[f"{name}"] = ResdataFile(case + f".{name.upper()}")
dic["egrid"], dic["smspec"] = Grid(case + ".EGRID"), Summary(case + ".SMSPEC")
names = ["sgas", "rs", "pressure", "gas_den", "oil_den", "gaskr"]
if dic["case"] != "spe11a":
names += ["rv", "temp"]
for name in names:
dic[f"{name}"] = list(dic["unrst"].iget_kw(name.upper()))
for name in ["porv", "satnum", "fipnum", "dx", "dy", "dz"]:
dic[f"{name}"] = list(dic["init"].iget_kw(name.upper())[0])
dic["smspec"], dic["egrid"] = EclSum(case + ".SMSPEC"), EclGrid(case + ".EGRID")
dic["actnum"] = list(dic["egrid"].export_actnum())
dic["actind"] = list(i for i, act in enumerate(dic["actnum"]) if act == 1)
dic["porva"] = [porv for (porv, act) in zip(dic["porv"], dic["actnum"]) if act == 1]
Expand Down Expand Up @@ -364,7 +364,10 @@ def dense_data(dic):
]
dic["pressure_array"][dic["actind"]] = dic["pressure"][t_n] * 1e5 # Pa
dic["sgas_array"][dic["actind"]] = dic["sgas"][t_n]
dic["gden_array"][dic["actind"]] = dic["gas_den"][t_n]
dic["gden_array"][dic["actind"]] = [
den if gas > 0 else 0
for den, gas in zip(dic["gas_den"][t_n], dic["sgas"][t_n])
]
dic["wden_array"][dic["actind"]] = dic["oil_den"][t_n]
dic["xco2_array"][dic["actind"]] = [
co2 / (co2 + h2o) for (co2, h2o) in zip(co2_d, h2o_l)
Expand Down

0 comments on commit 7fdb30a

Please sign in to comment.