Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
This is the Transport Matrix Method (TMM) code repository. It includes both 
the core TMM time-stepping driver code (under driver/), as well as various 
biogeochemical models (under models/) adapted to the TMM framework. The driver 
code and interface to models are written using the PETSc framework 
( but you don't need this code to use the TMM. 
Simply skip to step (3) below. Otherwise keep reading and if you have any 
questions feel free to email: Samar Khatiwala <>

How to cite: If you use the TMM, please cite Khatiwala et al. (2005; 
and Khatiwala (2007; If you use any of my transport matrices or related 
data please cite this GitHub page as the source, as well as Khatiwala (2007) and the relevant papers listed here: Furthermore, if you use this code please 
also cite Khatiwala (2018; Thank you!

IMPORTANT: Please do NOT post the TMM code or any data files downloaded from this or related 
websites on your own github or other website. You do NOT have permission to do so.


For a quick overview of the TMM and the PETSc driver also have a look at this excellent 
presentation by Iris Kriest:

Quick-start instructions:

1) Install PETSc ( and set the PETSC_DIR and PETSC_ARCH 
environment variables. The TMM driver code is compatible with PETSc version 3.16.x 
(as of Jan 20, 2022). For the older version of the TMM code compatible with PETSc 3.6.x, 
you can checkout branch petsc3.6.

2) Download Matlab scripts and add to your Matlab path:

3) Download transport matrices and related data for the ocean model of your 
Currently, there are 3 configurations of MITgcm available online (and several 
others based on the UVic Earth System Model that I am happy to make available). 
For each, download the TMs and other associated data (e.g., MITgcm_ECCO.tar). 
Unpack. Make a note of the path to this directory (e.g., /mydisk/somewhere/MITgcm_ECCO). 
We will need it later. For some experiments you may also find it useful to download 
some miscellaneous data here (and adjust paths accordingly in the provided Matlab scripts):

4) Make a local directory and checkout the TMM driver and model codes:
cd $HOME
mkdir TMM
cd TMM/
git clone

Set the environment variable TMMROOT to point to the top level of the TMM directory.

5) For each model, e.g., $TMMROOT/models/current/mops2.0/ there is model-specific code (in src/); 
Matlab script(s) in matlab/ to generate input data (e.g., make_input_files_for_mops_model.m) and 
read model output (e.g., load_output.m); and run scripts and other runtime data such as 
namelists in runscripts/. 

To try out one of these models, make a directory, e.g., Test/, and copy the following to it:

cp -p $TMMROOT/models/current/mops2.0/src/Makefile .

(If there is a file *_TMM_OPTIONS.h in src/ copy that as well, e.g.,
cp -p $TMMROOT/models/current/mobi2.0/src/MOBI_TMM_OPTIONS.h .
Edit this file to set compile-time C/Fortran preprocessor options.)

Compile the code:
(For some models you may have to first set additional environment variables as described 
in the corresponding Makefile.)

make mops

Copy the matlab and run scripts:

cp -p -R $TMMROOT/models/current/mops2.0/matlab/* .
cp -p $TMMROOT/models/current/mops2.0/runscripts/* .

Change the variable base_path at the very top of the make_input*.m and load_output*.m scripts 
to point to the top level of any of the transport matrix configurations you downloaded in #3 
above. Execute the make_input* script (e.g., make_input_files_for_mops_model.m). It should 
generate all necessary input data. With luck! (If there is missing data email me for it.)

Execute model using the example run scripts.

Load output using the example load_output.m script.