Skip to content

Commit 0a92a7a

Browse files
Raise RuntimeError instead of sys.exit in MPF Reservoir numerical inverse laplace calculation
1 parent 5215b38 commit 0a92a7a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/geophires_x/MPFReservoir.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def Calculate(self, model: Model):
6767
:type model: :class:`~geophires_x.Model.Model`
6868
:return: None
6969
"""
70-
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)
70+
model.logger.info(f'Init {str(__class__)}: {sys._getframe().f_code.co_name}')
7171
super().Calculate(model) # run calculate for the parent.
7272

7373
# convert flowrate to volumetric rate
@@ -90,14 +90,15 @@ def Calculate(self, model: Model):
9090
for t in range(1, len(model.reserv.timevector.value)):
9191
Twnd = Twnd + [float(invertlaplace(fp, td[t], method='stehfest'))]
9292
except:
93-
print(
94-
"Error: GEOPHIRES could not execute numerical inverse laplace calculation for reservoir model 1. Simulation will abort.")
95-
sys.exit()
93+
msg = ('Error: GEOPHIRES could not execute numerical inverse laplace calculation for reservoir model 1. '
94+
'Simulation will abort.')
95+
print(msg)
96+
raise RuntimeError(msg)
9697

9798
Twnd = np.asarray(Twnd)
9899

99100
# calculate dimensional temperature, add initial rock temperature to beginning of array
100101
model.reserv.Tresoutput.value = model.reserv.Trock.value - (Twnd * (model.reserv.Trock.value - model.wellbores.Tinj.value))
101102
model.reserv.Tresoutput.value = np.append([model.reserv.Trock.value], model.reserv.Tresoutput.value)
102103

103-
model.logger.info("Complete " + str(__class__) + ": " + sys._getframe().f_code.co_name)
104+
model.logger.info(f'Complete {str(__class__)}: {sys._getframe().f_code.co_name}')

0 commit comments

Comments
 (0)