1. Check to see whether or not you have netCDF installed on your system.
Here we use netCDF version 3.6.1 with f90 and c++ compilers.
(/opt/ibmcmp/xlf/8.1/bin/f90 and /usr/bin/c++)
If you don't have netCDF, grab it from:
In some cases, you may have trouble compiling GOTM:
for example: "/usr/bin/ld: archive: libnetcdf.a has no table of contents"
To solve this you may have to run "ranlib -s libnetcdf.a"
2. Download/extract GOTM source code (here we use version 3.2.4)
3. Download/extract test case
4. Setup environment:
4.1 GOTM main path, GOTM test cases: for example
setenv GOTMDIR /GOTM/gotm-3.2.4
setenv GOTM_CASES "$GOTMDIR"/gotm-cases/v3.2
4.3 Choose compiler to compile
setenv FORTRAN_COMPILER XLF
Make sure that "/compiler/compiler.XLF" uses the same compiler you used
when you installed netCDF. Here we changed "FC=xlf90_r" to "FC=f90"
and we also commented out the option "-q32" in "EXTRAS" flag.
5. Go to directory "src" and run "make". This will compile "F90" file within
the dependent directories. This will create executable file "gotm_prod_XLF".
NB1: Here we got an error about archive all library being created within directory
"lib/XLF". There are two ways around this problem:
5.1 After running "make" and getting the error, run "ranlib -s" followed by library
file (.a) within that path. Then run "make" again.
5.2 make a change in the makefile to do this automatically when running "make"
Here is how:
5.2.1 Edit "Makefile" under src directory
Add the following line to indicate which directory we gonna do "ranlib" to
the line before "all: ../VERSION $(EXEC)"
LIB_TR = ../lib/$(FORTRAN_COMPILER)
5.2.2 In the section "$(EXEC): makedirs subdirs features gotmlib"
add these lines to do ranlib to the line before line
"$(FC) -o $@ ./gotm/main.o $(LDFLAGS) -lgotm$(buildtype) $(ALL_LIBS)"
6. Go to gotm-cases directory, make a link of the executable file to this path.
For exaple: ln -s /GOTM/gotm-3.2.4/src/gotm_prod_XLF GOTMx
In order to execute, make sure you have (*.inp) input file under the working
NB3: There may be problem in reading "namelist" (namlis). To work around this problem,
do the following:
6.1 setenv XLFRTEOPTS namelist=old
6.2 Change all namelist in ".inp" files. Change "&"variable to "$"variable
and "/" to "$end". Make sure these two statements start in column 2 and not 1.
for example: File "gotmrun.inp"
** CHANGE LINE: &model_setup CHANGE TO $model_setup
title= "couette flow",
** CHANGE LINE: / CHANGE TO $end
There may be other ways to go around this problem. Any suggestions are welcome.