To main content

MRST-AD: an open-source framework for rapid prototyping and evaluation of reservoir simulation problems


We present MRST–AD, a free, open-source framework written as part of the Matlab Reservoir Simulation
Toolbox and designed to provide researchers with the means for rapid prototyping and experimentation
for problems in reservoir simulation. The article outlines the design principles and programming
techniques used and explains in detail the implementation of a full-featured, industry-standard black-oil
model on unstructured grids. The resulting simulator has been thoroughly validated against a leading
commercial simulator on benchmarks from the SPE Comparative Solution Projects, as well as on a
real-field model (Voador, Brazil). We also show in detail how practitioners can easily extend the black-oil
model with new constitutive relationships, or additional features such as polymer flooding, thermal and
reactive effects, and immediately benefit from existing functionality such as constrained-pressure-residual
(CPR) type preconditioning, sensitivities and adjoint-based gradients.
Technically, MRST–AD combines three key features: (i) a highly vectorized scripting language that
enables the user to work with high-level mathematical objects and continue to develop a program while
it runs; (ii) a flexible grid structure that enables simple construction of discrete differential operators; and
(iii) automatic differentiation that ensures that no analytical derivatives have to be programmed explicitly
as long as the discrete flow equations and constitutive relationships are implemented as a sequence of
algebraic operations. We have implemented a modular, efficient framework for implementing and
comparing different physical models, discretizations, and solution strategies by combining imperative and
object-oriented paradigms with functional programming. The toolbox also offers additional features such
as upscaling and grid coarsening, consistent discretizations, multiscale solvers, flow diagnostics and
interactive visualization.


Academic chapter/article/Conference paper




  • SINTEF Digital / Mathematics and Cybernetics




Society of Petroleum Engineers


SPE Reservoir Simulation Symposium, 23-25 February 2015, Houston, Texas, USA




2080 - 2105

View this publication at Cristin