Geothermal Hackathon 2021
The second annual geothermal hackathon happened a couple of weeks ago and I was deeply impressed by the diverse backgrounds of the people who came, the sense of community, and how much can be archived in only two days.
I was stoked that people chose to contribute to both of the ideas I proposed: Pythonizing a resource estimation tool and computing boiling point for depth. Both projects reached the point of ‘minimum viable product’ but there is still much work to be done.
The geothermal hackathon was held at the Software Underground (SWUG) Chatau (pictured above). Matt and the team at Agile organised the event, and they wrote a nice overview of the hackathon projects. Below reviews the two ideas I proposed, how far we got and what's next for them.
Pythonizing a Resource Estimation Tool
Check out the repository here
In the 90’s, William (Bill) Cumming abandoned his Fortran code for doing resource assessments and wrote a new tool in Excel. Bill’s Excel tool enables specialists to generate a probabilistic evaluation of geothermal resource exploration success and capacity using analogue reasoning. It was designed to be simple enough that the process and the choices made could be audited.
This tool is now regularly used by many high-temperature geothermal consultants and companies. The goal of the hackathon project was to give it a makeover for the new century.
We focused on converting the two most regularly used parts of Bill’s excel tool: 1) The probability of exploration success calculator and 2) the probabilistic power density resource capacity estimator.
Estimate Probability of Exploration Success: Is it there?
The first part of the Excel tool is aimed at helping resource teams estimate the probability of exploration success based on three key resource criteria:
Temperature: Is there sufficient temperature to meet the requirements of the power conversion technology?
Chemistry: Is the fluid chemistry beguine or manageable?
Permebility: Is there enough permeability (magnitude and volume) for wells to sustainably flow?
Only having three criteria in this tool was a deliberate design choice because it reduces the risk of overestimating success while focusing on key factors that determine exploration success. If there were many parameters, then a small change to each parameter could have a large impact on the resulting probability of exploration success. This is dangerous because it makes it easier to fall into the trap of tuning results toward the positive by making small changes to the input parameters.
This simple mulpilcation of three key resource parameters may not be a sophisticated approach to probability. It is, however, a useful approach because it focuses discussion.
Estimate Resource Capacity: If it is there, how big is it?
If there is enough data, then a numerical simulation is the best approach to estimating geothermal resource capacity. However, building a simulation may not be appropriate when only a rough estimate of power capacity is needed or in the early stages of exploration where there is insufficient data to constrain a model. In these cases, a power density approach is preferred.
The stored heat (heat in place) methods are often not used because they are more difficult to audit and the ‘recovery factor’ is poorly constrained. This recovery factor dictates the heat that can be extracted and has a huge impact on the final MWe result. Stored heat approaches also tend to lead to capacity overestimates because low permeability regions can be included. For more discussion comparing numerical model, stored heat (i.e., heat in place), power density approaches to resource estimates, check out this classic paper.
The power density approach to resource capacity estimation involves multiplying the potentially productive area of the geothermal prospect (km2) with the power density (MWe/km2) constrained using one or more developed geothermal resources that are similar to the prospect (i.e., analogues). The underlying calculus is simple but selecting reasonable input areas and an appropriate power density challenging.
The area should be constrained using a robust, interdyciplnary conceptual modelling process and a range of possible models (P90 smallest, P50 intermediate and P10 largest) need to be developed to reflect the resource uncertentity. Then the potentially productive sector for P90 and P10 is input power density calculation, and it returns a P50 area that can be checked against the P50 model. Only the P90 and P10 are input into the tool because it's easier to accurately constrain the smallest and largest possible conceptual models. Intermediate conceptual models developed without this cross-check tend to be larger than a true P50.
Because the power density approach relies analogue reasoning (i.e., comparison to developed resources with similar characteristics), it requires input from people with experance and knowledge across a range of projects. With just over 170 developed high temperature geothermal reservoirs world wide and a huge diversity of resrouce type and development approch, using frequentist statistics to to constrain power density is not recommended. A published plot of power density from Wilmarth et al. (2020) is included in Bill’s power density too that assists with the identification of analogues but, as the correlation curves on this plot are a poor fit to the underlying data, they should be only treated as a rough guideline.
The Python Tool
The aim is to have a tool that operates on three levels:
Simple graphical interface in Steamlit for teaching and exploring the power density approach to resource estimates
Expanded documentation as a Jupyter Notebook that we plan to also deploy in Curvenote where it can be read like an article without an Anaconda installation
A PyPI package for the power users who may want to test multiple resource scenarios at once or explore different curves
The team achieved most of this during the two-day hackathon!
Hannah Wood, who is an Oil and Gas resource estimate specialist, converted Bill’s methods into Python and suggested some future refinements: We were lucky to have a domain expert like Hannah join the team. Jan Niederau, a geothermal scientist from Switzerland, tackled the problem of making an interactive power density plot. Data scientists Will Middlebrook and Jeff Jex from Canada turned the code developed by the European end of the team into a streamlit app.
Bill came by the SWUG Chateau to share why some of the original design decisions were made in his tool, provide some methodological context, and suggest some future features. Meanwhile, I’m still recovering from the guilt of not writing a lick of code in the entire two days because a conflicting commitment meant I could only make it to the SWUG Chateau short while in the early morning and late evening.
The future work list is pretty long. One priority is adding an interactive power density plot that links to case history literature. It’s not clear yet how best to do this, but perhaps linking with the work done by NREL to build a geothermal wiki will be a good start. The authors of the 2020 power density catalogue (Maxwell Wilmarth, James Stimac and Gugi Ganefianto) have kindly provided their data to the repository, and this will be the foundation of the interactive plot.
Computing Boiling Point for Depth (BPD)
Check out the repository here.
The aim of the second project was to scope the work needed generate a tool that did gas and salt corrections for BPD curves. That aim was well-surpassed thanks to Thorsten Hörbrand, a geothermal reservoir engineer and hydrochemist from Germany. Thorsten led this project with Jan Niederau, a geothermal scientist from Switzerland. Matt from Agile also contributed some code using the pint package that makes the method unit aware.
Wrangling with Saturation
The BPD curve is the temperature of saturation (two-phase/boiling) conditions for a given pressure. Development of the BPD curve concept, as it is used in geothermal resource analysis, was informed by early drilling at Yellowstone National Park in Wyoming and at Steamboat Springs in Nevada. In these systems, the reservoir temperature was found to be close to boiling for the corresponding hydrostatic pressure (White, 1968b; White et al., 1968). The depth below the water table to boiling could therefore be converted into a simple rule-of-thumb tool. Today, the BPD curve is a valuable and regularly used tool for both reservoir and well analysis in two-phase liquid or vapour dominated geothermal resources.
Increasing salinity (Na-Ca-K-Cl) or gas (dominantly CO2 and H2S) concentrations will have opposing effects on depth to saturation, and the methods in this repository enable correction for these effects. Increased gas concentration will allow boiling to start at greater depths whereas an increased salinity increases the density of the fluid and thereby the hydrostatic pressure at a given depth. The fluid, therefore, has to reach shallower depths before boiling. Most geothermal reservoirs have low concentrations of salts and small changes in salinity have little impact on the BPD curve. In contrast, a shift in gas concentration will have a great impact on BPD. Subsequently, boiling zones can be much deeper in high-gas geothermal reservoirs than in those that are gas-poor.
The Python Tool
The repository contains methods that:
Calculate BPD curves for a pressure profile measured in a well
Calculate a BPD curve for a synthetic hydrostatic gradient (i.e., without well data)
Salinity and gas correction using the PHREEQC chemical simulator package in the back end, with the gas correction still in progress.
I can see this work becoming part of the everyday toolkit of reservoir engineers who work with python and are looking for a replacement to the Excel steam tables plugin. The BPD curve for a synthetic hydrostatic gradient will be useful for people developing resource conceptual models, especlly those with high salt and gas concentrations.
Copyleft is not right for this work
One of the things that came up during the BPD tool development was an issue with the iapws python package we were using for the steam and water properties (steamtables). This package is licenced GPL, so using it means we have to change our licence GPL as well.
GPL is a copyleft licence that enforces the free software philosophy, which not open source because you can’t choose to do what you like with the code. As open-source software has become an important part of commercial software enterprises, GPL usage is declining and many people are actively avoiding using packages licenced GPL.
Because our goal is to make something that people will use, Thorsten used some impressive google skills (and a couple of hours) to identify an alternative package 'chemicals' that contains the steamtables we need. We are looking forward to closing this issue on the BPD repo.
These projects reflect two very different ways that Python can contribute to geothermal resource development:
Providing a simple interface for those working on the conceptually difficult, interdisciplinary problem of resource assessment
Wrapping data handling, steamtables and geochemical modelling into a powerful single method for geothermal reservoir engineers
I’m looking forward to seeing how these projects evolve and to finding other opportunities for open source contribution to global geothermal development.