Skip to content

Commit 322b27a

Browse files
Implementing a way to handle overpressure
environments
1 parent 0d0ebeb commit 322b27a

40 files changed

+738
-235
lines changed

src/geophires_x/AGSWellBores.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,12 @@ def CalculateNonverticalPressureDrop(self, model:Model, time_operation: float, t
871871
# nonvertical wellbore fluid conditions based on current temperature
872872
rhowater = density_water_kg_per_m3(
873873
self.NonverticalProducedTemperature.value[year],
874-
pressure=model.reserv.lithostatic_pressure()
874+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
875875
)
876876

877877
muwater = viscosity_water_Pa_sec(
878878
self.NonverticalProducedTemperature.value[year],
879-
pressure=model.reserv.lithostatic_pressure()
879+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
880880
)
881881
vhoriz = self.q_circulation / rhowater / (math.pi / 4. * self.nonverticalwellborediameter.value ** 2)
882882

@@ -957,15 +957,15 @@ def Calculate(self, model: Model) -> None:
957957
# MIR figure out how to calculate year and extract Tini from reserv Tresoutput array
958958
year = math.trunc(self.time_operation.value / self.al)
959959
self.NonverticalProducedTemperature.value[year] = inverselaplace(
960-
self, 16, 0, model.reserv.lithostatic_pressure())
960+
self, 16, 0, model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value))
961961
# update alpha_fluid value based on next temperature of reservoir
962962

963963
self.alpha_fluid = self.WaterThermalConductivity.value / density_water_kg_per_m3(
964964
self.NonverticalProducedTemperature.value[year],
965-
pressure=model.reserv.lithostatic_pressure()
965+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
966966
) / heat_capacity_water_J_per_kg_per_K(
967967
self.NonverticalProducedTemperature.value[year],
968-
pressure=model.reserv.lithostatic_pressure()
968+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
969969
) * 24.0 * 3600.0
970970
self.time_operation.value += self.al
971971

@@ -979,7 +979,7 @@ def Calculate(self, model: Model) -> None:
979979
self.ProdTempDrop.value = self.tempdropprod.value
980980
model.reserv.cpwater.value = heat_capacity_water_J_per_kg_per_K(
981981
self.NonverticalProducedTemperature.value[0],
982-
pressure=model.reserv.lithostatic_pressure()
982+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
983983
)
984984
if self.rameyoptionprod.value:
985985
self.ProdTempDrop.value = RameyCalc(model.reserv.krock.value,
@@ -1002,13 +1002,13 @@ def Calculate(self, model: Model) -> None:
10021002
if self.productionwellpumping.value:
10031003
self.rhowaterinj = density_water_kg_per_m3(
10041004
model.reserv.Tsurf.value,
1005-
pressure=model.reserv.lithostatic_pressure()
1005+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
10061006
) * np.linspace(1, 1,
10071007
len(self.ProducedTemperature.value))
10081008

10091009
self.rhowaterprod = density_water_kg_per_m3(
10101010
model.reserv.Trock.value,
1011-
pressure=model.reserv.lithostatic_pressure()
1011+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
10121012
) * np.linspace(1, 1, len(self.ProducedTemperature.value))
10131013

10141014
self.DPProdWell.value, f3, vprod, self.rhowaterprod = WellPressureDrop(model,
@@ -1113,13 +1113,13 @@ def Calculate(self, model: Model) -> None:
11131113

11141114
rho_water = density_water_kg_per_m3(
11151115
self.Tout[0],
1116-
pressure = model.reserv.lithostatic_pressure(),
1116+
pressure = model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value),
11171117
)
11181118

11191119

11201120
model.reserv.cpwater.value = heat_capacity_water_J_per_kg_per_K(
11211121
self.Tout[0],
1122-
pressure=model.reserv.lithostatic_pressure(),
1122+
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value),
11231123
) # Need this for surface plant output calculation
11241124

11251125
# set pumping power to zero for all times, assuming that the thermosphere wil always

src/geophires_x/CylindricalReservoir.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,20 @@ def Calculate(self, model: Model) -> None:
244244
) / 1e15 # 10^15 J
245245
self.cpwater.value = heat_capacity_water_J_per_kg_per_K(
246246
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
247-
pressure=model.reserv.lithostatic_pressure()
247+
pressure=self.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
248248
)
249249
self.rhowater.value = density_water_kg_per_m3(
250250
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
251-
pressure=model.reserv.lithostatic_pressure()
251+
pressure=self.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.Trock.value)
252252
)
253253

254254
model.logger.info(f'complete {str(__class__)}: {sys._getframe().f_code.co_name}')
255255

256-
def lithostatic_pressure(self) -> PlainQuantity:
256+
#def lithostatic_pressure(self) -> PlainQuantity:
257257
"""
258258
@override
259259
260260
Standard reservoir implementation uses depth but CylindricalReservoir sets depth to total drilled length
261261
"""
262-
return quantity(static_pressure_MPa(self.rhorock.quantity().to('kg/m**3').magnitude,
263-
self.InputDepth.quantity().to('m').magnitude), 'MPa')
262+
def lithostatic_pressure(self, rho_rock: float, depth: float) -> PlainQuantity:
263+
return quantity(static_pressure_MPa(rho_rock, depth), 'MPa')

src/geophires_x/Outputs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,9 @@ def PrintOutputs(self, model: Model):
10051005
reservoir_parameters.append(OutputTableItem('Reservoir impedance', '{0:10.2f}'.format(model.wellbores.impedance.value / 1000),
10061006
model.wellbores.impedance.CurrentUnits.value))
10071007
else:
1008-
reservoir_parameters.append(OutputTableItem('Reservoir hydrostatic pressure',
1009-
'{0:10.2f}'.format(model.wellbores.Phydrostaticcalc.value),
1010-
model.wellbores.Phydrostaticcalc.CurrentUnits.value))
1008+
reservoir_parameters.append(OutputTableItem('Average reservoir pressure',
1009+
'{0:10.2f}'.format(np.average(model.wellbores.production_reservoir_pressure.value)),
1010+
model.wellbores.production_reservoir_pressure.CurrentUnits.value))
10111011
reservoir_parameters.append(OutputTableItem('Plant outlet pressure', '{0:10.2f}'.format(
10121012
model.surfaceplant.plant_outlet_pressure.value),
10131013
model.surfaceplant.plant_outlet_pressure.CurrentUnits.value))
@@ -1672,7 +1672,7 @@ def PrintOutputs(self, model: Model):
16721672
if model.wellbores.impedancemodelused.value:
16731673
f.write(f' Reservoir impedance: {model.wellbores.impedance.value/1000:10.2f} ' + model.wellbores.impedance.CurrentUnits.value + NL)
16741674
else:
1675-
f.write(f' Reservoir hydrostatic pressure: {model.wellbores.Phydrostaticcalc.value:10.2f} ' + model.wellbores.Phydrostaticcalc.CurrentUnits.value + NL)
1675+
f.write(f' Average reservoir pressure: {np.average(model.wellbores.production_reservoir_pressure.value):10.2f} ' + model.wellbores.production_reservoir_pressure.CurrentUnits.value + NL)
16761676
f.write(f' Plant outlet pressure: {model.surfaceplant.plant_outlet_pressure.value:10.2f} ' + model.surfaceplant.plant_outlet_pressure.CurrentUnits.value + NL)
16771677
if model.wellbores.productionwellpumping.value:
16781678
f.write(f' Production wellhead pressure: {model.wellbores.Pprodwellhead.value:10.2f} ' + model.wellbores.Pprodwellhead.CurrentUnits.value + NL)

src/geophires_x/Reservoir.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,14 @@ def Calculate(self, model: Model) -> None:
749749
# calculate reservoir water properties
750750
self.cpwater.value = heat_capacity_water_J_per_kg_per_K(
751751
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
752-
pressure=self.lithostatic_pressure()
752+
pressure=self.lithostatic_pressure(self.rhorock.quantity().to('kg/m**3').magnitude,
753+
self.depth.quantity().to('m').magnitude)
753754
)
754755

755756
self.rhowater.value = density_water_kg_per_m3(
756757
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
757-
pressure=self.lithostatic_pressure()
758+
pressure=self.lithostatic_pressure(self.rhorock.quantity().to('kg/m**3').magnitude,
759+
self.depth.quantity().to('m').magnitude)
758760
)
759761

760762
# temperature gain in injection wells
@@ -766,8 +768,7 @@ def Calculate(self, model: Model) -> None:
766768

767769
model.logger.info(f'complete {str(__class__)}: {sys._getframe().f_code.co_name}')
768770

769-
def lithostatic_pressure(self) -> PlainQuantity:
770-
return quantity(static_pressure_MPa(self.rhorock.quantity().to('kg/m**3').magnitude,
771-
self.depth.quantity().to('m').magnitude), 'MPa')
771+
def lithostatic_pressure(self, rho_rock: float, depth: float) -> PlainQuantity:
772+
return quantity(static_pressure_MPa(rho_rock, depth), 'MPa')
772773

773774

src/geophires_x/Units.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Units(IntEnum):
5858
POWERPERUNITAREA = auto()
5959
HEATPERUNITVOLUME = auto()
6060
POWERPERUNITVOLUME = auto()
61+
DECAY_RATE=auto()
62+
INFLATION_RATE=auto()
6163

6264

6365
class TemperatureUnit(str, Enum):
@@ -129,7 +131,7 @@ class EnergyUnit(str, Enum):
129131

130132

131133
class PowerUnit(str, Enum):
132-
"""Power (electrcity or heat) Units"""
134+
"""Power (electricity or heat) Units"""
133135
W = "W"
134136
KW = "kW"
135137
MW = "MW"
@@ -338,3 +340,13 @@ class HeatPerUnitVolumeUnit(str,Enum):
338340
class PowerPerUnitVolumeUnit(str,Enum):
339341
"""Population Density Units"""
340342
MWPERCUBICKM = "MW/km**3"
343+
344+
345+
class Decay_RateUnit(str,Enum):
346+
"""Decay rate Units"""
347+
PERCENTPERYEAR = "%/yr"
348+
349+
350+
class Inflation_RateUnit(str,Enum):
351+
"""Decay rate Units"""
352+
KPASCALPERYEAR = "kPa/yr"

0 commit comments

Comments
 (0)