Compile SURFEX

Note that all the followings commands must be typed in the same terminal.

If you do not want to compile SURFEX with a MPI-support for parallel runs (recommended for local simulations):

Do not type this command in the following cases :
  • you are working on a supercomputer
  • you want to run simulations over more than 4 points and MPI fortran compiler is available on your computer (this is the case in Meteo-France computers)
  • you need to use the interpolator of SAFRAN fields.
    In the other cases, adding this line to your $HOME/.bash_profile or equivalent is convenient.

At this step, it is also possible to modify the optimization level by :


export OPTLEVEL=O2

By default, the optimization level is “DEBUG” (recommended for the first time or after code modifications). In other cases, the O2 optimization level is recommended (significant decrease of running time).
Long runs must never be run in DEBUG mode.

You can then follow the install procedure given below:
• initialize environment variables needed for surfex: go into src directory and run


Then, execute the profile file for this master version of surfex:
 . ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-NOMPI-OMP-O2-X0

(or equivalent name depending on compiler, SURFEX version and compilation options)

• compile the master version of the code:
in the src directory and in the same terminal, run


and then, again in the same terminal,

make installmaster

Master executables are created in directory exe. If everything goes well until this step, then surfex has been successfully installed on you computer.

Setting specifically the SURFEX binaries to be used by s2m is done by exporting the variable EXESURFEX pointing to the directory containing the PGD, PREP and OFFLINE binaries:

export EXESURFEX=/home/...yoursurfexdirectory../exe

You can add this line to your $HOME/.bash_profile file if you are installing the SURFEX version you want to use by default.

After SURFEX compilation, binaries have their complete names (with compiler name, surfex version, mpi option and optimization level) so you need to create manually symbolic links with these short names as s2m work with the short names.
Please check carefully the full names of your binaries (depending on SURFEX version, compiler and compilation options) to build the symbolic links. Example :