From ed3127e8a7acb897bb861eda03692aa7a20aaf5a Mon Sep 17 00:00:00 2001 From: Malcolm Ross Date: Sat, 27 Apr 2024 12:44:07 -0600 Subject: [PATCH] Handle overpressure calculation in a more elegant manner to handle edge cases better and provide easier reporting. Doesn't change in base case unit testing. --- src/geophires_x/Outputs.py | 2 +- src/geophires_x/WellBores.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/geophires_x/Outputs.py b/src/geophires_x/Outputs.py index 97e4ec37..3f58ea27 100644 --- a/src/geophires_x/Outputs.py +++ b/src/geophires_x/Outputs.py @@ -2073,7 +2073,7 @@ def o(output_param: OutputParameter): f.write(NL) # if we are dealing with overpressure and two different reservoirs, show a table reporting the values - if model.wellbores.overpressure_percentage.Provided and model.wellbores.injection_reservoir_depth.Provided: + if model.wellbores.overpressure_percentage.Provided: f.write(NL) f.write(' ***************************************\n') f.write(' * RESERVOIR POWER REQUIRED PROFILES *\n') diff --git a/src/geophires_x/WellBores.py b/src/geophires_x/WellBores.py index 18139a05..347477e4 100644 --- a/src/geophires_x/WellBores.py +++ b/src/geophires_x/WellBores.py @@ -1104,10 +1104,17 @@ def Calculate(self, model: Model) -> None: # and a shallower, lower pressure Injection Reservoir. # If so, calculate the injection reservoir pressure as a function of time if overpressure is provided. # If the injection reservoir temperature or pressure are not provided, calculate a default for them. - if self.injection_reservoir_depth.Provided: #this means they must be doing a split reservoir + if self.injection_reservoir_depth.Provided or self.injection_reservoir_inflation_rate.Provided: + # this means they must be doing a split reservoir - + # now deal give default values to whatever values they didn't set + if not self.injection_reservoir_temperature.Provided: + self.injection_reservoir_temperature.value = model.reserv.Trock.value + if not self.injection_reservoir_depth.Provided: + self.injection_reservoir_depth.value = model.reserv.depth.value if not self.injection_reservoir_temperature.Provided: self.injection_reservoir_temperature.value = (model.reserv.averagegradient.value * self.injection_reservoir_depth.value) + model.reserv.Tsurf.value - if self.injection_reservoir_pressure.value < 0: + + if self.injection_reservoir_pressure.value < 0: # they didn't provide a pressure so assume hydrostatic. self.injection_reservoir_pressure.value = get_hydrostatic_pressure_kPa(self.injection_reservoir_temperature.value, model.reserv.Tsurf.value, self.injection_reservoir_depth.value,