Geothermal's Path to Relevance: Better Heat Transfer and Heat Engines

2022 July 27 Twitter See all posts


This post is the follow up to my drilling technology post detailing technology needed to make geothermal electricity from hot, dry rock economical.

Drilling Post Recap

In the previous post, I argued that current drilling technology is close to being practical for wells up to 10 km. The main modification required is elastomer-free mud motors with appropriate RPMs for PDC bits.

The well design must be extremely simple and take advantage of the geology of the granite basement rock to keep costs reasonable. Vertical wells using the granite as casing are best. Even a small amount of drilling could incentivize bit modifications, new motor designs, and the construction of larger drilling rigs that could push drilling to 20 km depths.

The following covers geothermal's other challenges: getting the heat from the rock and turning that heat into electricity.

The Heat Transfer Problem

In an ideal world, the heat transfer through rock would be fast enough to make vertical closed-loop geothermal wells economic at less than $20/MWh. Sadly, this is not the case.

Thinking Through Geothermal Heat Transfer

Heat transfer rate increases as the temperature difference between two bodies increases. Imagine a hot pipe surrounded by an inexhaustible heat sink that maintains a constant temperature.

If you pump water through the pipe, the water will warm up through conduction and forced convection. If you pump the water slowly, the water exiting will be close to the heat sink temperature. If you pump the water rapidly, the outlet temperature will be lower, but energy transfer increases. The higher velocity (through forced convection in the water) and the increased temperature differential increase the heat transfer rate.

Any geothermal system faces the same constraint. Energy extraction increases with higher velocity and lower outlet temperature. But pumping costs increase, and lower outlet temperature causes decreased power plant efficiency on the surface.

The rock surrounding a wellbore is not a perfect heat sink. Heat travels through the rock via conduction, which is relatively slow. The rock near the wellbore cools, heat transfer into the circulating fluid decreases, and heat from surrounding still hot rock flows toward the colder wellbore walls creating a temperature gradient. Conduction through the granite rock is the primary constraint to increasing extraction.

Pumping cold water down a wellbore causes a temperature gradient.

Modeling Closed Loop Heat Extraction

If you have a deep, vertical hole, the simplest way to extract heat is to circulate water within it.

A vertical, closed-loop configuration. Source

Modeling a configuration like this is complex but is far easier than most other geothermal heat extraction strategies. The solution requires calculus, given the gradient nature of the problem. Luckily we don't need the precise equations because many of our assumptions about rock properties will have errors. We can use our computer to brute force an answer through a "Riemann Sums" iterative strategy. The python code and explanations for these calculations are in Appendix A below.

A 20 km deep closed-loop well might only extract 6-12 MW of heat. Given the relatively low efficiency even at these elevated temperatures, the electricity output would be 2-3 MW. If we use our drilling model to estimate a very aggressive cost paired with relatively rosy assumptions on rock properties, we are looking at $20-$30/MWh LCOE just for the well (LCOE Model is Appendix B). Power plant CAPEX is significant, so this is a no go for sub $20/MWh costs. Collecting heat has to be <$10/MWh to have a chance, which means each well needs to produce more heat.

There are three main thermodynamic strategies to increase heat extraction.

Open Loop

Open-loop systems are also known as Enhanced Geothermal Systems (EGS). A vertical, closed-loop heat extraction system might only impact rock temperature for a few feet. With EGS, you create pathways hundreds of feet long between wells via fracturing.

EGS scheme with vertical wells; Source: NREL

The effective surface area of rock for heat transfer might increase as much as an order of magnitude.

EGS has the most technical risk because fracturing might fail to connect wells, or fluid might not flow through the fractures in ideal ways. Decades of attempts have yielded several minor successes.

Closed Loop + Natural Convection (Hybrid)

Natural convection is where fluid flows because of changes in density (driven by temperature differences) without external forces like pumping. Warm water has a lower density than cold water and rises while the cold water sinks. Removing heat at the top of a reservoir turns hot water into cold water that repeats the process.

Natural convection happens in the roots; Source: Eli Dourado

Heat transfer might increase 2x-5x if a reservoir around a closed-loop pipe can facilitate natural convection. Convection increases heat transfer since fluid moves heat instead of conduction through rocks.

Sage Geosystems is one startup pursuing this angle. They hope to get something like 5x improvement. Their wells will be in sandstone reservoirs with over 1000 millidarcies (mD) of permeability. Basement granite might be 0.1 mD. You can fracture the basement rock and achieve high permeability within fractures, but even a 2x improvement might be optimistic without extra help from a natural reservoir. It also might be challenging to fracture and prop the more ductile rock at 20 km depths.

Creating reservoirs for natural convection isn't likely to work on the first try but holds long-term promise. Experimentation could be relatively cheap after drilling a well.

Closed Loop, Conduction Only

A feature that emerges from a drilling cost model is that the cost per foot of drilling in the granite could drop like a rock. Line items like the surface location, the surface hole, and drilling through sedimentary layers have less room for decreases. A foot of wellbore with a rock temperature of 300 C is much more valuable than a 150 C one.

Companies like Eavor want to use directional drilling technology to drill many laterals from one surface hole. More deep laterals spread fixed costs and increase desirable high-temperature rock contact.

Eavor wants all of the footage; Source: Eavor

Heat transfer is limited to conduction, but the extra footage makes up for it. Relying only on conduction is more expensive but lower risk.

One challenge is that directional tools are expensive to run. Some good news is that a directional tool technology called "Rotary Steerable" has improved in cost and reliability. Traditional tools require the drilling pipe to be stationary, and the driller "slides" by orienting a slightly bent motor in the desired direction. Operating in this mode reduces drilling speed and struggles to remove cuttings. Drillers will only slide 10'-20' per 90' stand making the wellbore look like a porpoising dolphin. Rotary steerable assemblies eliminate those issues by allowing continuous steering while rotating the drill pipe. They could lower the cost of extra laterals.

The more intractable problem is temperature limitations. Electronics don't tolerate 300C heat well. Lower rock temperature means lower heat transfer and lower efficiency in the power plant on the surface. Closed-loop, conduction-only designs need heat-resistant tools or schemes that allow all the directional work to happen at shallower depths.

Eavor does have several projects lined up in places like Germany and will generate some demand for better tools.

I can imagine someone pushing Eavor's design further. They might make the laterals perfectly vertical to drill the deep section of laterals without directional tools. The tricky part would be connecting the laterals to their pairs on the second well. The gap can be as small as 50'. An operator might prepare chilled water to pump down the hole in a desperate attempt to keep the temperature down for the directional tools in the few hours it takes to trip through high heat sections and drill the gap.

Cheap Drilling is a Substitute

The better drilling is, the simpler the heat transfer solution can be. All three technologies can theoretically reduce the "collect heat" cost-share to <$10/MWh. Deeper, cheaper wells mean any EGS scheme can be less ambitious. Closed-loop, conduction can have a chance with lower drilling costs and better directional tools. Both increasing depths and decreasing dollars per foot play a role in getting there.

Drilling is the easiest to solve of the three big problems geothermal faces. It provides hope even if some heat transfer enhancements fail.

The Heat Engine Problem

Steam Turbines are Huge

Steam contains an immense amount of energy. Much of it comes from latent heat, or the heat gained/released during changes from liquid to vapor. Turbines can't take advantage of latent heat because water droplets cause erosion on turbine blades. Only about 10% of the steam condenses in a typical turbine. The pressure at the turbine outlet is a vacuum because water has a lower boiling point at lower pressures, allowing better energy extraction.

Exhausting a turbine at atmospheric pressure leaves a lot of meat on the bone; Source: Nuclear-Power.net

The downside is that fluid volume increases as pressure decreases. The turbine and the heat exchanger that condenses the vapor are both enormous. Big is expensive. Even if you could drill ultra-deep wells and extract massive amounts of energy from the rock through technologies like enhanced geothermal, building and operating the steam turbines alone would make your electricity too expensive in many competitive power markets.

The heat engine problem is one of the most pressing problems for geothermal.

Alternatives

Repower Coal Power Plants

The startup Quaise has one of the few proposals capable of producing <$40/MWh geothermal electricity. They call for repowering existing coal electricity generating plants.

The advantage is that coal power plants already have steam turbines and grid connections, lowering CAPEX. The long lead time items on new geothermal projects on private land are the power plant and an interconnection agreement with the electricity market. Using existing infrastructure shortens the time to market significantly. Repurposing old equipment always comes with unexpected costs, but the benefits are enticing.

The trick is that the turbines require high temperature, high-pressure steam like coal boilers create. Any wells supplying the plants must reach depths as deep as 20 km to create that steam temperature. Shallower wells are stuck building their power plants.

Supercritical CO2 Power Cycles

Brayton Cycle designs with carbon dioxide working fluid are a popular alternative. The primary reason is that the ideal outlet pressure for a CO2 turbine in a closed cycle is over 1000 psi. CO2 becomes a supercritical fluid at sufficient pressure and requires less energy for compression. The high outlet pressure means the turbine and heat exchanger are tiny compared to steam systems.

GreenFire Energy is the leader in researching CO2 cycles for geothermal. They've found that a system adapted for geothermal applications can be simpler than typical designs. The CO2 can thermosiphon within the well, eliminating the compressor and some heat exchangers. The surface equipment is limited to a turbine and one series of heat exchangers.

Companies like Toshiba already have CO2 turbine designs, reducing technical risk. Eavor uses a CO2 working fluid in its shallow closed-loop systems.

The total cost reduction is uncertain since the technology is new. Some rough comparisons suggest costs could be 30%-50% cheaper than steam turbines at comparable inlet conditions. A medium-term aspirational goal might be for the surface equipment portion of a geothermal project to match a gas turbine power plant CAPEX of around $700/kW.

Thermoelectric Generators

Thermoelectric generators (TEGs) are appealing because they are a solid-state technology. The long-term cost reduction potential is impressive, but the technology is relatively pricey and low-efficiency today. Applications for TEGs extend beyond the geothermal industry, and the challenge is probably too great for the industry to spearhead development alone. Hence the focus is on lower-risk options like repowering coal plants or CO2 turbines.

There are Few Regulatory Barriers

No one is stopping startups but themselves.

The Federal Lands Mirage

The geothermal industry has spent significant bandwidth claiming that federal regulations are stymying its development. At first glance, this makes sense because most current geothermal electricity production is on federal lands, and many of the shallowest heat resources are also on federal lands. The industry wants similar NEPA exemptions as the oil and gas industry gets.

On closer inspection, worrying about federal lands is a waste of time.

People, Not Bison, Use Electricity

Humans rarely live on federal lands. Park rangers, soldiers, and van life enthusiasts are a few exceptions. One of the primary advantages of advanced geothermal is that it can be sited near load centers and avoid extensive transmission infrastructure. Building geothermal power plants on federal lands means constructing long-distance transmission lines to private land where people live and work.

Federal Lands Have Many Costs

The political equilibrium means federal rules will always be stricter than on private land. The wait time for an oil and gas drilling permit from state agencies might be hours. A drilling permit from federal agencies can take years. Companies with extensive public lands operations "stockpile" permits to cover years' worth of drilling inventory. Natural gas flaring is more prevalent on federal leases because of the difficulty and expense of building pipelines across federal land. Oil is a rare resource, and exploration companies are willing to eat the extra cost the feds impose. If you are a startup that touts your technology as being available everywhere, it seems suicidal to drill on federal land, even with NEPA exemptions. Your company's epitaph might read: "Ran out of cash after Lesser Prairie-Chicken nest delayed transmission line construction." NEPA is only the tip of the spear.

If both federal and private land is available near load centers, the private land makes more sense every time. Many states are accommodating toward drilling.

Follow the Coal Plants

There are few coal plants on federal lands. Repowering coal plants requires drilling on private land.





Development on federal lands means spending more money on power lines and heat engines and longer waits for regulatory approval.

Lessons from Fracking

Engineering vs. Science

There is tension between practitioners and scientists in the oil and gas industry. Uncertainty is high given how complex geology is and how expensive data is to acquire. Scientists generally want to spend more money obtaining data and creating ever-complex models or explanations from the data available.

Practitioners focus heavily on the cost per barrel/MCF recovered, are skeptical of most models, and are more comfortable with empirical results that don't have strong theoretical underpinnings.

The fracking revolution has driven a massive shift in the industry away from scientists like geologists and toward practitioners that are often engineers. The scientists are still valuable, but less so than before. Partly this is because there is no need to "discover" shale formations since they have been known to the industry for 100+ years. And partly because the engineering-based learning model has thumped the scientist model recently.

Iterative Learning

Even after decades of research by the government and oil majors, shale oil and gas still seemed unobtainable. Curious engineers at a mid-size Texas oil company named Mitchell Energy made discoveries that kicked off the shale revolution.

The technique that ended up working, slickwater fracs, was derided by the establishment for scientifically sound reasons (at the time). Improvements came from gradual, iterative improvements driven by empirics rather than clever models or theories. Better drill bits and increasing frac job intensity are the two key improvements.

Drill bits see a massive variation in performance in different areas. Minor tweaks in cutter design or arrangement make a difference. Drill bit companies use a flexible model where new bit designs can be profitable with as few as 50 uses. Design improvements follow evolutionary-like models where bit companies trial tweaks on customer wells.

There are only a few factories in the world that make the cutters. They are like artisan workshops where custom machines try to smash carbon to thousands of pounds of pressure to create durable PDC cutters.

Models that predict frac job performance have consistently lost to some engineer saying forget it and upping how much sand and water gets pumped downhole. Besides failing to predict the success of slickwater, models didn't account for the success of low-quality sand. Until recently, the industry used only the most spherical sand at great expense. Theoretically, spherical sand should drastically improve permeability over wonky sand. Sourcing this sand from places like Wisconsin became a problem once oil companies started using trains worth of sand in a single well. Eventually, companies sourced local, low-quality sand at a much lower cost and rarely saw performance decreases. They bought more sand on the same budget and made better wells. Each formation eventually reaches a limit where further intensification doesn't help. The industry always finds that point empirically.

Discoveries like this extend to the geothermal industry. Oil and gas fracturing techniques all failed in enhanced geothermal applications. After trial and error, the industry discovered fractures stay open when operators pump water colder than the surrounding rock.

Just Do It

When it comes to low information environments, just trying stuff is powerful. Only the simplest models are worth using.

While it is exciting to see the interest in geothermal, much of the effort leaves me skeptical.

Quaise is staffed heavily by former Schlumberger employees. Schlumberger is known for being too expensive and impractical in many of its business units for shale. It is on-brand that they are building a laser-like drilling technology! Quaise deserves credit for correctly identifying the challenges in geothermal economics and pursuing a path with a greater than zero chance of success. But many of their assumptions are off base. The large, bureaucratic companies you work with at Schlumberger often do things like limit trip speed to 500'/hr. One time tripping fast caused a blowout by swabbing the hole, so no rig contracted by the company can trip fast even if the blowout risk is low. Smaller companies are ripping out of the hole at 4000'/hr. Tripping in granite is like tripping in a cased hole. Most companies will push the speed to the physical limits of the crew and rig. And even at 50,000' depths, on-bottom drilling will dominate total time (assuming a high-temperature motor is available). Both PDC bits and motors suffer from the vibration drilling in hard rock causes. There is a decent chance that PDC and elastomer-free motor assemblies will see longer runs at deep depths because the rock is more ductile.

New industry organizations are staffed heavily with scientist types instead of practitioners. I constantly see these types saying: "We need to adapt O+G technology to find where the heat is!" I suggest starting 20 km directly under a retiring coal power plant.

Is there a startup or organization for just drilling holes in the ground? As detailed in my geothermal drilling technology post, Utah FORGE is the closest we have. Their work showed that some PDC bits with zero geothermal relevant modification are good enough or almost good enough to drill to 20 km cost-effectively. Bigger rigs, optimized bits, and elastomer-free motors will come once a few rigs chase deep drilling. Since I wrote that post, I have heard that [REDACTED STARTUP] had similar success in testing at [REDACTED DRILLING R+D CENTER NEAR A PROMINENT INLAND PORT] in Oklahoma.

I'm convinced that simpler technologies will eventually outcompete technologies like millimeter-wave drilling. Millimeter-wave drillers will still use conventional bits and motors at shallower depths because they are cheaper. The bit and motor field salesman will be screaming at corporate: "If we can get a bit that does X, we will get another run on each well! Give me something to try!" Soon there will be modified motors and bits that are the cheapest way to drill to 20 km.

Seismicity Matters

Another lesson from fracking is that the general population has zero tolerance for induced seismicity. Several geothermal projects in Europe have already been shut down because of it.

Predictions of induced seismicity are hard. No one predicted that wastewater injection into the sedimentary rock in NW Oklahoma would cause regional pressure and fluid changes in the basement that lubricated faults.

The simplest models suggest there might be increasing seismicity risks up until a certain depth (5-8 km?), then decrease as rocks become more ductile. If you want to use technologies like enhanced geothermal, there is no getting around that you have to drill the wells to find out.

There is no reason this has to be a show stopper. There is a spectrum of seismic risks. Closed-loop technologies like Eavor uses have none. Hybrid closed-loop methods have minimal risk because they use small frac jobs and don't continuously add fluid. Technologies that plan to drill six kilometers deep in basement rock, use EGS, and hope to jam extra fluid in the reservoir at night to arbitrage electricity prices have more risk. It is almost impossible to quantify the risk, though. If seismicity is an issue, drilling technology will have to make up for where heat transfer enhancements fail.

The Technology - Market Mismatch

The US is the drilling technology leader and has the thickest service market. It also (usually!) has much cheaper energy, making entry harder.

Germany has subsidies totaling over $200/MWh for geothermal electricity. It does not have many drilling services and bans technologies like hydraulic fracturing that could improve heat transfer rates.

In the US, you earn $30-$50/MWh. Spot prices might be high in the summer of 2022, but the electricity futures curve is backwardized so future prices are not high. Solar and wind threaten to push down average wholesale electricity prices further. Many in the geothermal industry hope to decarbonize the last 10%-15% of electricity production at prices higher than wholesale rates. Built into that assumption is:

  1. That we will shut down nuclear power plants early (when everywhere in the US but California is thinking about subsidies to keep plants open).

  2. We will ban or tax natural gas several times above the accepted "social cost of carbon" of around $40/ton.

  3. Utilities won't offer variable price electric vehicle charging schemes that encourage off-peak charging and significantly reduce the cost of integrating more solar and wind.

Any technologies built on these assumptions could fall short of their goals.

The US is also rapidly closing aging coal plants. Places like India and China have numbers of relatively new, low utilization coal plants but less drilling technology and few geothermal incentives.

These mismatches put geothermal in a hard place. If you had US technology, human capital, and regulations in Germany, there would already be dozens of "wildcat" geothermal wells. Even closed-loop, vertical wells with very conservative assumptions could be economic at $200/MWh. Ditto for Germany pricing in the US. Of course, the US doesn't need alternatives like geothermal as much as Germany, and most of the US is sensitive to higher energy prices.

If geothermal becomes global, I think it has to start in the US with simple technologies that are cheap enough to compete in US power markets and are easier to adopt globally than natural gas fracking technology is. $30/MWh in the US is probably $50-$100/MWh elsewhere for the foreseeable future, limiting near-term geographic arbitrage.

Thinking Through Business Models

A challenging aspect of geothermal electricity development is a business model/expertise mismatch. Traditional geothermal companies have been slow to adopt new drilling techniques, and the simplification of wells required for deep, dry rock wells is mind-bending compared to typical hydrothermal operations. Capital is relatively scarce for them. Nimble oil companies that might be more comfortable with the risk profile and drilling techniques don't know how to build power plants or work through the grid interconnection process. Existing steam users like coal power plants or manufacturing facilities do not want to take on the risk of a geothermal drilling project.

A possible solution might be a Steam Purchase Agreement (SPA). A coal power plant would sign an agreement with an intrepid driller to buy any steam they could provide. The power plant has no upfront capital risk, while the driller can start selling energy without waiting years to build a power plant.

The SPA structure could extend to factories, chemical plants, paper plants, and district heating systems that use steam for process heat. There are already niche cases of geothermal heat powering industrial processes. They are generally low temperature and very location specific since hydrothermal resources are rarely near factories.

Avoiding making electricity has a structural advantage. When providing process heat, geothermal's efficiency disadvantage against natural gas disappears. Each is near 100% efficient instead of natural gas combined cycle power plants being 60% efficient, while dry rock geothermal power plants would be 10%-30% efficient. The improvement against solar or wind electricity-derived process heat is even more significant. A simple vertical closed-loop well might be in the money providing steam for a district heating system, even if it's a money loser for electricity generation. Deep wells in dry rock dramatically increase the possible customers by providing higher temperature steam. If we use Quaise's numbers to make steam, their breakeven would be the equivalent of $1/MCF natural gas. That is laughably cheap.

There are still challenges. The heat a well produces could be challenging to match with a specific application, leading to wasteful overcapacity. Similarly, if user demand is sporadic, the utilization of a well will be low, and costs will rise compared to fuels. Most integrated chemical plants have a surplus of low-temperature steam because of the 2nd law of thermodynamics, limiting the initial customer base for 10km wells.

There is one industrial opportunity that stands out. 37% of US industrial fossil fuel usage is to make steam. The paper industry uses 35% of that steam. Paper plants require steam temperatures between 100C and 180C. That is accessible at 10 km for much of the country. Taking over 13% of fossil fuel's industrial market share is a big nut. Food processing, textiles, and lumber/wood products are also fossil fuel steam users that likely have mild steam temperature needs. An efficiently drilled vertical, closed-loop well might be cost-effective in many paper mill locations. Extra heat transfer and increased depth past 10 km lower the breakeven cost rapidly.

Source: USDA



Source: SMU

Another promising avenue is replacing coal, gas, or oil in district heating systems. Most of these systems in the US are at universities with strict decarbonization goals. They are looking at expensive upgrades to use electricity and heat pumps. Heat pumps are less effective because many of these systems use steam. Converting district heating systems alone might be enough to kick start the technology and build out of rigs.

Direct process heat provides an early market to develop techniques to improve drilling and heat transfer despite the challenges. It reduces CAPEX, complexity, and time to market.

Drilling Ahead

My overall estimate hasn't changed. I think there is a 5% chance geothermal delivers more than 10% of our electricity. And that estimate won't change until more improvement comes.

More than one technology needs commercialization to achieve <$20/MWh. The heat engine problem is critical to solve and should drive further engineering decisions. The numbers won't work in many places building new steam power plants. Repowering coal plants or better thermoelectric generators provide the most flexibility in solving the other challenges. A supercritical CO2 power cycle likely requires almost perfect execution elsewhere. Improvement in drilling costs is also non-negotiable. If techniques to increase heat transfer via fracturing don't work, methods to use directional tools in high-temperature, high-pressure environments become a requirement.

Geothermal has incredible potential but has a tortuous path to market given the stiff competition from other electricity generation sources and mismatches in markets, technology, and regulation. Improving drilling technology to reach depths that can create supercritical steam for existing coal plants is likely the fastest and highest probability path to a 10% market share.

The most capital and time-efficient way to kickstart those technologies is to sell enough direct process heat to create around one year worth of drilling demand. That kind of backlog would justify a long-term contract for a drilling contractor to build a new, larger rig and for motor companies to modify existing high-temperature motors for PDCs.

An evolutionary path like this doubles or triples the probability of the industry reaching a 10% electricity generation market share. It is confusing why people promote geothermal anywhere, only to beat their heads into brick walls trying to make electricity right from the start. Sell steam, young man!




Appendix A - Well Bore Heat Exchanger

Calculations are based off this paper. It contains more detailed explanations and figures. I haven't added electrical losses due to pumping yet. They are trivial at low velocities but become important if fluid rate is amped up to high rates like 100 m3/hr.

import math


Dw = .22 #m
Dc = Dw
Rw = Dw/2
Rc = Rw
Din = .18
flow_rate = 30 #m3/hr
thermal_cond_rock = 4 #W/mK
rock_density = 2600 #kg/m3
Cp_rock = 800 #j/kgK
thermal_cond_fluid = 0.67

GT = 25/1000 #25C/1000m
To = 25 # C
t = 3600*24*365*4 #time in seconds


annulus_area = 3.14*(Dw/2)**2 - 3.14*(Din/2)**2

velocity = flow_rate/3600/annulus_area

Re = 1000*velocity*Dw/1
Pr = 4186 * 1 / thermal_cond_fluid

h = (0.023 * thermal_cond_fluid * Re**0.8 * Pr**0.4)/(2*Rc)

As = thermal_cond_rock/(rock_density * Cp_rock)

one_over_Kt = Dc/(2 * thermal_cond_rock) * math.log(4 * (As * t)**0.5 / Dw) + 1/h

Kt = 1/one_over_Kt

# take initial conditions and get Qdown for each interval,
#changing the water temp to calculate the next interval
z = 0
Tfdown = 30
dZ = 1
feet = 32000
meters = (feet/3.28)

while z < meters:

    Twz = To + GT * z

    Q = 2 * 3.14 * Rw * Kt * ( Twz - Tfdown) * dZ

    mass = annulus_area * dZ * 1000

    Trise = Q/4184/mass/(velocity/dZ)

    Tfdown = Tfdown + Trise

    z += dZ

#rough efficiency approximation
efficiency = (0.05*Tfdown + 2)/100

print("Rock Tb", Twz)
print("Tbottom: ",Tfdown)
print("heat rate: ",(flow_rate/3.6)*4180*(Tfdown-30)/1000000, " MW")
print("efficiency: ",efficiency)
print("electricity rate: ",(flow_rate/3.6)*4180*(Tfdown-30)*efficiency/1000000, " MWe")

Appendix B - LCOE Calculations

These are a simplified version that doesn't include subsidies and uses discount rate instead of figuring loan interest.

#variables

capacity_mw = 25

capacity_factor = 0.9

yearly_generation_mwh = capacity_mw * 365 * 24 * capacity_factor

fuel_cost_per_mwh = 0

variable_operations_maintenance_cost_per_MWh = 15

fixed_operations_maintenance_cost_per_MW_per_year = 14000

economic_life = 30

CAPEX_total = 20000000

CAPEX_per_MW = CAPEX_total/capacity_mw

discount_rate = 0.05

#starting values
cumulative_discounted_cashflow = -CAPEX_total
electricity_price_MWh = 0

#calculate discounted cash flow

while cumulative_discounted_cashflow < 0:

  i = 0

  yearly_revenue = yearly_generation_mwh * electricity_price_MWh
  yearly_variable_costs = yearly_generation_mwh * (fuel_cost_per_mwh + variable_operations_maintenance_cost_per_MWh)
  yearly_fixed_costs = capacity_mw * fixed_operations_maintenance_cost_per_MW_per_year

  yearly_cashflow = yearly_revenue - yearly_variable_costs - yearly_fixed_costs

  while i < economic_life:

      discounted_yearly_cashflow = yearly_cashflow * (1-discount_rate)**i

      cumulative_discounted_cashflow = cumulative_discounted_cashflow + discounted_yearly_cashflow

      i += 1

  if cumulative_discounted_cashflow < 0:

      cumulative_discounted_cashflow = -CAPEX_total

  electricity_price_MWh += 1

print("cumulative discounted cash flow: ",cumulative_discounted_cashflow)
print("electricity price: $",electricity_price_MWh,"/MWh")