Skip to content

Commit ef0ab90

Browse files
committed
Option for aditional tuning parameters in the deck
1 parent a420b40 commit ef0ab90

File tree

8 files changed

+29
-14
lines changed

8 files changed

+29
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# pyopmspe11: A Python framework using OPM Flow for the SPE11 benchmark project
77

8-
<img src="docs/text/figs/animationspe11a.gif" width="830" height="360">
8+
<img src="docs/text/figs/pyopmspe11c100Mcells.gif" width="830" height="462">
99

1010
This repository contains scripts to set up a workflow using Python for the three cases in the [_SPE11 project_](https://www.spe.org/en/csp/).
1111
Here we use the [_OPM-Flow_](https://opm-project.org/?page_id=19) simulator.
@@ -39,7 +39,7 @@ pip install -e .
3939
pip install -r dev-requirements.txt
4040
```
4141

42-
See the [_installation_](https://OPM.github.io/pyopmsep11/installation.html) for further details on building OPM Flow from the master branches in Linux, Windows, and macOS, as well as the OPM Python package.
42+
See the [_installation_](https://OPM.github.io/pyopmspe11/installation.html) for further details on building OPM Flow from the master branches in Linux, Windows, and macOS, as well as the OPM Python package.
4343

4444
## Running pyopmspe11
4545
You can run _pyopmspe11_ as a single command line:
2.16 MB
Loading

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/pyopmspe11/core/pyopmspe11.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""Main script for pyopmspe11"""
55
import os
66
import argparse
7-
from pyopmspe11.utils.inputvalues import process_input, check_deck
7+
from pyopmspe11.utils.inputvalues import process_input, check_deck, handle_tuning
88
from pyopmspe11.utils.runs import simulations, plotting, data
99
from pyopmspe11.visualization.plotting import plot_results
1010
from pyopmspe11.utils.writefile import opm_files, initial
@@ -56,6 +56,8 @@ def pyopmspe11():
5656
print("Files used to generate the corner-point grid (INITIAL.* files)")
5757
# Check the generated deck, flow version, and chosen co2store implementation
5858
check_deck(dic)
59+
# Handle tuning
60+
handle_tuning(dic)
5961
# Get the sand and well/sources positions
6062
positions(dic)
6163
# Write used opm related files

src/pyopmspe11/templates/co2/spe11a.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ BCPROP
222222

223223
% for j in range(len(dic['inj'])):
224224
TUNING
225-
1e-2 ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12/
225+
${dic["tim_aft_eve"] if dic["tim_aft_eve"] else 1e-2} ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12 ${dic["sol_res_fac"]}/
226226
/
227227
/
228228
% if max(dic['radius']) > 0:

src/pyopmspe11/templates/co2/spe11b.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ COMPDAT
240240

241241
% for j in range(len(dic['inj'])):
242242
TUNING
243-
1e-2 ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12/
243+
${dic["tim_aft_eve"] if dic["tim_aft_eve"] else 1e-2} ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12 ${dic["sol_res_fac"]}/
244244
/
245245
/
246246
% if max(dic['radius']) > 0:

src/pyopmspe11/templates/co2/spe11c.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ COMPDAT
227227

228228
% for j in range(len(dic['inj'])):
229229
TUNING
230-
1e-2 ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12/
230+
${dic["tim_aft_eve"] if dic["tim_aft_eve"] else 1e-2} ${dic['inj'][j][2] / 86400.} 1e-10 2* 1e-12 ${dic["sol_res_fac"]}/
231231
/
232232
/
233233
% if max(dic['radius']) > 0:

src/pyopmspe11/utils/inputvalues.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,24 @@ def check_deck(dic):
243243
+ "build flow from the master GitHub branches.\n"
244244
)
245245
sys.exit()
246+
247+
248+
def handle_tuning(dic):
249+
"""
250+
If tuning is enable, then we write the entries corresponding to the maximum
251+
length of the next time step after event and the solver restart factor.
252+
253+
Args:
254+
dic (dict): Global dictionary
255+
256+
Returns:
257+
dic (dict): Modified global dictionary
258+
259+
"""
260+
dic["tim_aft_eve"], dic["sol_res_fac"] = "", ""
261+
for value in dic["flow"].split():
262+
if "solver-restart-factor" in value:
263+
dic["sol_res_fac"] = float(value.split("=")[1])
264+
continue
265+
if "time-step-after-event-in-days" in value:
266+
dic["tim_aft_eve"] = float(value.split("=")[1])

0 commit comments

Comments
 (0)