Skip to content

Commit 90ba8c0

Browse files
Merge branch 'main' into fervo-case-study
2 parents a69f48d + 2b7b816 commit 90ba8c0

25 files changed

+809
-80
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.25
2+
current_version = 3.4.28
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.25
57+
version: 3.4.28
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023, NREL
3+
Copyright (c) 2023-2024, NREL
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.rst

Lines changed: 3 additions & 3 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.25.svg
50+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.28.svg
5151
:alt: Commits since latest release
52-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.25...main
52+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.28...main
5353

5454
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
5555
:target: https://nrel.github.io/GEOPHIRES-X
@@ -65,7 +65,7 @@ Getting Started
6565
Web Interface
6666
-------------
6767

68-
A web interface is available at `tinyurl.com/geophires <https://tinyurl.com/geophires>`__
68+
A web interface is available at `bit.ly/GEOPHIRES <https://bit.ly/GEOPHIRES>`__
6969

7070
Installation
7171
------------

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.25'
21+
version = release = '3.4.28'
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.25',
16+
version='3.4.28',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

src/geophires_monte_carlo/MC_GeoPHIRES3.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ def work_package(pass_list: list):
218218
shutil.copyfile(result.output_file_path, tmp_output_file)
219219
elif args.Code_File.endswith('HIP_RA.py'):
220220
hip_ra_client: HipRaClient = HipRaClient()
221-
result: HipRaResult = hip_ra_client.get_hip_ra_result(HipRaInputParameters(from_file_path=Path(tmp_input_file)))
221+
result: HipRaResult = hip_ra_client.get_hip_ra_result(
222+
HipRaInputParameters(file_path_or_params_dict=Path(tmp_input_file))
223+
)
222224
shutil.copyfile(result.output_file_path, tmp_output_file)
223225
elif args.Code_File.endswith('hip_ra_x.py'):
224226
hip_ra_x_client: HipRaXClient = HipRaXClient()
225227
result: HipRaResult = hip_ra_x_client.get_hip_ra_result(
226-
HipRaInputParameters(from_file_path=Path(tmp_input_file))
228+
HipRaInputParameters(file_path_or_params_dict=Path(tmp_input_file))
227229
)
228230
shutil.copyfile(result.output_file_path, tmp_output_file)
229231
else:
@@ -358,6 +360,7 @@ def main(command_line_args=None):
358360
if 'MC_OUTPUT_FILE' in args and args.MC_OUTPUT_FILE is not None
359361
else str(Path(Path(args.Input_file).parent, 'MC_Result.txt').absolute())
360362
)
363+
code_file_name = Path(args.Code_File).name
361364
python_path = 'python'
362365
html_path = ''
363366

@@ -450,6 +453,14 @@ def main(command_line_args=None):
450453
results_pd = pd.read_csv(output_file)
451454
df = pd.DataFrame(results_pd)
452455

456+
if len(results) < 1:
457+
# TODO surface actual exceptions instead of giving this generic message
458+
raise RuntimeError(
459+
'No MC results generated, '
460+
f'this is likely caused by {code_file_name} throwing an exception '
461+
f'when run with your input file.'
462+
)
463+
453464
# Compute the stats along the specified axes.
454465
mins = np.nanmin(results, 0)
455466
maxs = np.nanmax(results, 0)

src/geophires_x/AGSWellBores.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -773,12 +773,12 @@ def CalculateNonverticalPressureDrop(self, model:Model, time_operation: float, t
773773
# nonvertical wellbore fluid conditions based on current temperature
774774
rhowater = density_water_kg_per_m3(
775775
self.NonverticalProducedTemperature.value[year],
776-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
776+
pressure=model.reserv.lithostatic_pressure()
777777
)
778778

779779
muwater = viscosity_water_Pa_sec(
780780
self.NonverticalProducedTemperature.value[year],
781-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
781+
pressure=model.reserv.lithostatic_pressure()
782782
)
783783
vhoriz = self.q_circulation / rhowater / (math.pi / 4. * self.nonverticalwellborediameter.value ** 2)
784784

@@ -859,15 +859,15 @@ def Calculate(self, model: Model) -> None:
859859
# MIR figure out how to calculate year and extract Tini from reserv Tresoutput array
860860
year = math.trunc(self.time_operation.value / self.al)
861861
self.NonverticalProducedTemperature.value[year] = inverselaplace(
862-
self, 16, 0, model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude))
862+
self, 16, 0, model.reserv.lithostatic_pressure())
863863
# update alpha_fluid value based on next temperature of reservoir
864864

865865
self.alpha_fluid = self.WaterThermalConductivity.value / density_water_kg_per_m3(
866866
self.NonverticalProducedTemperature.value[year],
867-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
867+
pressure=model.reserv.lithostatic_pressure()
868868
) / heat_capacity_water_J_per_kg_per_K(
869869
self.NonverticalProducedTemperature.value[year],
870-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
870+
pressure=model.reserv.lithostatic_pressure()
871871
) * 24.0 * 3600.0
872872
self.time_operation.value += self.al
873873

@@ -881,7 +881,7 @@ def Calculate(self, model: Model) -> None:
881881
self.ProdTempDrop.value = self.tempdropprod.value
882882
model.reserv.cpwater.value = heat_capacity_water_J_per_kg_per_K(
883883
self.NonverticalProducedTemperature.value[0],
884-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
884+
pressure=model.reserv.lithostatic_pressure()
885885
)
886886
if self.rameyoptionprod.value:
887887
self.ProdTempDrop.value = RameyCalc(model.reserv.krock.value,
@@ -904,13 +904,13 @@ def Calculate(self, model: Model) -> None:
904904
if self.productionwellpumping.value:
905905
self.rhowaterinj = density_water_kg_per_m3(
906906
model.reserv.Tsurf.value,
907-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
907+
pressure=model.reserv.lithostatic_pressure()
908908
) * np.linspace(1, 1,
909909
len(self.ProducedTemperature.value))
910910

911911
self.rhowaterprod = density_water_kg_per_m3(
912912
model.reserv.Trock.value,
913-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude)
913+
pressure=model.reserv.lithostatic_pressure()
914914
) * np.linspace(1, 1, len(self.ProducedTemperature.value))
915915

916916
self.DPProdWell.value, f3, vprod, self.rhowaterprod = WellPressureDrop(model,
@@ -1015,13 +1015,13 @@ def Calculate(self, model: Model) -> None:
10151015

10161016
rho_water = density_water_kg_per_m3(
10171017
self.Tout[0],
1018-
pressure = model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude),
1018+
pressure = model.reserv.lithostatic_pressure(),
10191019
)
10201020

10211021

10221022
model.reserv.cpwater.value = heat_capacity_water_J_per_kg_per_K(
10231023
self.Tout[0],
1024-
pressure=model.reserv.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.InputDepth.quantity().to('m').magnitude),
1024+
pressure=model.reserv.lithostatic_pressure(),
10251025
) # Need this for surface plant output calculation
10261026

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

src/geophires_x/CylindricalReservoir.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(self, model: Model):
9898
UnitType=Units.PERCENT,
9999
PreferredUnits=PercentUnit.TENTH,
100100
CurrentUnits=PercentUnit.TENTH,
101-
ErrMessage="assume default cyclindrical reservoir radius of effect reduction factor (0.1)",
101+
ErrMessage="assume default cylindrical reservoir radius of effect reduction factor (0.1)",
102102
ToolTipText="The radius of effect reduction factor - to account for the fact that we cannot extract 100%"
103103
+ " of the heat in the cylinder.",
104104
)
@@ -246,20 +246,17 @@ def Calculate(self, model: Model) -> None:
246246
) / 1e15 # 10^15 J
247247
self.cpwater.value = heat_capacity_water_J_per_kg_per_K(
248248
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
249-
pressure=self.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.depth.quantity().to('m').magnitude)
249+
pressure=self.lithostatic_pressure()
250250
)
251251
self.rhowater.value = density_water_kg_per_m3(
252252
model.wellbores.Tinj.value * 0.5 + (self.Trock.value * 0.9 + model.wellbores.Tinj.value * 0.1) * 0.5,
253-
pressure=self.lithostatic_pressure(model.reserv.rhorock.value, model.reserv.depth.quantity().to('m').magnitude)
253+
pressure=self.lithostatic_pressure()
254254
)
255255

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

258-
#def lithostatic_pressure(self) -> PlainQuantity:
259-
"""
260-
@override
258+
def lithostatic_pressure(self) -> PlainQuantity:
259+
"""@override"""
261260

262-
Standard reservoir implementation uses depth but CylindricalReservoir sets depth to total drilled length
263-
"""
264-
def lithostatic_pressure(self, rho_rock_kg_per_m3: float, depth_m: float) -> PlainQuantity:
265-
return quantity(static_pressure_MPa(rho_rock_kg_per_m3, depth_m), 'MPa')
261+
return quantity(static_pressure_MPa(self.rhorock.quantity().to('kg/m**3').magnitude,
262+
self.InputDepth.quantity().to('m').magnitude), 'MPa')

src/geophires_x/Reservoir.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def __init__(self, model: Model):
286286
self.fracnumb = self.ParameterDict[self.fracnumb.Name] = intParameter(
287287
"Number of Fractures",
288288
DefaultValue=10,
289-
AllowableRange=list(range(1, 21, 1)),
289+
AllowableRange=list(range(1, 150, 1)),
290290
UnitType=Units.NONE,
291291
ErrMessage="assume default number of fractures (10)",
292292
ToolTipText="Number of identical parallel fractures in EGS fracture-based reservoir model."
@@ -749,14 +749,12 @@ 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(self.rhorock.quantity().to('kg/m**3').magnitude,
753-
self.depth.quantity().to('m').magnitude)
752+
pressure=self.lithostatic_pressure()
754753
)
755754

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

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

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

771-
def lithostatic_pressure(self, rho_rock_kg_per_m3: float, depth_m: float) -> PlainQuantity:
772-
return quantity(static_pressure_MPa(rho_rock_kg_per_m3, depth_m), 'MPa')
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')
773772

774773

0 commit comments

Comments
 (0)