Reservoir simulation in Julia
JutulDarcy.jl: Darcy-scale and subsurface flow (CO2 sequestration, gas/H2 storage, oil/gas fields) using Jutul.jl developed by the Computational Geosciences group at SINTEF Digital.
Key features
- Written in pure Julia, with automatic differentiation and dynamic sparsity detection
- Support for sensitivities with respect to any model parameters using the adjoint method
- High performance assembly and linear solvers, with support for two-stage CPR BILU(0)-CPR Krylov solvers
- Equation-of-state compositional, immiscible and black oil flow is supported and validated against existing simulators
- Unstructured grids and complex cases input from the Matlab Reservoir Simulation Toolbox (MRST) using the
jutul
module. - Support for general multisegment wells with rigorous mass balance, complex well limits and time-dependent controls
- 3D visualization of grids and wells in JutulViz.jl
- Interactive plotting of well curves
The compositional simulator has been matched against commercial offerings, AD-GPRS and MRST. The blackoil simulator has been validated on the standard SPE benchmarks (SPE1, SPE9, ...).
Example run times on benchmarks
Name | Cells | Report steps | Preconditioner | Time [s] |
---|---|---|---|---|
SPE1CASE2 | 300 | 120 | block-ILU(0) | 0.30 |
SPE9 | 9000 | 35 | block-ILU(0) | 3.41 |
Egg | 18553 | 123 | CPR-block-ILU(0) | 8.60 |
Simulated with julia -O2
, no threads.
A few of the packages used by Jutul and JutulDarcy
Jutul builds upon many of the excellent packages in the Julia ecosystem. Here are a few of them, and what they are used for:
- ForwardDiff.jl implements the Dual number class used throughout the code
- SparsityTracing.jl provides sparsity detection inside Jutul
- Krylov.jl provides the iterative linear solvers
- ILUZero.jl for ILU(0) preconditioners
- AlgebraicMultigrid.jl for AMG preconditioners
- Tullio.jl for automatically optimized loops and Polyester.jl for lightweight threads
- TimerOutputs.jl and ProgressMeter.jl gives nice output to terminal
- Makie.jl is used for the visualization features found in JutulViz.jl
- MultiComponentFlash.jl provides many of the compositional features
...and many more, both directly in the Project.toml file and indirectly!
Getting started
Install Julia and add the package to your environment of choice:
using Pkg
Pkg.add("Jutul")
Pkg.add("JutulDarcy")
Pkg.add("CairoMakie")
You can then run any of the examples in the examples
directory by including them.
Additional examples and further reading
The documentation is still work in progress, but contains a fair bit of useful information. In addition, see the examples folder for more information. Some functionality is also demonstrated in the tests. There are also examples in JutulExamples that may occasionally be a bit out of date.
Internals and undocumented functions are subject to change at this time. However, the main interface for the reservoir simulator itself seen in the examples should be fairly stable.