Department Surface Waters - Research and Management


Modeling Early DIAgenesis in sediments using MATLAB

Model Description

MEDIALAB (Modeling Early DIAgenesis using MATLAB) is an early diagenesis model, which calculates concentrations and fluxes of chemical species as well as rates of all the biogeochemical pathways in aquatic sediments. Included transport processes are sedimentation, molecular diffusion, bioturbation and bioirrigation. Biogeochemical transformations consist of organic matter degradation through a spectrum of electron acceptors, secondary reactions, sorption reactions, acid-base reactions as well as dissolution and precipitation reactions.

The major feature of MEDIALAB is the automatic generation of early diagenesis equations using MATLAB’s symbolic programming capabilities. The execution of MEDIALAB requires an active installation of MATLAB (Version 7.6 release R2008a or later). The stoichiometric matrix, as well as reaction, transport and boundary condition functions are automatically computed and passed to the PDE solver. By avoiding the hurdles of rewriting and compilation of source codes, the user can focus on the definition, performance and application of the model.

Another advantage of MEDIALAB is that it gives the user the possibility to include transient boundary conditions in a straightforward way. The transient fluxes or concentrations of species can be imposed through time-dependent mathematical functions or field data. This is particularly useful when simulating the fate of compounds whose inputs are changing due to, for example, anthropogenic activity, or when dealing with systems where the bottom water chemistry varies over time.

Model history

MEDIALAB is based on the model MATsedLAB, which had been created by B. Shafei as part of his Ph.D. thesis project at the Georgia Institute of Technology under the supervision of P. Van Cappellen (Shafei, 2012). The model was successfully applied to simulate arsenic diagenesis in sediments of Lake Tantare in Canada (Couture et al. 2010, Shafei et al. 2010), acid mine drainage contamination of Sancho reservoir in Spain (Torres et al. 2014), and non-steady state modeling of a major flood event in the Rhone prodelta (Pastor et al. 2011). Despite the success of the model in tackling various early diagenesis problems, the flexibility of MATsedLAB was limited, as the user had to manually compute all components of the PDE and pass them to PDE solver. Thus, adding or removing species and reactions could be a tedious task and required a rigorous modification of the equations. MEDIALAB provides a full flexibility of defining and modifying the set of equations. Furthermore, MEDIALAB includes the transport of solutes through the diffusive boundary layer at the sediment-water interface as an additional process in the transport equation. MEDIALAB has been applied to simulate early diagenesis in a lake with variable boundary conditions by Steinsberger et al. (2019).


  • Couture R-M, Shafei B, Van Cappellen P, Tessier A, Gobeil C (2010). Non-steady state modeling of arsenic diagenesis in lake sediments.  Environmental Science and Technology 2010 (44) 197-203,
  • Pastor L, Deflandre B, Shafei B, Couture RM, Cathalot C, Metzger E, Van Cappellen P, Viollier E (2011). Non-steady state modeling of early diagenetic processes following a major flood event in the Rhône prodelta (NW Mediterranean Sea, France)Gordon Research 1-Conference. Chemical Oceanography.
  • Torres E, Couture RM, Shafei B, Canovas CR, Van Cappellen P, Ayora C (2011). Sediment Diagenesis Modelling in an AMD Contaminated Reservoir. Macla 15: 191-192
  • Shafei B (2012). Reactive transport in natural porous media: Contaminant sorption and pore-scale heterogeneity, PhD thesis, Georgia Institute of Technology.
  • Shafei B, Couture RM, Van Cappellen P (2010). Arsenic sorption in aquatic sediments: Equilibrium, kinetic and mixed modeling approaches. Geochimica Cosmochimica Acta 74: Supplement 938.
  • Steinsberger T, Müller B, Gerber C, Shafei B, Schmid M (2019). Modeling sediment oxygen demand in a highly productive lake under various trophic scenarios. PLoS ONE 14(10): e0222318.