GeothermalWells.jl is a Julia package for simulating deep borehole heat exchangers (DBHEs), supporting both single wells and well arrays. The package is designed to be easy to use, enabling rapid prototyping and well design exploration, while providing GPU-accelerated performance for long-term simulations.
Note: This package is currently under active development and there may be breaking changes.
GeothermalWells.jl works with Julia v1.12 and newer. Install it from the Julia REPL:
julia> using Pkg
julia> Pkg.add("GeothermalWells")using GeothermalWells
using OrdinaryDiffEqStabilizedRK: ODEProblem, solve, ROCK2
using KernelAbstractions: CPU
# Set up material properties and borehole geometry
materials = HomogenousMaterialProperties{Float64}(...)
borehole = Borehole{Float64}(...)
# Create adaptive grids
gridx = create_adaptive_grid_1d(...)
gridy = create_adaptive_grid_1d(...)
gridz = create_uniform_gridz_with_borehole_depths(...)
# Initial temperature field with geothermal gradient
T0 = initial_condition_thermal_gradient(backend, Float64, gridx, gridy, gridz;
T_surface=2.29, gradient=0.035)
# Create simulation and solve
cache = create_cache(backend=CPU(), gridx=gridx, gridy=gridy, gridz=gridz,
materials=materials, boreholes=(borehole,), inlet_model=ConstantInlet{Float64}(20.0))
prob = ODEProblem(rhs_diffusion_z!, T0, (0.0, 3600.0), cache)
callback, saved_values = get_simulation_callback(...)
solve(prob, ROCK2(), dt=60.0, callback=callback)See the examples/ folder for complete working examples.
For more details, see the documentation.
If you use GeothermalWells.jl in your research, please cite the software and the accompanying paper:
@software{wittenstein2026geothermalwells,
title={{GeothermalWells.jl}: {GPU}-accelerated simulation of deep borehole heat exchanger (DBHE) arrays},
author={Wittenstein, Collin},
year={2026},
howpublished={\url{https://github.com/cwittens/GeothermalWells.jl}},
doi = {10.5281/zenodo.18405325}
}@inproceedings{wittenstein2026dbhe,
title={A Full Three-Dimensional {GPU}-Accelerated Model for Deep Borehole Heat Exchangers ({DBHEs}) Enabling Simulation of Well Arrays},
author={Wittenstein, Collin and Lujan, Emmanuel and Inglis, Andrew and Metcalfe, Robert and Edelman, Alan and Ranocha, Hendrik},
booktitle={Proceedings, 51st Workshop on Geothermal Reservoir Engineering},
year={2026},
organization={Stanford University},
address={Stanford, CA},
url={https://pangea.stanford.edu/ERE/db/GeoConf/papers/SGW/2026/Wittenstein.pdf}
}- Collin Wittenstein (Massachusetts Institute of Technology & Johannes Gutenberg University Mainz)
GeothermalWells.jl is licensed under the MIT license (see LICENSE). Contributions are welcome - please see CONTRIBUTING.md for guidelines.