Diva installation
From GHER
Contents |
How to install?
- Extract the files from the archive, here as an example for version 4.6.0
tar -xvf diva-4.6.0.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)
In order to compile the code:
- Go in the source directory
cd diva-4.4.2/src/Fortran
- Edit the configuration file for the compilation divacompile_options according to your machine.
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
# Netcdf library if found by executing nc-config: make sure to use backquote ` nclib=`nc-config --flibs`
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:
divacompileall
and check the log file (compilation.log)
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 . 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 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