Skip to content

Commit

Permalink
Revert unintended rollback of invalid parameter handling in AGSWellBo…
Browse files Browse the repository at this point in the history
…res.py introduced by NREL@00012ff
  • Loading branch information
softwareengineerprogrammer committed Nov 7, 2023
1 parent 9c02052 commit 6ed31a2
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/geophires_x/AGSWellBores.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,12 @@ def calculatedrillinglengths(self, model) -> tuple:
if self.Configuration.value == Configuration.ULOOP:
# Total drilling depth of both wells and laterals in U-loop [m]
return ((
self.numnonverticalsections.value * self.Nonvertical_length.value) + 2 * model.reserv.InputDepth.value * 1000.0), \
self.numnonverticalsections.value * self.Nonvertical_length.value) + 2 * model.reserv.InputDepth.value * 1000.0), \
2 * model.reserv.InputDepth.value * 1000.0, self.numnonverticalsections.value * self.Nonvertical_length.value
else:
# Total drilling depth of well and lateral in co-axial case [m]
return (
self.Nonvertical_length.value + model.reserv.InputDepth.value * 1000.0), model.reserv.InputDepth.value * 1000.0, \
self.Nonvertical_length.value + model.reserv.InputDepth.value * 1000.0), model.reserv.InputDepth.value * 1000.0, \
self.Nonvertical_length.value

def initialize(self, model: Model) -> None:
Expand Down Expand Up @@ -760,29 +760,29 @@ def verify(self, model: Model) -> int:
:param model: The container class of the application, giving access to everything else, including the logger
:return: 0 if all OK, 1 if error.
"""
model.logger.info("Init " + str(
__class__) + ": " + sys._getframe().f_code.co_name) # Verify inputs are within allowable bounds
model.logger.info(f"Init {str(__class__)}: {sys._getframe().f_code.co_name}")

self.error = 0
errors = []

def on_invalid_parameter_value(err_msg):
errors.append(err_msg)
print(err_msg)
model.logger.fatal(err_msg)
self.error = 1

if self.Nonvertical_length.value < 1000 or self.Nonvertical_length.value > 20000:
print("Error: CLGS model database imposes additional range restrictions: Nonvertical length must be \
on_invalid_parameter_value("Error: CLGS model database imposes additional range restrictions: Nonvertical length must be \
between 1,000 and 20,000 m. Simulation terminated.")
model.logger.fatal("Error: CLGS model database imposes additional range restrictions: Nonvertical length must be \
between 1,000 and 20,000 m. Simulation terminated.")
self.error = 1
if self.Tinj.value < 30.0 or self.Tinj.value > 60.0:
print("Error: CLGS model database imposes additional range restrictions: Injection temperature\
must be between 30 and 60 C. Simulation terminated.")
model.logger.fatal("Error: CLGS model database imposes additional range restrictions: Injection temperature\
on_invalid_parameter_value("Error: CLGS model database imposes additional range restrictions: Injection temperature\
must be between 30 and 60 C. Simulation terminated.")
self.error = 1
if self.krock < 1.5 or self.krock > 4.5:
print("Error: CLGS model database imposes additional range restrictions: \
Rock thermal conductivity must be between 1.5 and 4.5 W/m/K. Simulation terminated.")
model.logger.fatal("Error: CLGS model database imposes additional range restrictions: \
on_invalid_parameter_value("Error: CLGS model database imposes additional range restrictions: \
Rock thermal conductivity must be between 1.5 and 4.5 W/m/K. Simulation terminated.")
self.error = 1

model.logger.info("complete " + str(__class__) + ": " + sys._getframe().f_code.co_name)
model.logger.info(f"complete {str(__class__)}: {sys._getframe().f_code.co_name}")

return self.error

# Multilateral code
Expand Down

0 comments on commit 6ed31a2

Please sign in to comment.