Diva Problems and solutions


Revision as of 16:05, 16 April 2013 by Jmb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


"Command not found" message

Why do I get this error?

Although you are in the correct directory, the command is not found. This is because the current directory (represented by ./) is not in the path of your system.


How to solve it?

You can type


so that the system knows the command is the current directory.

A better solution is to adapt your path by typing:


For example in cygwin:

  • go in the /etc/
  • edit file bash.bashrc file

and add the following line:

export PATH=$PATH:.
  • type
source bash.bashrc

in order to take into account the modification made.

Command-line scripts not working


Why do I get this error?

End of lines in Unix and Windows files are different, and this causes problems when switching from a system to the other. Typically if you visualize a Windows-end-of-line file under Unix, you will see end of lines with the symbol |^M| or |\r|. When reading such files, scripts get in trouble because they expect to read numbers, but they find characters.

Note: strange behaviours of DIVA are often related to this topic, therefore always be aware of this possible problem before undertaking more complex actions.

How to solve it?

Working on a individual file, the command

dos2unix -U file_name

does the conversion between Windows and Unix end of lines. If you have to perform the conversion on a large number of files, use the script divados2unix located.


Compilation problems

Why do I get this error?

The array S defined in the various programs located in ./src/Fortran/Calc/ are too large to be handled by your compiler.

How to solve it?

You need to recompile the sources after reducing the values of parameter nrea in file ./src/Fortran/Calc/divainc.h:


Then use script divacompile to get the new executables. If you get the same error message, reduce again the value of nrea.


Undefined references to NetCDF routines


Why do I get this error?

The NetCDF library, required for compiling of netcdfoutput.f, netcdfoutputfield.f and netcdfoutputerror.f, is not compatible with your compiler, or not found by the linker.

How to solve it?

You have to make sure that divacompile includes the appropriate link path.

If this is not sufficient, you will have to rebuild the NetCDF library corresponding to your operating system. Installation and compilation procedures can be at http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install

Resource temporarily unavailable


Why do I get this error?

The diva.a executable requires to much memory to work. This error comes from the operating system limitations.

How to solve it?

The solution is the same as previous case: recompile the sources after reducing the values of parameters nrea and nent in file ./src/Fortran/Calc/divainc.h:


If you get the same error message, reduce again the values of nrea and nent.

Note that maximal allowable values for these parameters depends on your compiler and system, so it is not possible to assign them with universal values.

Error of allocation

Image:Error allody.PNG

Why do I get this error?

The memory allocation is not sufficient for the DIVA to be executed in the case you consider. This message may appear either during the mesh generation (the required mesh is too fine considering the size of the domain) or during the resolution itself (i.e. divacalc).

How to solve it?

The solution is nearly the same as the previous case: you need to compile the source again, this time after increasing the values of nrea and nent.

Additional information

In some uncommon cases, you may not be able to find values of nrea and nent that will allow you to avoid both problems. In these cases, the recommended solution consists of:

  1. Find the highest values of nrea and nent that allow you not to have message error \ref{sec:error_allocation};
  2. Generate a mesh with a value 3-5 times larger than the correlation length you want to use for the resolution; this can be done be simply editing file ./input/param.par, changing the value of correlation length, and run divamesh;
  3. Once the mesh is generated, edit again param.par and assign the correct value to the correlation length, and run an analysis with divacalc.

This procedure should help you to save memory otherwise used for the finite-element mesh. Working with a coarser mesh will not affect excessively your results.

Permission denied for execution of diva.a

Why do I get this error?

Although the compilation worked without any message error, diva.a cannot be executed. This problem seems to occur only with gfortran compiler under Cygwin. Actually the problem is not related to permission (command chmod will not solve the problem) but with compilation. As described in previous problem, values of parameters nrea} and nent} shall be decreased and the sources recompiled.

How to solve it?

Same as previous problem.

Problem with contour generation


Why do I get this error?

The number of contours created from a given topography is too high.

How to solve it?

Modify the first line of contourgen.f (located in ./src/Fortran/Mesh/) and increase the value of nm


Additional information

As the default value of nm is already large, you may also consider working with a topography with lower resolution. This should avoid the creation of of a great number of very small contours, which will not necessarily add quality to your analysis.

Jacobian matrix with null determinant

The value of the Jacobian determinant is zero.


Why do I get this error?

This messages comes from a problem in the mesh generation: some of the triangular elements are too deformed and generate a null value for the determinant. Then the solver cannot work, since it needs to inverse the Jacobian matrix.

How to solve it?

This problem was fixed in latest versions of DIVA.

Analysed field with white stripes

The analysed fields has stripes of NaN values.


Why do I get this error?

This problem comes from a too aggressive optimisation to create executable diva.a, although during the compilation, no warning or error was detected.

How to solve it?

This problem has been fixed in latest version of DIVA. However, if you are still using older versions and get this kind of outputs, you can avoid them by changing the compilation flags and compile the source again. The recommended change is to use -O0 flag instead of -O3 (optimization flags) when compiling the sources located in the Fortran/Calc/ directory.

Analysis yields empty field

After the execution of divacalc, you get very small input files, with only one grid point.

Why do I get this error?

The most frequent reason is that the param.par file has been modified during the execution of (Generalised) Cross Validation (to save computational time nx and ny are set to 1, since the analysis at every grid points is not necessary) and the process was interrupted before it ends.

How to solve it?

Simply edit param.par to write the correct values of nx and ny, then run again divacalc (or divadress) to have an analysis on the desired grid.

Windows runs out of virtual memory during diva execution

Why do I get this error?

The problem arises probably because you have a computer with little RAM.

DIVA uses a memory allocation for the largest problem encountered. This translates in Windows to a request of virtual memory of around 1.3Gb. During execution, the real memory used can be much smaller than that and the problem actually fit in real memory, even if you have less than 1Gb RAM.

The only problem is that if your Windows virtual memory (the swap file) is not big enough, DIVA will not execute.

How to solve it?

The best solution would be to add real memory (your computer would benefit from it anyway), but to make DIVA work you can simply increase the virtual memory of Windows by changing the windows settings. As administrator:

my computer right click -> properties -> advanced -> performance -> 
settings -> advanced -> change

Put there a virtual memory (swap file) of 2Gb (initial and maximum) and DIVA should run.

Other solution consists of recompiling with lower nrea value.

"Cannot move directory" ... "permission denied" messages

Why do I get this error?

An application has opened one or several files located in the directory you want to (re)move, so that it is impossible to perform the operation.

How to solve it?

Simply close the application(s) that open the files of the concerned directory.

Diva crashed at start-up

You see an error message:

./divacalc: line 348: 32483 Done                    echo $NINT $NREA
   32484 Killed                  | ../../bin/diva.a 

Why do I get this error?

Diva requires more RAM memory than you computer have.

How to solve it?

Decrease nrea and nent in Fortran/Calc/divainc.h

Personal tools