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:
- Extract the files from the archive:
tar -xvzf 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
- 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
If you have run-time problems with netcdf libraries, you can also try
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
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
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
- 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:
- 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.
Command not found
In case of command not found message, you may have to type
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
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
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)
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.