Skip to content

Commit b207b55

Browse files
Merge pull request NREL#158 from softwareengineerprogrammer/main
Don't take pressure as parameter for vapor pressure
2 parents 51ec7b7 + 53c098d commit b207b55

20 files changed

+1339
-1351
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.4.21
2+
current_version = 3.4.22
33
commit = True
44
tag = True
55

.cookiecutterrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ default_context:
5454
sphinx_doctest: "no"
5555
sphinx_theme: "sphinx-py3doc-enhanced-theme"
5656
test_matrix_separate_coverage: "no"
57-
version: 3.4.21
57+
version: 3.4.22
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Free software: `MIT license <LICENSE>`__
4747
:alt: Supported implementations
4848
:target: https://pypi.org/project/geophires-x
4949

50-
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.21.svg
50+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.22.svg
5151
:alt: Commits since latest release
52-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.21...main
52+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.22...main
5353

5454
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
5555
:target: https://nrel.github.io/GEOPHIRES-X

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
year = '2023'
1919
author = 'NREL'
2020
copyright = f'{year}, {author}'
21-
version = release = '3.4.21'
21+
version = release = '3.4.22'
2222

2323
pygments_style = 'trac'
2424
templates_path = ['./templates']

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def read(*names, **kwargs):
1313

1414
setup(
1515
name='geophires-x',
16-
version='3.4.21',
16+
version='3.4.22',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

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]

src/geophires_x/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.4.21'
1+
__version__ = '3.4.22'

0 commit comments

Comments
 (0)