Diva installation


(Difference between revisions)
Jump to: navigation, search
(Edit configuration file for compilation)
(Check configuration log)
Line 63: Line 63:
  Binaries are located in directory:
  Binaries are located in directory:
=== Windows ===
=== Windows ===

Revision as of 20:41, 5 November 2013


How to install?

Chose a place where you want to work with the new version (if you already have a running installation, it is advised to install the new version at another location and replace the old one only when everything has been set up correctly with the new version).

  • Download the archive, here as an example for version 4.6.2:
wget http://modb.oce.ulg.ac.be/mediawiki/upload/DIVA/releases/diva-4.6.2.tar.gz
  • Extract the files from the archive:
tar -xvf diva-4.6.2.tar.gz


Diva can be compiled with different operating systems. The preferred one is Linux, as installing on windows is more tedious. The procedures are detailed below. If you already have a running Diva installation, install the new version at a new place and look at the compiler options you have used in the past in the corresponing divacompile_options


The minimal requirements are:

  • A Fortran 90 compiler with -cpp possibilities (easily installed through a package manager)
  • The NetCDF library (instructions for installation here)

Edit configuration file for compilation

  • Go in the source directory
cd diva-4.6.2/DIVA3D/src/Fortran/
  • Edit the file divacompile_options according to your installation.

For versions < 4.6.0: compiler name and flags as well as NetCDF library location have to be indicated Example:

# Name of the fortran compiler (ex: ifort,gfortran,pgi,...)
# Compilation flags
# Netcdf library

If your installation knows the nc-config or nf-config command, you can use

nclib=`nc-config --flibs`

For versions >= 4.6.0: the compilations script automatically detects the compiler, flags and NetCDF library using nc-config or nf-config tools. This possibility is normally detected automatically but if there are problems with the Netcdf library you might look into these definitions.

Run the compilation script


Check configuration log

Information related to the compilation is contained in file compilation.log.
Check that all the programs were compiled.

Compilation time:  jue ago 8 15:04:46 CEST 2013
compiler:          gfortran
compilation flags: -O3 -cpp -DDIVAITERATIVE
Calc directory:       1/1   program compiled
Extensions directory: 13/13 programs compiled
Mesh directory:       9/9   programs compiled
NC directory:         3/3   programs compiled
PlPlot directory:     1/1   programs compiled
Util directory:       41/41 programs compiled
Pipetest directory:   1/1   program compiled
Stabil directory:     28/28 programs compiled
TOTAL:                97/97 programs compiled
Binaries are located in directory:


To compile the code under windows, you need to install cygwin, a Linux-like environment for Windows.

The installation or update of cygwin is done by running the setup.exe executable. It is recommended to install:

  • g77, a Fortran 77 compiler
  • gfortran, a Fortran 95 compiler . You may have to install it from http://gfortran.com/download/cygwin/, since it is not available through the cygwin installer.
  • Xterm, the X11 terminal emulator.
  • gmp, mpfr, and mpc libraries
  • The NetCDF library. The library is available in the cygwin installer, but does not properly work in all cases (and you must add the library nclib=/usr/lib/libnetcdff.dll.a into the compiling options). When trying to make the cygwin netcdt library to work, you might need to use cygcheck netcdfoutput.a to see which libraries are still missing (in our case sasl) and therefore to install with the cygwin installer.

If you need to install nectCDF from source, proceed as follows. We used version 3.6.3, which does not require hdf5 library. The installation was performed with commands:

cd directory_containing_netcdf3.6.3
./configure --disable-cc
make install

The second line means that the library will not be build for c++ (not necessary in the case of Diva).

Run a test case

  • Go into divastripped directory:
cd path_to_divastripped
  • Execute the script divatest:
  • Check you results: they should look like this (here viewed with ncview):

Further tests provided are




for testing finer meshes. Finally


is provided for checking all error calculation possibilities.

Possible issues

Command not found

In case of command not found message, you may have to type

export PATH=$PATH:.

So if you need to type ./divacalc or similar things in a directory where divacalc is present, make sure to expand your path as shown above to be able use local scripts and programs

Problem with awk

By default Ubuntu comes with mawk, which has a different behavior when interpreting awk. In that case, the test will fail, and you will get an error like

error message

To solve this problem, it is only necessary to install gawk. The problem was previously reported for other programs, e.g., http://lists.netisland.net/archives/plug/plug-2008-09/msg00071.html.

Running divatest will try to test if you have the correct gawk version

Personal tools