Introduction
In the realm of renewable energy, deep geothermal systems represent a promising but challenging frontier. Telura's recent funding and technology developments highlight the potential for making deep geothermal energy economically viable on a global scale. This tutorial will guide you through creating a basic simulation of geothermal heat transfer models using Python, which is foundational to understanding how systems like Telura's might work. We'll build a heat conduction model that simulates temperature distribution in geological layers, a core component of geothermal energy extraction planning.
Prerequisites
- Basic understanding of Python programming
- Python 3.x installed on your system
- NumPy and Matplotlib libraries (install with
pip install numpy matplotlib) - Basic knowledge of heat transfer concepts and differential equations
Step-by-Step Instructions
1. Set Up Your Python Environment
Before we begin coding, ensure you have the necessary libraries installed. Open your terminal or command prompt and run:
pip install numpy matplotlib
This step is crucial because NumPy provides mathematical functions for handling arrays and matrices, while Matplotlib will help visualize our geothermal models.
2. Import Required Libraries
Start by importing the necessary modules in your Python script:
import numpy as np
import matplotlib.pyplot as plt
We're importing NumPy for numerical computations and Matplotlib for creating visualizations of our heat transfer models.
3. Define Geothermal Parameters
Next, we'll define the parameters that characterize our geothermal system:
# Geothermal parameters
thermal_conductivity = 2.5 # W/m.K
heat_generation_rate = 0.03 # W/m³
temperature_surface = 15 # °C
temperature_core = 1000 # °C
depth = 10000 # meters
# Model parameters
num_layers = 100
layer_thickness = depth / num_layers
These parameters represent typical values for deep geothermal systems. The thermal conductivity indicates how well heat flows through rock, while heat generation rate represents the internal heat production. The surface and core temperatures establish our boundary conditions.
4. Create the Heat Conduction Model
Now we'll implement a simplified heat conduction equation in one dimension:
# Create depth array
depth_array = np.linspace(0, depth, num_layers)
# Initialize temperature array
temperature = np.zeros(num_layers)
# Boundary conditions
temperature[0] = temperature_surface # Surface temperature
temperature[-1] = temperature_core # Core temperature
# Simple finite difference method for heat conduction
for i in range(1, num_layers-1):
# Simplified heat equation: d²T/dx² = -q/k
# Using finite differences
temperature[i] = temperature[i-1] + (heat_generation_rate * layer_thickness**2) / (2 * thermal_conductivity)
# Apply boundary conditions
temperature[0] = temperature_surface
temperature[-1] = temperature_core
This code implements a basic finite difference approach to solve the heat conduction equation. It calculates temperature distribution from surface to core, considering heat generation within the rock.
5. Visualize the Temperature Profile
Let's create a visualization of our geothermal temperature profile:
# Plot temperature vs depth
plt.figure(figsize=(10, 6))
plt.plot(temperature, depth_array, 'b-', linewidth=2)
plt.xlabel('Temperature (°C)')
plt.ylabel('Depth (m)')
plt.title('Geothermal Temperature Profile')
plt.grid(True)
plt.gca().invert_yaxis()
plt.show()
This visualization shows how temperature increases with depth, which is fundamental to understanding geothermal energy potential.
6. Add Advanced Features
For a more realistic model, let's add variable thermal conductivity:
# Variable thermal conductivity model
thermal_conductivity_profile = np.linspace(1.5, 3.5, num_layers)
# Recalculate with variable conductivity
temperature_variable = np.zeros(num_layers)
temperature_variable[0] = temperature_surface
for i in range(1, num_layers-1):
# More complex heat equation with variable conductivity
k_avg = (thermal_conductivity_profile[i-1] + thermal_conductivity_profile[i]) / 2
temperature_variable[i] = temperature_variable[i-1] + (heat_generation_rate * layer_thickness**2) / (2 * k_avg)
# Plot both models for comparison
plt.figure(figsize=(12, 8))
plt.subplot(2, 1, 1)
plt.plot(temperature, depth_array, 'b-', linewidth=2, label='Constant conductivity')
plt.plot(temperature_variable, depth_array, 'r--', linewidth=2, label='Variable conductivity')
plt.xlabel('Temperature (°C)')
plt.ylabel('Depth (m)')
plt.title('Comparison of Geothermal Models')
plt.legend()
plt.grid(True)
plt.gca().invert_yaxis()
# Plot thermal conductivity profile
plt.subplot(2, 1, 2)
plt.plot(thermal_conductivity_profile, depth_array, 'g-', linewidth=2)
plt.xlabel('Thermal Conductivity (W/m.K)')
plt.ylabel('Depth (m)')
plt.title('Thermal Conductivity Profile')
plt.grid(True)
plt.gca().invert_yaxis()
plt.tight_layout()
plt.show()
This enhanced model demonstrates how varying thermal conductivity affects heat transfer, which is crucial for understanding real-world geothermal systems.
7. Analyze Energy Extraction Potential
Finally, let's calculate the potential energy extraction:
# Calculate heat flux at different depths
heat_flux = -thermal_conductivity * np.gradient(temperature, depth_array)
# Calculate potential energy output
# Assume 1000 m³ of rock is heated per day
rock_volume = 1000 # m³
current_temperature = np.mean(temperature)
energy_output = rock_volume * 1000 * (current_temperature - temperature_surface) # kJ/day
print(f'Average temperature: {current_temperature:.1f}°C')
print(f'Estimated energy output: {energy_output:.0f} kJ/day')
print(f'Energy output in kWh: {energy_output/3600:.1f} kWh')
# Plot heat flux
plt.figure(figsize=(10, 6))
plt.plot(heat_flux, depth_array, 'purple', linewidth=2)
plt.xlabel('Heat Flux (W/m²)')
plt.ylabel('Depth (m)')
plt.title('Heat Flux Distribution')
plt.grid(True)
plt.gca().invert_yaxis()
plt.show()
This analysis helps quantify the energy potential of our simulated geothermal system, showing how the model can inform real-world energy extraction decisions.
Summary
This tutorial provided a practical introduction to geothermal heat transfer modeling using Python. By building a simulation of temperature distribution in geological layers, we've learned how to model the fundamental physics behind deep geothermal energy systems. The code demonstrates core concepts that underlie technologies like those developed by Telura, including heat conduction, boundary conditions, and energy extraction potential calculations. While this is a simplified model, it forms the foundation for more complex simulations that could help make deep geothermal energy economically viable across different geological settings.



