Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/enable Wanju_Yuan_Closed-Loop_Geothermal_Energy_Recovery.txt unit test case #16

Closed
softwareengineerprogrammer opened this issue Oct 11, 2023 · 5 comments · Fixed by #66
Assignees
Labels
bug Something isn't working

Comments

@softwareengineerprogrammer
Copy link
Collaborator

If the filter in test_geophires_examples is updated to match/include Wanju_Yuan_Closed-Loop_Geothermal_Energy_Recovery.txt, the test fails with the following error/diff:

AssertionError: {'SUM[141 chars]e': 37.37, 'unit': 'cents/kWh'}, 'Average Dire[9506 chars]39]]} != {'SUM[141 chars]e': 36.74, 'unit': 'cents/kWh'}, 'Average Dire[9506 chars]39]]}
  {'CAPITAL COSTS (M$)': {'District Heating System Cost': None,
                          'Drilling Cost': None,
                          'Drilling and completion costs': {'unit': 'MUSD',
                                                            'value': 16.28},
                          'Drilling and completion costs per well': {'unit': 'MUSD',
                                                                     'value': 16.28},
                          'Exploration costs': {'unit': 'MUSD', 'value': 13.27},
                          'Field gathering system costs': {'unit': 'MUSD',
                                                           'value': 0.51},
                          'Stimulation costs': {'unit': 'MUSD', 'value': 0.0},
                          'Surface power plant costs': {'unit': 'MUSD',
-                                                       'value': 6.74},
?                                                                  ^^

+                                                       'value': 6.12},
?                                                                  ^^

                          'Total CAPEX': None,
-                         'Total capital costs': {'unit': 'MUSD', 'value': 36.79},
?                                                                             ^^

+                         'Total capital costs': {'unit': 'MUSD', 'value': 36.18},
?                                                                             ^^

                          'Total surface equipment costs': {'unit': 'MUSD',
-                                                           'value': 7.24}},
?                                                                    ^ ^^

+                                                           'value': 6.63}},
?                                                                    ^ ^^

   'ECONOMIC PARAMETERS': {'Accrued financing during construction': {'unit': None,
                                                                     'value': 0.0},
                           'Capacity factor': {'unit': '%', 'value': 90.0},
                           'Interest Rate': None,
                           'Project lifetime': {'unit': 'yr', 'value': 40}},
   'ENGINEERING PARAMETERS': {'Average production well temperature drop': {'unit': 'degC',
                                                                           'value': 0.0},
                              'Design': None,
                              'Flow rate': None,
                              'Flowrate per production well': {'unit': 'kg/sec',
                                                               'value': 110.0},
                              'Fluid': None,
                              'Injection Temperature': None,
                              'Injection temperature': {'unit': 'degC',
                                                        'value': 60.0},
                              'Injection well casing ID': {'unit': 'in',
                                                           'value': 8.0},
                              'Lateral Length': None,
                              'Number of Injection Wells': {'unit': 'count',
                                                            'value': 0},
                              'Number of Production Wells': {'unit': 'count',
                                                             'value': 1},
                              'Number of times redrilling': {'unit': 'count',
                                                             'value': 0},
                              'Production well casing ID': {'unit': 'in',
                                                            'value': 8.0},
                              'Pump efficiency': {'unit': None, 'value': 80.0},
                              'Vertical Depth': None,
                              'Water loss rate': {'unit': None, 'value': 0.0},
                              'Well depth (or total length, if not vertical)': {'unit': 'kilometer',
                                                                                'value': 9.0},
                              'Wellbore Diameter': None},
   'HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE': [['YEAR',
                                                                  'ELECTRICITY '
                                                                  'PROVIDED '
                                                                  '(GWh/year)',
                                                                  'HEAT '
                                                                  'EXTRACTED '
                                                                  '(GWh/year)',
                                                                  'RESERVOIR '
                                                                  'HEAT CONTENT '
                                                                  '(10^15 J)',
                                                                  'PERCENTAGE OF '
                                                                  'TOTAL HEAT '
                                                                  'MINED (%)'],
                                                                 [1,
                                                                  12.1,
                                                                  210.6,
                                                                  32.75,
                                                                  2.26],
                                                                 [2,
                                                                  9.5,
                                                                  182.6,
                                                                  32.09,
                                                                  4.22],
                                                                 [3,
                                                                  9.9,
                                                                  186.4,
                                                                  31.42,
                                                                  6.23],
                                                                 [4,
                                                                  9.2,
                                                                  178.9,
                                                                  30.78,
                                                                  8.15],
                                                                 [5,
                                                                  9.4,
                                                                  180.9,
                                                                  30.12,
                                                                  10.09],
                                                                 [6,
                                                                  9.0,
                                                                  176.5,
                                                                  29.49,
                                                                  11.99],
                                                                 [7,
                                                                  9.1,
                                                                  177.7,
                                                                  28.85,
                                                                  13.9],
                                                                 [8,
                                                                  8.9,
                                                                  174.7,
                                                                  28.22,
                                                                  15.78],
                                                                 [9,
                                                                  9.0,
                                                                  175.6,
                                                                  27.59,
                                                                  17.66],
                                                                 [10,
                                                                  8.8,
                                                                  173.4,
                                                                  26.96,
                                                                  19.52],
                                                                 [11,
                                                                  8.8,
                                                                  173.9,
                                                                  26.34,
                                                                  21.39],
                                                                 [12,
                                                                  8.7,
                                                                  172.2,
                                                                  25.72,
                                                                  23.24],
                                                                 [13,
                                                                  8.7,
                                                                  172.6,
                                                                  25.1,
                                                                  25.1],
                                                                 [14,
                                                                  8.6,
                                                                  171.3,
                                                                  24.48,
                                                                  26.94],
                                                                 [15,
                                                                  8.6,
                                                                  171.4,
                                                                  23.86,
                                                                  28.78],
                                                                 [16,
                                                                  8.5,
                                                                  170.5,
                                                                  23.25,
                                                                  30.61],
                                                                 [17,
                                                                  8.5,
                                                                  170.5,
                                                                  22.64,
                                                                  32.44],
                                                                 [18,
                                                                  8.5,
                                                                  169.8,
                                                                  22.02,
                                                                  34.27],
                                                                 [19,
                                                                  8.5,
                                                                  169.6,
                                                                  21.41,
                                                                  36.09],
                                                                 [20,
                                                                  8.4,
                                                                  169.2,
                                                                  20.8,
                                                                  37.91],
                                                                 [21,
                                                                  8.4,
                                                                  168.8,
                                                                  20.2,
                                                                  39.72],
                                                                 [22,
                                                                  8.4,
                                                                  168.6,
                                                                  19.59,
                                                                  41.53],
                                                                 [23,
                                                                  8.4,
                                                                  168.1,
                                                                  18.98,
                                                                  43.34],
                                                                 [24,
                                                                  8.4,
                                                                  168.2,
                                                                  18.38,
                                                                  45.15],
                                                                 [25,
                                                                  8.3,
                                                                  167.5,
                                                                  17.78,
                                                                  46.95],
                                                                 [26,
                                                                  8.3,
                                                                  167.7,
                                                                  17.17,
                                                                  48.75],
                                                                 [27,
                                                                  8.3,
                                                                  166.8,
                                                                  16.57,
                                                                  50.54],
                                                                 [28,
                                                                  8.3,
                                                                  167.4,
                                                                  15.97,
                                                                  52.34],
                                                                 [29,
                                                                  8.2,
                                                                  166.2,
                                                                  15.37,
                                                                  54.12],
                                                                 [30,
                                                                  8.3,
                                                                  167.1,
                                                                  14.77,
                                                                  55.92],
                                                                 [31,
                                                                  8.2,
                                                                  165.6,
                                                                  14.17,
                                                                  57.7],
                                                                 [32,
                                                                  8.3,
                                                                  166.9,
                                                                  13.57,
                                                                  59.49],
                                                                 [33,
                                                                  8.1,
                                                                  164.9,
                                                                  12.98,
                                                                  61.26],
                                                                 [34,
                                                                  8.3,
                                                                  166.8,
                                                                  12.38,
                                                                  63.06],
                                                                 [35,
                                                                  8.1,
                                                                  164.1,
                                                                  11.79,
                                                                  64.82],
                                                                 [36,
                                                                  8.3,
                                                                  167.1,
                                                                  11.19,
                                                                  66.62],
                                                                 [37,
                                                                  8.0,
                                                                  162.8,
                                                                  10.6,
                                                                  68.36],
                                                                 [38,
                                                                  8.4,
                                                                  168.4,
                                                                  9.99,
                                                                  70.17],
                                                                 [39,
                                                                  7.7,
                                                                  158.8,
                                                                  9.42,
                                                                  71.88],
                                                                 [40,
                                                                  7.5,
                                                                  141.1,
                                                                  8.91,
                                                                  73.39]],
   'OPERATING AND MAINTENANCE COSTS (M$/yr)': {'Absorption Chiller O&M Cost': None,
                                               'Annual District Heating O&M Cost': None,
                                               'Average Annual Peaking Fuel Cost': None,
                                               'Average Heat Pump Electricity Cost': None,
                                               'Average Reservoir Pumping Cost': None,
                                               'Average annual pumping costs': None,
                                               'OPEX': None,
                                               'Power plant maintenance costs': {'unit': 'MUSD/yr',
-                                                                                'value': 0.3},
?                                                                                           ^

+                                                                                'value': 0.29},
?                                                                                           ^^

                                               'Total operating and maintenance costs': {'unit': 'MUSD/yr',
-                                                                                        'value': 0.53},
?                                                                                                    ^

+                                                                                        'value': 0.52},
?                                                                                                    ^

                                               'Water costs': {'unit': 'MUSD/yr',
                                                               'value': 0.0},
                                               'Wellfield maintenance costs': {'unit': 'MUSD/yr',
                                                                               'value': 0.23}},
   'POWER GENERATION PROFILE': [['YEAR',
                                 'THERMAL DRAWDOWN',
                                 'GEOFLUID TEMPERATURE (degC)',
                                 'PUMP POWER (MW)',
                                 'NET POWER (MW)',
                                 'FIRST LAW EFFICIENCY (%)'],
                                [1, 1.0, 120.0, 0.0029, 1.6616, 5.9284],
                                [2, 0.9301, 111.61, 0.0029, 1.29, 5.3503],
                                [3, 0.9186, 110.24, 0.0029, 1.2345, 5.2605],
                                [4, 0.912, 109.44, 0.0029, 1.2032, 5.2096],
                                [5, 0.9074, 108.88, 0.0029, 1.1816, 5.1742],
                                [6, 0.9038, 108.46, 0.0029, 1.1651, 5.1472],
                                [7, 0.9009, 108.11, 0.0029, 1.1519, 5.1255],
                                [8, 0.8985, 107.82, 0.0029, 1.1409, 5.1073],
                                [9, 0.8964, 107.57, 0.0029, 1.1315, 5.0918],
                                [10, 0.8946, 107.35, 0.0029, 1.1232, 5.0782],
-                               [11, 0.893, 107.15, 0.0029, 1.1159, 5.0661],
?                                                               ^^

+                               [11, 0.893, 107.15, 0.0029, 1.116, 5.0661],
?                                                               ^

                                [12, 0.8915, 106.98, 0.0029, 1.1094, 5.0552],
                                [13, 0.8902, 106.82, 0.0029, 1.1035, 5.0454],
                                [14, 0.8889, 106.67, 0.0029, 1.0981, 5.0364],
                                [15, 0.8878, 106.54, 0.0029, 1.0931, 5.0282],
                                [16, 0.8868, 106.41, 0.0029, 1.0885, 5.0205],
                                [17, 0.8858, 106.3, 0.0029, 1.0842, 5.0134],
                                [18, 0.8849, 106.19, 0.0029, 1.0802, 5.0067],
                                [19, 0.884, 106.08, 0.0029, 1.0765, 5.0005],
                                [20, 0.8832, 105.99, 0.0029, 1.0729, 4.9946],
                                [21, 0.8825, 105.89, 0.0029, 1.0696, 4.989],
                                [22, 0.8817, 105.81, 0.0029, 1.0664, 4.9838],
                                [23, 0.881, 105.72, 0.0029, 1.0635, 4.9788],
                                [24, 0.8804, 105.65, 0.0029, 1.0606, 4.974],
                                [25, 0.8798, 105.57, 0.0029, 1.0579, 4.9695],
                                [26, 0.8791, 105.5, 0.0029, 1.0553, 4.9651],
                                [27, 0.8786, 105.43, 0.0029, 1.0528, 4.961],
                                [28, 0.878, 105.36, 0.0029, 1.0504, 4.957],
                                [29, 0.8775, 105.3, 0.0029, 1.0481, 4.9532],
                                [30, 0.877, 105.24, 0.0029, 1.0459, 4.9495],
                                [31, 0.8765, 105.18, 0.0029, 1.0438, 4.9459],
                                [32, 0.876, 105.12, 0.0029, 1.0417, 4.9425],
                                [33, 0.8755, 105.06, 0.0029, 1.0398, 4.9392],
                                [34, 0.8751, 105.01, 0.0029, 1.0379, 4.936],
                                [35, 0.8747, 104.96, 0.0029, 1.036, 4.9329],
                                [36, 0.8742, 104.91, 0.0029, 1.0342, 4.9299],
                                [37, 0.8738, 104.86, 0.0029, 1.0325, 4.927],
                                [38, 0.8734, 104.81, 0.0029, 1.0308, 4.9242],
                                [39, 0.8731, 104.77, 0.0029, 1.0292, 4.9214],
                                [40, 0.8727, 104.72, 0.0029, 1.0276, 4.9188]],
   'RESERVOIR PARAMETERS': {'Bottom-hole temperature': None,
                            'Fracture area': None,
                            'Fracture width': None,
                            'Injectivity Index': None,
                            'Plant outlet pressure': None,
                            'Production wellhead pressure': None,
                            'Productivity Index': None,
                            'Reservoir density': None,
                            'Reservoir heat capacity': None,
                            'Reservoir hydrostatic pressure': None,
                            'Reservoir porosity': None,
                            'Reservoir thermal conductivity': None,
                            'Reservoir volume': None,
                            'Thermal Conductivity': None,
                            'Well seperation: fracture height': None},
   'RESERVOIR SIMULATION RESULTS': {'Average Heat Production': None,
                                    'Average Injection Well Pump Pressure Drop': None,
                                    'Average Net Electricity Production': {'unit': 'MW',
                                                                           'value': 1.1},
                                    'Average Production Pressure': None,
                                    'Average Production Temperature': {'unit': 'degC',
                                                                       'value': 106.7},
                                    'Average Production Well Pump Pressure Drop': None,
                                    'Average Production Well Temperature Drop': None,
                                    'Average Reservoir Heat Extraction': None,
                                    'First Year Electricity Production': None,
                                    'First Year Heat Production': None,
                                    'Initial Production Temperature': {'unit': 'degC',
                                                                       'value': 120.0},
                                    'Maximum Production Temperature': {'unit': 'degC',
                                                                       'value': 120.1},
                                    'Minimum Production Temperature': {'unit': 'degC',
                                                                       'value': 102.1}},
   'RESOURCE CHARACTERISTICS': {'Geothermal gradient': {'unit': 'degC/m',
                                                        'value': 0.0262},
                                'Maximum reservoir temperature': {'unit': 'degC',
                                                                  'value': 375.0},
                                'Number of segments': {'unit': 'count',
                                                       'value': 1}},
   'SUMMARY OF RESULTS': {'Annual District Heating Demand': None,
                          'Average Annual Geothermal Heat Production': None,
                          'Average Annual Peaking Fuel Heat Production': None,
                          'Average Cooling Production': None,
                          'Average Direct-Use Heat Production': None,
                          'Average Net Electricity Production': {'unit': 'MW',
                                                                 'value': 1.1},
                          'Direct-Use Cooling Breakeven Price': None,
                          'Direct-Use heat breakeven price': None,
                          'Electricity breakeven price': {'unit': 'cents/kWh',
-                                                         'value': 37.37},
?                                                                    ^^^

+                                                         'value': 36.74},
?                                                                   ++ ^

                          'End-Use': None,
                          'Flowrate per production well': {'unit': 'kg/sec',
                                                           'value': 110.0},
                          'Geothermal gradient': {'unit': 'degC/m',
                                                  'value': 0.0262},
                          'LCOE': None,
                          'LCOH': None,
                          'Number of injection wells': {'unit': 'count',
                                                        'value': 0},
                          'Number of production wells': {'unit': 'count',
                                                         'value': 1},
                          'Well depth': None},
   'SURFACE EQUIPMENT SIMULATION RESULTS': {'Annual District Heating Demand': None,
                                            'Average Annual Cooling Production': None,
                                            'Average Annual Heat Production': None,
                                            'Average Annual Heat Pump Electricity Use': None,
                                            'Average Annual Net Electricity Generation': {'unit': 'GWh',
                                                                                          'value': 8.62},
                                            'Average Annual Total Electricity Generation': {'unit': 'GWh',
                                                                                            'value': 8.64},
                                            'Average Cooling Production': None,
                                            'Average Daily District Heating Demand': None,
                                            'Average Geothermal Heating Production': None,
                                            'Average Net Electricity Generation': {'unit': 'MW',
                                                                                   'value': 1.1},
                                            'Average Net Heat Production': None,
                                            'Average Peaking Boiler Heat Production': None,
                                            'Average Pumping Power': {'unit': 'MW',
                                                                      'value': 0.0},
                                            'Average Total Electricity Generation': {'unit': 'MW',
                                                                                     'value': 1.11},
                                            'Initial Cooling Production': None,
                                            'Initial Net Electricity Generation': {'unit': 'MW',
                                                                                   'value': 1.66},
                                            'Initial Net Heat Production': None,
                                            'Initial Total Electricity Generation': {'unit': 'MW',
                                                                                     'value': 1.66},
                                            'Initial geofluid availability': {'unit': 'MW/(kg/s)',
                                                                              'value': 0.06},
                                            'Maximum Cooling Production': None,
                                            'Maximum Daily District Heating Demand': None,
                                            'Maximum Geothermal Heating Production': None,
                                            'Maximum Net Electricity Generation': {'unit': 'MW',
                                                                                   'value': 1.67},
                                            'Maximum Net Heat Production': None,
                                            'Maximum Peaking Boiler Heat Production': None,
                                            'Maximum Total Electricity Generation': {'unit': 'MW',
                                                                                     'value': 1.67},
                                            'Minimum Cooling Production': None,
                                            'Minimum Daily District Heating Demand': None,
                                            'Minimum Geothermal Heating Production': None,
                                            'Minimum Net Electricity Generation': {'unit': 'MW',
                                                                                   'value': 0.94},
                                            'Minimum Net Heat Production': None,
                                            'Minimum Peaking Boiler Heat Production': None,
                                            'Minimum Total Electricity Generation': {'unit': 'MW',
                                                                                     'value': 0.94},
                                            'Surface Plant Cost': None}}
@softwareengineerprogrammer softwareengineerprogrammer added the bug Something isn't working label Oct 11, 2023
@softwareengineerprogrammer
Copy link
Collaborator Author

@malcolm-dsider Should we just delete this case, or can/should it be fixed? Talked to a user yesterday who was trying to run it and getting hung up on it not workign

@malcolm-dsider
Copy link
Collaborator

Whatever the problem is, it needs to be fixed. The code from Wanju enables our multi-lateral closed-loop functionality. The example reproduces values from a published paper.

The example works on my instance.

Is the problem in the differences in these values: Surface power plant costs: 6.74 vs. 6.12; CAPEX: 36.79 vs. 36.18; and Total surface equipment costs: 7.24 vs. 6.63? If so, then the problem is likely caused by the update in the cost metrics, not anything in the closed-loop code. If so, we just need to update the "right" values in the output so they match.

If anyone is having trouble with closed-loop parts of the code, you should probably direct them to me since I wrote that section.

@softwareengineerprogrammer
Copy link
Collaborator Author

softwareengineerprogrammer commented Nov 30, 2023

@malcolm-dsider yep it's a diff of the values; apologies for the curveball re: the user issue, that was actually a red herring as it turns out.

Surface power plant costs: 6.74 vs. 6.12; CAPEX: 36.79 vs. 36.18; and Total surface equipment costs: 7.24 vs. 6.63?

It's those and a few others (you can ctrl+f for ^ through the block above I posted for the full list of discrepancies). Sounds like some of these deviations are expected and we can just update the test with the current output for that input? If so I'll just include that in my outstanding PR.

@malcolm-dsider
Copy link
Collaborator

malcolm-dsider commented Nov 30, 2023 via email

softwareengineerprogrammer added a commit to softwareengineerprogrammer/GEOPHIRES that referenced this issue Nov 30, 2023
@softwareengineerprogrammer
Copy link
Collaborator Author

softwareengineerprogrammer commented Nov 30, 2023

Addressed by softwareengineerprogrammer@950e939 & softwareengineerprogrammer@3c79eae which will be included in #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants