Now there is one thing we need to do before we start, and that is to set up an environmental variable. In order to run VECTRI there are some system “variables” that are required:
You could simply define these each time you run the code, but that would be pretty tedious. As you don't want to do this each time you log in to a new konsole shell, it is more convenient to place these commands in the start-up script that runs when you open a new console in your $HOME. This will depend on your linux flavour (.kshrc, .login, .profile, etc), for example, I use bash and so my start up file is $HOME/.bashrc (the dot is important).
So the first is VECTRI, which points to the code. This is so, no matter where you run, the scripts know where to find the code. Setting the variable will also unfortunately depend on the flavour of shell you use:
ksh or bash: $ export VECTRI=directorylocation
csh: $ setenv VECTRI directorylocation
(note UPPER CASE “VECTRI” is important). So, for example, if your code is in $HOME/vectri and you use bash then you need to type
$ export VECTRI=$HOME/vectri
test it by typing
$ ls $VECTRI
and you should see:
data doc LICENSE README.txt scripts source utils vectri
If instead you get a blank response, you haven't followed the steps above correcly.
The other environmental variables point to the relevant libraries. On my standard mint/ubuntu set up, I set them as follows:
export NETCDF_LIB="-L/usr/libx -lnetcdff -lnetcdf"
export NETCDF_INCLUDE="-I/usr/include"
export FC=gfortran
If you are using linux straight out of the can on a desktop, this is likely to work for you. However, often on clusters and mainframes, the library setup can be diverse. Do not panic, there is a utility that can help called nf-config. Check you have it by typing this:
nf-config - -flibs
So you can set the variables in the following way: CHANGE
export NETCDF_LIB=$(nf-config - -flibs)
export NETCDF_INCLUDE=$(nf-config - -fflags)
export FC=$(nf-config - -fc)
(NOTE: in the examples above the OPTION after the nf-config is with a DOUBLE HYPHEN and NO SPACES)
(although you may prefer to hardwire FC to your favourite compiler, I like gfortran)