Diva installation
From GHER
Contents |
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 -xvzf diva-4.6.2.tar.gz
Compilation
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
Linux
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,...) compiler=ifort # Compilation flags flags='-O3' # Netcdf library nclib=/usr/local/lib/netcdf3ifort/libnetcdf.a
If your installation knows the nc-config or nf-config command, you can use
nclib=`nc-config --flibs`
If you have run-time problems with netcdf libraries, you can also try
compiler=`nc-config --fc`
to make sure you use the same compiler as the one used to compile the netcdf libraries.
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. If your compilation fails and complains about not finding netcdf.mod you can add -I/<pathtomissingmodfile> into the compilation options if you know where the netcdf.mod can be found.
Run the compilation script
./divacompileall
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: ~/diva-4.6.2/DIVA3D/bin
Windows
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 . It is now available through the cygwin installer: gcc-fortan
- Xterm, the X11 terminal emulator.
- gmp, mpfr, and mpc libraries
- dos2unix
- bc
- The NetCDF library (select the package called libnetcdf-fortran-devel). 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. Make sure you have a recent Gfortran compiler compatible with the netCDF version.
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 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:
divatest
- Check you results: they should look like this (here viewed with ncview):
Further tests provided are
divatest0
and
divabigtest
for testing finer meshes. Finally
divatesterror
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
NetCDF issues
Incompatible versions
Error message:
Cannot read module file 'netcdf.mod' opened at (1), because it was created by a different version of GNU Fortran
All libraries and DIVA must be compiled with the same compiler and same compiler version. If Cygwin upgrades its compiler, then the cygwin installation must be updated. The inconsistency might also arise if you compile NetCDF from source and the compiler is updated. The NetCDF source code has to be recompiled in this case.
Missing module file (.mod)
Error message:
Can't open module file 'netcdf.mod' for reading at (1): No such file or directory
Check if libnetcdf-fortran-devel (cygwin) or libnetcdf-dev (ubuntu) is installed. This file should be in /usr/include (sometimes in upper-case e.g. NETCDF.mod). If NetCDF is compiled from source, then the location might be different.