MRST - MATLAB Reservoir Simulation Toolbox

Starting from the 2011a release, MRST has been divided into core functionality and add-on modules, where the latter is defined as a set of functions and scripts that extend or modify the existing capabilities of MRST. A module may use all features of the core toolbox and may, optionally, depend on other modules.

To learn more about how to operate the module system, please consult the this page

Basic Functionality


Graphical interface for reservoir visualization

Graphical interfaces for interactive visualization of reservoir states and petrophysical data. The module includes additional routines for improved visualization (histograms, well data, etc) as well as a few utility functions that enable you to override some of MATLAB's settings to enable faster 3D visualization (rotation, etc).

In MRST: mrstModule add mrst-gui



Module containing all the scripts used for the examples, exercises, and figures in the book "An introduction to reservoir simulation using MATLAB" by Knut-Andreas Lie.

In MRST: mrstModule add book

More about the book


Discretization and Solvers


Incompressible flow

The module implements the basic fluid objects necessary to represent incompressible, two-phase flow. To solve these flow equations, the module offers a standard two-point flux-approximation (TPFA) method for pressure and explicit and implicit transport solvers using single-point upstream mobility weighting, which can be combined in sequential solution procedures. The incomp module was originally part of the core module, but was moved to a separate module once the software started offering solvers for more advanced fluid models.

In MRST: mrstModule add incomp



Fully implicit solvers with automatic differentiation

This ad-core module contains an object-oriented framework for simulating models of industry-standard complexity. The framework uses automatic differentiation to calculate Jacobians, which makes prototyping of new models faster. When combined with the ad-blackoil module, the framework offers a variety of black-oil type models for 2 and 3-phase, compressible flow, including dissolution and vaporization effects.

In MRST: mrstModule add ad-core ad-blackoil

Read more..


Sequential black-oil solvers

The blackoil-sequential module implements sequential solvers for the same set of equations that are implemented usign a fully-implicit discretization in ad-blackoil. The solvers are based on a fractional flow formulation wherein pressure and transport are solved as separate steps. These solvers can be significantly faster than those found in ad-blackoil for many problems, especially problems where the total velocity changes slowly during the simulation.

In MRST: mrstModule add blackoil-sequential


Mimetic finite difference (MFD) solvers

The standard two-point flux approximation method implemented in the incomp module is not consistent and hence not convergent unless the grid is K-orthogonal. The solver may therefore give significant grid-orientation errors for anisotropic permeabilities and skew grids. The module implements a family of mimetic finite difference (MFD) methods, which give consistent discretization for incompressible (Poisson-type) pressure equations.

In MRST: mrstModule add mimetic


Multipoint flux approximation (MPFA) solvers

The module implements the MPFA-O scheme, which is an example of a multipoint flux-approximation scheme that employs more degrees of freedom when constructing the discrete fluxes across cell interfaces; this to ensure a consistent discretization with reduced grid-orientation effects.

In MRST: mrstModule add mpfa


Adjoint formulations

This module implements strategies for production optimisation based on adjoint formulations. This enables for instance optimization of the net present value constrained by the bottom-hole pressure in wells.

In MRST: mrstModule add adjoint


Virtual element methods for geomechanics

This module offers functionality to set up solvers for linear elasticity problems on irregular grid, using the virtual element method (VEM), which is a generalization of finite-element methods that takes inspiration from modern mimetic finite-difference (MFD) methods.

In MRST: mrstModule add vemmech

Read more..


Multipoint stress approximation (MPSA)

3rd party

This module has been written by Eirik Keilegavlen and Jan M. Nordbotten (University of Bergen) and implements a discretization of poro-mechanics by cell-centered, finite-volume methods.

In MRST: mrstModule add fvbiot



Virtual element methods for incompressible flow

This module has been developed by Øystein Klemetsdal as part of his master thesis. Virtual element methods (VEM) constitute a unified framework for higher-order methods on general polygonal and polyhedral grids. The vem module can be used to solve general incompressible flow problems using first- and second-order VEM, with the possibility to choose different inner products.

In MRST: mrstModule add vem



Multiscale Methods


Multiscale finite-volume (MsFV) methods

The module implements the operator formulation of the multiscale finite-volume (MsFV) method on structured and unstructured grids in 3D. The key idea is to introduce a set of prolongation operators, defined by solving flow problems localized to dual coarse blocks. The prolongation operators are then used to define a reduced flow problem on the coarse primal grid and map unknowns computed on this grid back to the underlying fine grid. The resulting method can either be used as an approximate solver or as a global preconditioner in an iterative solver. The module is not actively developed and is offered mostly for historic reasons. Users interested in applying multiscale methods should look at the MsRSB module instead.

In MRST: mrstModule add msfvm

Read more..

MsMFE applied to a corner-point grid  

Multiscale mixed finite-element (MsMFE) methods

The module implementes the multiscale mixed finite-element (MsMFE) method on unstructured grids in 3D. The idea is the same as for the MsFV method, except that one here uses a mixed formulation in which the multiscale basis functions (prolongation operators) are associated with coarse faces rather than blocks. The method is a good approximative solver, and a robust and accurate alternative to upscaling, for incompressible flow problems. MRST was originally developed for the sole purpose of supporting the research on MsMFE methods. For several years, this module has not been actively developed.

In MRST: mrstModule add msmfem

Read more..


Multiscale restricted-smoothing basis (MsRSB) methods

The Multiscale Restricted-Smoothing Basis (MsRSB) method is the current state-of-the-art within multiscale methods. MsRSB is very robust and versatile can either be used as an approximate coarse-scale solver having mass-conservative subscale resolution, or as an iterative fine-scale solver that will provide mass-conservative solutions for any given tolerance. The performance of the method has been demonstrated on incompressible 2-phase flow, compressible 2 and 3-phase black oil models, as well as compositional models. It has also been demonstrated that the method can utilize combinations of multiple prolongation operators, e.g., corresponding to coarse grids with different resolutions, adapting to geological features, adapting to wells, or moving displacement fronts. At the moment, only parts of this functionality is available in the public version of the module.

In MRST: mrstModule add msrsb

Read more..


Special Simulation Models


Enhanced oil recovery (EOR)

This module builds on top of the object-oriented, automatic-differentiation framework from the ad-core and ad-blackoil modules, and defines model equations and provides simulation tools for water-based enhanced oil recovery techniques (polymer and surfactant injection).

In MRST: mrstModule add ad-eor

Read more.


Discrete fracture matrix (DFM)

3rd party

This module, developed by Tor Harald Sandve (IRIS / University of Bergen), implements control-volume methods for soliving flow in fractured media using a discrete fracture matrix approach in which the fractures are represented as lower-dimensional objects. 

In MRST: mrstModule add dfm



Hierarchical fracture models

3rd party

This module has been developed by Swej Shah from Delft University of Technology in collaboration with researchers at SINTEF. The module utilises a hierarchical fracture modelling (HFM) framework to simulate multiphase flow in naturally fractured reservoirs with multiple length scales.

This module requires MATLAB R2015a (8.5) or later.

In MRST: mrstModule add hfm



Workflow Tools


Flow diagnostics

Flow diagnostics tools are run to establish connections and basic volume estimates, and quickly provide a qualitative picture of the flow patterns in the reservoir. These methods offer a computationally inexpensive alternative to multiphase simulations to rank, compare, and validate reservoir models, upscaling procedures, and production scenarios. The flow diagnostics module contains utilities for computing time-of-flight, tracer partitioning, and measures of dynamic heterogeneity, which in turn can be used to compute well-allocation factors, drainage/sweep regions, simple estimates of recovery and net-present-value, etc.

In MRST: mrstModule add diagnostics

Read more..


Grid coarsening

The coarsegrid module contains extended functionality for defining coarse grids formed as a partition of an underlying fine grid. Such grids form a key part in upscaling and multiscale methods, but act almost like any standard MRST grid and can hence be passed to most of the solvers from other modules. Coarse grid generated from a partition are also useful for visualization purposes.

In MRST: mrstModule add coarsegrid



Unstructured PEBI-grids adapting to geological features

3rd party

This module had been developped by Runar Lie Berge as part of his Master Thesis and consists of a set of routines for creating Voronoi grids that adapt to cell-based and face-based constraints. Primary examples are wellpaths and fractures/faults.

This module requires MATLAB R2015a (8.5) or later.

In MRST: mrstModule add upr



Coarsening by amalgamation

The module contains a set of tools and tutorials for constructiong coarse grid based upon amalgamation of cells from a fine-scale model. Primary examples are coarse grids that adapt to geological features such as flow units, deposition environment, and various types of regions (facies, stone types, initialization regions, etc). Likewise, using an amalgamation process that consists of a sequence of merging and splitting operations, one can generated flow-adapted grids based on an indicator like flux magnitude, time-of-flight, etc

In MRST: mrstModule add agglom

Read more..


Flow-based upscaling

The module includes methods for flow-based upscaling of both permeabilities and transmissibilities on general grids, as well as a few tutorials demonstrating how to implement simple averaging methods.

In MRST: mrstModule add upscaling

Read more..


Steady-state upscaling

Functionality for upscaling relative permeabilities based on a steady-state assumption. This includes general steady state, as well as capillary and viscous-dominated limits. The functionality is demonstrated through a few tutorial examples.

In MRST: mrstModule add steady-state


Numerical CO2 laboratory

This module combines results of more than one decade of academic research and development on CO2 storage modeling into a unified toolchain that is easy and intuitive to use. The module is geared towards the study of long-term trapping in large-scale saline aquifers and offers computational methods and graphical user interfaces that enable you to visualize migration paths and compute upper theoretical bounds on structural, residual, and solubility trapping. The module also offers efficient simulators based on a vertical-equilibrium formulation that can be used to analyse pressure build-up and plume migration and compute detailed trapping inventories for realistic storage scenarios. Last but not least, the module provides simplified access to publicly available datasets, e.g., from the Norwegian CO2 Storage Atlas.

In MRST: mrstModule add co2lab

Read more..


Dual-porosity simulation

3rd party

This module has been developed by the Carbonate Reservoir Group at Heriot Watt university. The module provides AD-based models and utility functions for simulation of fractured reservoirs with dual-porosity behaviour.

In MRST: mrstModule add dual-porosity



The optimization module contains routines for solving optimal control problems with (forward and adjoint) solvers based on the automatic differentiation framework found in ad-core and ad-blackoil. The module contains a quasi-Newton optimization routine using BFGS-updated Hessians, but can easily be set up to use any (non-MRST) optimization code.

In MRST: mrstModule add optimization


Ensemble Kalman filter module

3rd party

This module is developed by Olwijn Leeuwenburgh (TNO) and includes both EnKF AND EnRML schemes, localization, inflation, asynchronous data, and allows for both production and seismic (saturation) data. Both conventional and structural parameters can be updated.


In MRST: download link


REMSO - REservoir Multiple Shooting Optimizer

3rd party

REMSO is an optimization module based on multiple shooting, developed by Andres Codas (NTNU). It allows for great flexibility in the handling of non-linear constraints in reservoir management optimization problems.

Read more and download...
Slide presentation



Input deck in the Eclipse format  

Deck reader

The module contains support for input of complete simulation decks in the ECLIPSE format, including input reading, conversion to SI units, and construction of MRST objects for grids, fluids, rock properties, and wells. Functionality from this module is thus essential for the fully implicit simulators developed in the ad-blackoil and ad-eor modules, but is also used in a large number of MRST's examples and tutorials.

In MRST: mrstModule add deckformat

Read more..


Automatic differentiation setup of physical properties

Functionality related to property calculations for the ad-core framework. Specifically, the module implements a variety of test fluids and functions that are used to create fluids from external datasets. This module is used as part of almost all simulators in MRST studying compressible equations of black-oil or compositional type.

In MRST: mrstModule add ad-props


C-accelerated geometrical computations

Many of the routines in MRST rely on detailed geometric information about the grids including cell volumes and centroids, face areas and normals, etc. Computing this information efficiently in MATLAB is not an easy task and for very large and complex grids, the builtin functionality from the core module can be too slow. The current module therefore offers C-accelerated computation of geometric grid properties (cell centroids and volumes and face centroids, areas, and normal vectors).

In MRST: mrstModule add libgeometry


SPE 10, Model 2

Model 2 from the 10th SPE Comparative Solution Project has developed into a standard test case used by a large number of researchers. The spe10 module contains tools for downloading, converting, and loading the data into MRST. The module also features utility routines for extracting parts of the model, as well as a script that sets up a (crude) simulation of the full model (using the AGMG multigrid solver).

In MRST: mrstModule add spe10


Curvilinear wells

Functionality for defining wells following curvilinear trajectories.

In MRST: mrstModule add wellpaths



The module implementes Pollock's method for tracing of streamlines on Cartesian and curvilinear grids based on a set of input fluxes, as computed by the incompressible flow solvers in MRST (i.e., from the incomp, mimetic, or mpfa module).

In MRST: mrstModule add streamlines


OPM gridprocessing

The core module of MRST contains functionality for reading and processing the GRID section of ECLIPSE input data, which contains information about the reservoir geometry (grid) and the petrophysical properties (permability, porosity, net-to-gross, etc). Although generally efficient, the builtin function can be slow for large models. To accelerate the processing of large models, this module offers access to grid-processing routines written in C for the Open Porous Media (OPM) initiative, which generally can be seen as the C/C++ siebling of MRST.

In MRST: mrstModule add opm_gridprocessing



Triangle is a two-dimensional quality mesh generator and Delaunay triangulator developed by Jonathan Richard Shewchuk. This module provides a MATLAB interface to Triangle so that it can be used to generate grids for MRST.

In MRST: mrstModule add triangle



This module contains extensions of MRST written in compiled languages, such as more computationally efficient geometry calculations as well as an API for MRST.

In MRST: mrstModule add mex

Published March 7, 2011