The instructions provided on this page has been completely updated and rewritten on September 24th 2015. It was long, long overdue - but better late than never.
A complete shift away from hand made Makefiles and VisualStudio at different versions has been achieved by moving to CMake. A version higher than 2.8 is required.
The new instructions assumes that the user has a version newer than 4.2 of NetCDF installed corresponding to the Fortran compiler intended to compile GOTM. Getting NetCDF to work with the Fortran compiler has been the single most problematic issue for users over the years. Requiering a newer version hopefully will reduce the problems.
For Windows users: Until the Fortran interface to NetCDF builds without any problems on Windows the GOTM distribtion provides the necessary libraries.
For Linux/Unix/Mac the helper script nf-config MUST be in the path (try by opening a terminal and type 'nf-config --all' which should list include and link information). If this step fails there is no need to proceed as it will not be possible to compile GOTM until it has been sorted out.)
CMake can be executed in both GUI mode and from the command line (or from a script). For a description of using the GUI on Windows have a look here and search for "Intel Visual Fortran and Visual Studio". This site also give a general description of the operation of CMake.
Below is provided 3 small scrips that makes keeping the code in sync, configuring and compiling GOTM very easy. Two environment variables are used to locate the GOTM and FABM source code (FABM is mandatory if the new flexible output system is to be used). The configure and build scripts must be copied to a build directory - like ~/build/gotm or /scratch/build/gotm - and executed from here.
To use e.g. the gfortran compiler instead of ifort simply set compiler=gfortran.
Script to keep source code updated
echo -n "GOTM: "
echo -n "FABM: "
Script to configure GOTM
# if not set in the environment point to the code here
mkdir -p $compiler
cmake $GOTM_BASE/src \
Script to compile GOTM
if [ "$1" != "" ]; then
echo "doing a "$action
make $np $action
When the compilation succeeds the executable is copied to the CMAKE_INSTALL_PREFIX/bin directory. In order to actuall run the model either add this directory to $PATH - or make a link from CMAKE_INSTALL_PREFIX/bin/gotm to e.g. ~/bin/gotm.