Skip to content

Commit 90ff58b

Browse files
Merge pull request NREL#231 from softwareengineerprogrammer/main
Consolidate well drilling cost correlations into single definition; GEOPHIRES Version metadata; heating price output fix [3.4.34]
2 parents becec79 + 232e7c7 commit 90ff58b

25 files changed

+1309
-676
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.30
2+
current_version = 3.4.34
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.30
57+
version: 3.4.34
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pip-log.txt
5555
coverage.xml
5656
htmlcov
5757
nosetests.xml
58+
--cov-report=term-missing
5859

5960
# Translations
6061
*.mo

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.30.svg
50+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.34.svg
5151
:alt: Commits since latest release
52-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.30...main
52+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.34...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.30'
21+
version = release = '3.4.34'
2222

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

setup.py

Lines changed: 4 additions & 3 deletions
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.30',
16+
version='3.4.34',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(
@@ -59,9 +59,10 @@ def read(*names, **kwargs):
5959
'Documentation': 'https://nrel.github.io/python-geophires-x-nrel/',
6060
},
6161
keywords=['geothermal'],
62-
python_requires='>=3.7',
62+
python_requires='>=3.8',
6363
install_requires=[
64-
'numpy',
64+
'numpy==1.24; python_version == "3.8"', # Last version compatible with Python 3.8
65+
'numpy==1.26; python_version > "3.8"',
6566
'numpy-financial',
6667
'pint',
6768
'forex_python',

src/geophires_x/Economics.py

Lines changed: 9 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -95,43 +95,13 @@ def calculate_cost_of_one_vertical_well(model: Model, depth_m: float, well_corre
9595
)
9696

9797
if well_correlation is WellDrillingCostCorrelation.SIMPLE:
98-
cost_of_one_well = vertical_drilling_cost_per_m * depth_m * 1E-6
99-
100-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL:
101-
cost_of_one_well = (0.30212 * depth_m ** 2 + 584.91124 * depth_m + 751368.47270) * 1E-6
102-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE:
103-
cost_of_one_well = (0.28180 * depth_m ** 2 + 1275.52130 * depth_m + 632315.12640) * 1E-6
104-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL:
105-
cost_of_one_well = (0.28977 * depth_m ** 2 + 882.15067 * depth_m + 680562.50150) * 1E-6
106-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE:
107-
cost_of_one_well = (0.25528 * depth_m ** 2 + 1716.71568 * depth_m + 500866.89110) * 1E-6
108-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_INT1:
109-
cost_of_one_well = (0.13710 * depth_m ** 2 + 129.61033 * depth_m + 1205587.57100) * 1E-6
110-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_INT1:
111-
cost_of_one_well = (0.18927 * depth_m ** 2 + 293.45174 * depth_m + 1326526.31300) * 1E-6
112-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_INT1:
113-
cost_of_one_well = (0.15340 * depth_m ** 2 + 120.31700 * depth_m + 1431801.54400) * 1E-6
114-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_INT1:
115-
cost_of_one_well = (0.19950 * depth_m ** 2 + 296.13011 * depth_m + 1697867.70900) * 1E-6
116-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_INT2:
117-
cost_of_one_well = (0.00804 * depth_m ** 2 + 455.60507 * depth_m + 921007.68680) * 1E-6
118-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_INT2:
119-
cost_of_one_well = (0.00315 * depth_m ** 2 + 782.69676 * depth_m + 983620.25270) * 1E-6
120-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_INT2:
121-
cost_of_one_well = (0.00854 * depth_m ** 2 + 506.08357 * depth_m + 1057330.39000) * 1E-6
122-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_INT2:
123-
cost_of_one_well = (0.00380 * depth_m ** 2 + 838.90249 * depth_m + 1181947.04400) * 1E-6
124-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_IDEAL:
125-
cost_of_one_well = (0.00252 * depth_m ** 2 + 439.44503 * depth_m + 590611.90110) * 1E-6
126-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_IDEAL:
127-
cost_of_one_well = (-0.00240 * depth_m ** 2 + 752.93946 * depth_m + 524337.65380) * 1E-6
128-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_IDEAL:
129-
cost_of_one_well = (0.00719 * depth_m ** 2 + 455.85233 * depth_m + 753377.73080) * 1E-6
130-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_IDEAL:
131-
cost_of_one_well = (0.00376 * depth_m ** 2 + 762.52696 * depth_m + 765103.07690) * 1E-6
98+
cost_of_one_well = vertical_drilling_cost_per_m * depth_m * 1E-6
99+
else:
100+
cost_of_one_well = well_correlation.calculate_cost_MUSD(depth_m)
132101

133102
# account for adjustment factor
134103
cost_of_one_well = well_cost_adjustment_factor * cost_of_one_well
104+
135105
return cost_of_one_well
136106

137107

@@ -195,60 +165,16 @@ def calculate_cost_of_non_vertical_section(model: Model, length_m: float, well_c
195165
if not NonverticalsCased:
196166
# assume that casing & cementing costs 50% of drilling costs
197167
casing_factor = 0.5
168+
198169
if model.economics.Nonvertical_drilling_cost_per_m.Provided or well_correlation is WellDrillingCostCorrelation.SIMPLE:
199170
cost_of_non_vertical_section = casing_factor * ((num_nonvertical_sections * nonvertical_drilling_cost_per_m * length_per_section_m)) * 1E-6
200-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL:
201-
cost_per_section = (0.30212 * length_per_section_m ** 2 + 584.91124 * length_per_section_m + 751368.47270) * 1E-6
202-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
203-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE:
204-
cost_per_section = (0.28180 * length_per_section_m ** 2 + 1275.52130 * length_per_section_m + 632315.12640) * 1E-6
205-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
206-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL:
207-
cost_per_section = (0.28977 * length_per_section_m ** 2 + 882.15067 * length_per_section_m + 680562.50150) * 1E-6
208-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
209-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE:
210-
cost_per_section = (0.25528 * length_per_section_m ** 2 + 1716.71568 * length_per_section_m + 500866.89110) * 1E-6
211-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
212-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_INT1:
213-
cost_per_section = (0.13710 * length_per_section_m ** 2 + 129.61033 * length_per_section_m + 1205587.57100) * 1E-6
214-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
215-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_INT1:
216-
cost_per_section = (0.18927 * length_per_section_m ** 2 + 293.45174 * length_per_section_m + 1326526.31300) * 1E-6
217-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
218-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_INT1:
219-
cost_per_section = (0.15340 * length_per_section_m ** 2 + 120.31700 * length_per_section_m + 1431801.54400) * 1E-6
220-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
221-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_INT1:
222-
cost_per_section = (0.19950 * length_per_section_m ** 2 + 296.13011 * length_per_section_m + 1697867.70900) * 1E-6
223-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
224-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_INT2:
225-
cost_per_section = (0.00804 * length_per_section_m ** 2 + 455.60507 * length_per_section_m + 921007.68680) * 1E-6
226-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
227-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_INT2:
228-
cost_per_section = (0.00315 * length_per_section_m ** 2 + 782.69676 * length_per_section_m + 983620.25270) * 1E-6
229-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
230-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_INT2:
231-
cost_per_section = (0.00854 * length_per_section_m ** 2 + 506.08357 * length_per_section_m + 1057330.39000) * 1E-6
232-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
233-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_INT2:
234-
cost_per_section = (0.00380 * length_per_section_m ** 2 + 838.90249 * length_per_section_m + 1181947.04400) * 1E-6
235-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
236-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_SMALL_IDEAL:
237-
cost_per_section = (0.00252 * length_per_section_m ** 2 + 439.44503 * length_per_section_m + 590611.90110) * 1E-6
238-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
239-
elif well_correlation is WellDrillingCostCorrelation.VERTICAL_LARGE_IDEAL:
240-
cost_per_section = (-0.00240 * length_per_section_m ** 2 + 752.93946 * length_per_section_m + 524337.65380) * 1E-6
241-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
242-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_SMALL_IDEAL:
243-
cost_per_section = (0.00719 * length_per_section_m ** 2 + 455.85233 * length_per_section_m + 753377.73080) * 1E-6
244-
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
245-
elif well_correlation is WellDrillingCostCorrelation.DEVIATED_LARGE_IDEAL:
246-
cost_per_section = (0.00376 * length_per_section_m ** 2 + 762.52696 * length_per_section_m + 765103.07690) * 1E-6
171+
else:
172+
cost_per_section = well_correlation.calculate_cost_MUSD(length_per_section_m)
247173
cost_of_non_vertical_section = casing_factor * num_nonvertical_sections * cost_per_section
248174

249175
# account for adjustment factor
250-
251176
cost_of_non_vertical_section = well_cost_adjustment_factor * cost_of_non_vertical_section
177+
252178
return cost_of_non_vertical_section
253179

254180

@@ -1613,7 +1539,7 @@ def __init__(self, model: Model):
16131539
CurrentUnits=EnergyCostUnit.DOLLARSPERKWH,
16141540
)
16151541
self.CoolingPrice = self.OutputParameterDict[self.CoolingPrice.Name] = OutputParameter(
1616-
"Heat Sale Price Model",
1542+
"Cooling Sale Price Model",
16171543
UnitType=Units.ENERGYCOST,
16181544
PreferredUnits=EnergyCostUnit.CENTSSPERKWH,
16191545
CurrentUnits=EnergyCostUnit.DOLLARSPERKWH,

src/geophires_x/OptionList.py

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,41 @@ class ReservoirVolume(str, Enum):
5151

5252

5353
class WellDrillingCostCorrelation(str, Enum):
54-
"""Note: order must be retained since input is read as an int"""
55-
56-
VERTICAL_SMALL = "vertical small diameter, baseline"
57-
DEVIATED_SMALL = "deviated small diameter, baseline"
58-
VERTICAL_LARGE = "vertical large diameter, baseline"
59-
DEVIATED_LARGE = "deviated large diameter, baseline"
60-
61-
SIMPLE = "Simple"
62-
63-
VERTICAL_SMALL_INT1 = "vertical small diameter, intermediate1"
64-
VERTICAL_SMALL_INT2 = "vertical small diameter, intermediate2"
65-
DEVIATED_SMALL_INT1 = "deviated small diameter, intermediate1"
66-
DEVIATED_SMALL_INT2 = "deviated small diameter, intermediate2"
67-
VERTICAL_LARGE_INT1 = "vertical large diameter, intermediate1"
68-
VERTICAL_LARGE_INT2 = "vertical large diameter, intermediate2"
69-
DEVIATED_LARGE_INT1 = "deviated large diameter, intermediate1"
70-
DEVIATED_LARGE_INT2 = "deviated large diameter, intermediate2"
71-
VERTICAL_SMALL_IDEAL = "vertical open-hole, small diameter, ideal"
72-
DEVIATED_SMALL_IDEAL = "deviated liner, small diameter, ideal"
73-
VERTICAL_LARGE_IDEAL = "vertical open-hole, large diameter, ideal"
74-
DEVIATED_LARGE_IDEAL = "deviated liner, large diameter, ideal"
54+
"""Note: order must be retained since input is read as an int; first int arg is duplicative of order"""
55+
56+
VERTICAL_SMALL = 1, "vertical small diameter, baseline", 0.30212, 584.91124, 751368.47270
57+
DEVIATED_SMALL = 2, "deviated small diameter, baseline", 0.28977, 882.15067, 680562.50150
58+
VERTICAL_LARGE = 3, "vertical large diameter, baseline", 0.28180, 1275.52130, 632315.12640
59+
DEVIATED_LARGE = 4, "deviated large diameter, baseline", 0.25528, 1716.71568, 500866.89110
60+
61+
SIMPLE = 5, "Simple", 0, 1846*1E6, 0 # Based on Fervo Project Cape cost per meter (~$1846/m)
62+
63+
VERTICAL_SMALL_INT1 = 6, "vertical small diameter, intermediate1", 0.13710, 129.61033, 1205587.57100
64+
VERTICAL_SMALL_INT2 = 7, "vertical small diameter, intermediate2", 0.00804, 455.60507, 921007.68680
65+
DEVIATED_SMALL_INT1 = 8, "deviated small diameter, intermediate1", 0.15340, 120.31700, 1431801.54400
66+
DEVIATED_SMALL_INT2 = 9, "deviated small diameter, intermediate2", 0.00854, 506.08357, 1057330.39000
67+
VERTICAL_LARGE_INT1 = 10, "vertical large diameter, intermediate1", 0.18927, 293.45174, 1326526.31300
68+
VERTICAL_LARGE_INT2 = 11, "vertical large diameter, intermediate2", 0.00315, 782.69676, 983620.25270
69+
DEVIATED_LARGE_INT1 = 12, "deviated large diameter, intermediate1", 0.19950, 296.13011, 1697867.70900
70+
DEVIATED_LARGE_INT2 = 13, "deviated large diameter, intermediate2", 0.00380, 838.90249, 1181947.04400
71+
VERTICAL_SMALL_IDEAL = 14, "vertical open-hole, small diameter, ideal", 0.00252, 439.44503, 590611.90110
72+
DEVIATED_SMALL_IDEAL = 15, "deviated liner, small diameter, ideal", 0.00719, 455.85233, 753377.73080
73+
VERTICAL_LARGE_IDEAL = 16, "vertical open-hole, large diameter, ideal", -0.00240, 752.93946, 524337.65380
74+
DEVIATED_LARGE_IDEAL = 17, "deviated liner, large diameter, ideal", 0.00376, 762.52696, 765103.07690
75+
76+
77+
def __new__(cls, *args, **kwds):
78+
obj = str.__new__(cls)
79+
obj._value_ = args[1]
80+
return obj
81+
82+
def __init__(self, idx: int, _: str, c2:float, c1:float, c0:float):
83+
self._c2 = c2
84+
self._c1 = c1
85+
self._c0 = c0
86+
87+
def calculate_cost_MUSD(self, meters) -> float:
88+
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6
7589

7690

7791

src/geophires_x/Outputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ def o(output_param: OutputParameter):
20432043
if output_param.Name in econ.OutputParameterDict:
20442044
return econ.OutputParameterDict[output_param.Name]
20452045
else:
2046-
return o
2046+
return output_param
20472047

20482048
f.write('Start ('
20492049
+ o(econ.ElecPrice).CurrentUnits.value +

0 commit comments

Comments
 (0)