Skip to content

Commit 46d18a7

Browse files
Don't take pressure as parameter for vapor pressure per NREL#156 (comment) (significant reduction of pumping power in multiple examples)
1 parent dc7ee91 commit 46d18a7

14 files changed

+1332
-1344
lines changed

src/geophires_x/AGSWellBores.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,7 @@ def Calculate(self, model: Model) -> None:
10691069

10701070
# recalculate the pumping power by looking at the difference between the upgoing and downgoing and the nonvertical
10711071
self.PumpingPower.value = DowngoingPumpingPower + NonverticalPumpingPower - UpgoingPumpingPower
1072-
self.PumpingPower.value = [0. if x < 0. else x for x in
1073-
self.PumpingPower.value] # cannot be negative, so set to 0
1072+
self.PumpingPower.value = [max(x, 0.) for x in self.PumpingPower.value] # cannot be negative, so set to 0
10741073

10751074
else:
10761075
# do the CLGS-style calculation
@@ -1129,7 +1128,7 @@ def Calculate(self, model: Model) -> None:
11291128
self.PumpingPower.value = self.DPOverall.value * self.prodwellflowrate.value / rho_water / model.surfaceplant.pump_efficiency.value / 1E3
11301129
# in GEOPHIRES v1.2, negative pumping power values become zero
11311130
# (b/c we are not generating electricity) = thermosiphon is happening!
1132-
self.PumpingPower.value = [0. if x < 0. else x for x in self.PumpingPower.value]
1131+
self.PumpingPower.value = [max(x, 0.) for x in self.PumpingPower.value]
11331132

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

src/geophires_x/GeoPHIRESUtils.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,37 +244,30 @@ def RecoverableHeat(Twater_degC: float) -> float:
244244

245245

246246
@lru_cache
247-
def vapor_pressure_water_kPa(Twater_degC: float, pressure: Optional[PlainQuantity] = None) -> float:
247+
def vapor_pressure_water_kPa(temperature_degC: float) -> float:
248248
"""
249249
Calculate the vapor pressure of water as a function of temperature.
250250
251251
Args:
252-
Twater_degC: the temperature of water in degrees C
253-
pressure: Pressure - should be provided as a Pint quantity that knows its units
252+
temperature_degC: the temperature of water in degrees C
254253
Returns:
255254
The vapor pressure of water as a function of temperature in kPa
256255
Raises:
257-
ValueError: If Twater_degC is not a float or convertible to float.
258-
ValueError: If Twater_degC is below 0.
256+
ValueError: If temperature_degC is not a float or convertible to float.
257+
ValueError: If temperature_degC is below 0.
259258
"""
260259

261-
if not isinstance(Twater_degC, (int, float)):
262-
raise ValueError(f'Twater_degC ({Twater_degC}) must be a number')
263-
if Twater_degC < 0:
264-
raise ValueError(f'Twater_degC ({Twater_degC}) must be greater than or equal to 0')
260+
if not isinstance(temperature_degC, (int, float)):
261+
raise ValueError(f'Input temperature ({temperature_degC}) must be a number')
262+
if temperature_degC < 0:
263+
raise ValueError(f'Input temperature ({temperature_degC}C) must be greater than or equal to 0')
265264

266265
try:
267-
if pressure is not None:
268-
return (quantity(
269-
CP.PropsSI('P', 'T', celsius_to_kelvin(Twater_degC), 'P', pressure.to('Pa').magnitude, 'Water'), 'Pa')
270-
.to('kPa').magnitude)
271-
else:
272-
_logger.warning(f'vapor_pressure_water: No pressure provided, using vapor quality=0 instead')
273-
return (quantity(CP.PropsSI('P', 'T', celsius_to_kelvin(Twater_degC), 'Q', 0, 'Water'), 'Pa')
266+
return (quantity(CP.PropsSI('P', 'T', celsius_to_kelvin(temperature_degC), 'Q', 0, 'Water'), 'Pa')
274267
.to('kPa').magnitude)
275268

276269
except (NotImplementedError, ValueError) as e:
277-
raise ValueError(f'Input temperature {Twater_degC} is out of range or otherwise not implemented') from e
270+
raise ValueError(f'Input temperature ({temperature_degC}C) is out of range or otherwise not implemented') from e
278271

279272

280273
@lru_cache

src/geophires_x/WellBores.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,7 @@ def ProdPressureDropAndPumpingPowerUsingIndexes(
362362
Pexcess_kPa = 344.7 # = 50 psi
363363

364364
# Minimum production pump inlet pressure and minimum wellhead pressure
365-
Pminimum_kPa = vapor_pressure_water_kPa(
366-
Trock_degC,
367-
pressure=quantity(Phydrostaticcalc_kPa, 'kPa'),
368-
) + Pexcess_kPa
365+
Pminimum_kPa = vapor_pressure_water_kPa(Trock_degC) + Pexcess_kPa
369366

370367
if usebuiltinppwellheadcorrelation:
371368
Pprodwellhead = Pminimum_kPa # production wellhead pressure [kPa]
@@ -411,7 +408,7 @@ def ProdPressureDropAndPumpingPowerUsingIndexes(
411408
PumpingPower = PumpingPowerProd
412409

413410
# negative pumping power values become zero (b/c we are not generating electricity)
414-
PumpingPower = [0. if x < 0. else x for x in PumpingPower]
411+
PumpingPower = [max(x, 0.) for x in PumpingPower]
415412

416413
return PumpingPower, PumpingPowerProd, DPProdWell, Pprodwellhead
417414

@@ -495,10 +492,7 @@ def InjPressureDropAndPumpingPowerUsingIndexes(
495492
Pexcess_kPa = 344.7 # = 50 psi
496493

497494
# Minimum production pump inlet pressure and minimum wellhead pressure
498-
Pminimum_kPa = vapor_pressure_water_kPa(
499-
Trock_degC,
500-
pressure=quantity(Phydrostaticcalc_kPa, 'kPa'),
501-
) + Pexcess_kPa
495+
Pminimum_kPa = vapor_pressure_water_kPa(Trock_degC) + Pexcess_kPa
502496

503497
if usebuiltinppwellheadcorrelation:
504498
Pprodwellhead = Pminimum_kPa # production wellhead pressure [kPa]

0 commit comments

Comments
 (0)