Skip to content

Commit

Permalink
unfinished bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf-pf committed Mar 8, 2019
1 parent f2a3e07 commit 944a624
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\sungw385\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe"
}
11 changes: 8 additions & 3 deletions coupled_simulation/coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ def __main__(argv):
except getopt.GetoptError:
print('test.py -i <inputpath>')
sys.exit(2)
print(opts)
print(argv)
for opt, arg in opts:
if opt == '-h':
print('test.py -i <inputpath>')
sys.exit()
elif opt in ("-i", "--ipath"):
path = arg

print(path)

if path[0] == "r":
path = path[1:]

Expand All @@ -71,10 +75,11 @@ def __main__(argv):
# create instances for power plant and storage
geostorage = gs.geo_sto(cd)

#min_well_depth = min(geostorage.well_depths)
min_well_depth = 700 #read this from file later!
min_well_depth = min(geostorage.well_depths)
#min_well_depth = 700 #read this from file later!

powerplant = pp.model(cd, min_well_depth)
powerplant = pp.model(cd, min_well_depth, len(geostorage.well_names), max(geostorage.well_upper_BHP), min(geostorage.well_lower_BHP))
#powerplant = pp.model(cd, min_well_depth, 9, 80, 40)

print('######################################################################')
print('Reading input time series...')
Expand Down
25 changes: 22 additions & 3 deletions coupled_simulation/geostorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(self, cd):
self.working_dir_loc = wdir
self.keep_ecl_logs = False

# save the original simulation title in case of eclipse simulation (not needed for e300)
self.simulation_title_orig = self.simulation_title

if self.retain_ecl_logs == "True":
self.keep_ecl_logs = True
else:
Expand Down Expand Up @@ -86,6 +89,14 @@ def RunECLIPSE(self, target_flowrate, tstep, iter_step, tstepsize, current_mode)


if not current_mode == 'init':
if self.simulator == "ECLIPSE":
print("Resetting simulation title!")
self.simulation_title = self.simulation_title_orig + "_" + str(tstep)
if tstep == 0:
os.rename(self.working_dir_loc + self.simulation_title_orig + '.DATA', self.working_dir_loc + self.simulation_title_orig + "_" + str(tstep) + '.DATA')
else:
os.rename(self.working_dir_loc + self.simulation_title_orig + "_" + str(tstep-1) + '.DATA', self.working_dir_loc + self.simulation_title_orig + "_" + str(tstep) + '.DATA')

print('Running storage simulation:')
print(self.working_dir_loc + self.simulation_title + '.DATA')
print('Timestep/iteration:\t\t', '%.0f'%tstep, '/', '%.0f'%iter_step)
Expand Down Expand Up @@ -344,13 +355,21 @@ def GetECLResults(self, timestep, current_op_mode):
results = util.getFile(filename)
#sort the rsm data to a more uniform dataset
reorderd_rsm_data = self.rearrangeRSMDataArray(results)
#print(reorderd_rsm_data)
#eleminate additional whitespaces, duplicate entries, etc.
well_results = util.contractDataArray(reorderd_rsm_data)

#print(well_results)

# check number of data entries in well_results:
values = len(well_results) - 4

entry_count_temp = 0
if self.simulator == 'e300':
entry_count_temp = 4
elif self.simulator == 'ECLIPSE':
entry_count_temp = 5
values = len(well_results) - entry_count_temp
if values > 1:
print('Warning: possible loss of data, expecting one data line in RSM file only')
print('Warning: possible loss of data, too many data lines in RSM file')

#data structures to save the flowrates, pressures and names of all individual wells
well_pressures = []
Expand Down
15 changes: 15 additions & 0 deletions run_if.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
__author__ = "wtp"
"""

import sys

from coupled_simulation import cp

print (sys.argv)
cp.__main__(sys.argv[1:])

0 comments on commit 944a624

Please sign in to comment.