1.2. Export off-line version of SURFEX
From version 7_2 of Surfex, the configuration and installation environment of off-line Surfex is adapted to this from Meso-nh.
This leads to changes in configuration and installation processes.
First important recommandation: before to run an experiment (pgd, prep or offline), you need to type
in the terminal where you will run the experiment. It’s even better to put this line in your file $HOME/.bash_profile so that it’s executed each time you open a new terminal.
– INSTALLATION / COMPILATION:
Instructions to install surfex (V8_1 for example) on a linux-PC
- Select a directory where installation has to be done: for example $HOME or $HOME/MYDIR, where MYDIR is an existing directory (if not, it has to be created by the user). From now on, it is supposed that the user has defined a MYDIR directory.
Caution: the directory and all parent directories MUST NOT contain dots (.) in their names.
- Download the package and move it into $HOME/MYDIR/open_surfex_v8_1.tar.gz
(You can also get the package from GIT directly).
- Extract files from archive: tar -zxvf open_surfex_v8_1.tar.gz (or gunzip open_surfex_v8_1.tar.gz and then tar xvf open_surfex_v8_1.tar.gz). A directory open_SURFEX_V8_1/ is created in MYDIR and contains all software peaces.
- Initialize environment variables needed for surfex:
Go into src/ directory and run
./configure
Then, execute the profile file for this master version of surfex
. ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-MPIAUTO-O2-X0
Caution: the name of your profile can be different! This is just an example, with the default options of compilation. When configure is executed, a profile is printed on the screen. You have to load this profile. For instance, if you choose to compile without MPI (VER_MPI=NOMPI) and with XIOS (VER_XIOS=2) the created profile will be profile_surfex-LXgfortran-SFX-V8-1-1-NOMPI-O2-X2
- compile the master version of the code:
in the src/ directory, runmake
and thenmake installmaster
Master executables are created in directory exe.
If everything goes well until this step, then master surfex has been successfully installed on you computer.
– INSTALLATION OF A PRE-DEFINED EXPERIMENT:
- How to install a pre-defined experiment:
- in another terminal, in src directory, do export VER_USER=FORC.
- run ./configure.
- execute the profile file corresponding to this user version of surfex:
. ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-FORC-MPIAUTO-O2-X0. - run make user and make installuser to create the specific executables in directory exe.
- go into MY_RUN/FORCING directory and run prepare_forcing.bash with a name of experiment as argument:
for example "./prepare_forcing.bash hapex"
a namelist MY_PARAM.nam will open (vi editor), simply quit (use command :q)
Some information will then be written on the screen and should look like:
$SRC_SURFEX="/home/lemoigne/surfex/open_SURFEX_V8_1"
-- namelist NAM_MY_PARAM read
> ==========================================
> PREP_INPUT_EXPERIMENT: YEXPER = HAPEX
> PREP_INPUT_EXPERIMENT: INI = 1
> PREP_INPUT_EXPERIMENT: INPTS = 17521
> PREP_INPUT_EXPERIMENT: JNPTS = 17521
> PREP_INPUT_EXPERIMENT: ZTSTEPFRC = 1800.
> PREP_INPUT_EXPERIMENT: YFORCING_FILETYPE = NETCDF
> ===========================================
YFILE_FORCIN=../DATA/hapex/HAPEX.DAT.30
-rw-r--r-- 1 lemoigne mc2 1543644 jui 22 16:51 /home/lemoigne/surfex/open_SURFEX_V8_1/MY_RUN/FORCING/FORCING.nc
==============================================
> input files moved to /home/lemoigne/surfex/open_SURFEX_V8_1/MY_RUN/KTEST/hapex
==============================================
- once the installation is done, go to $SRC_SURFEX/MY_RUN/KTEST/hapex directory and launch successively:
- pgd.exe
- prep.exe
- offline.exe
- to view output 1d, you can use your favorite graphic software (e.g. xmgrace, which is very easy to use for ASCII outputs)
- How to rerun a pre-defined experiment with new inputs:
- you can define new surface characteristics by modifying file $SRC_SURFEX/MY_RUN/KTEST/hapex/OPTIONS.nam and then run pgd.exe, prep.exe and offline.exe
- you can define new initial values for state variables by modifying file $SRC_SURFEX/MY_RUN/KTEST/hapex/OPTIONS.nam and then run prep.exe and offline.exe
- you can modify the forcing characteristics
- you can rerun $SRC_SURFEX/MY_RUN/FORCING/prepapre_forcing.bash and modify namelist MY_PARAM to select the number of time steps you want to treat (parameter NUMBER_OF_TIME_STEPS_FINAL) the format of the input forcing files (parameter YFORCING_FILETYPE)
- then go to $SRC_SURFEX/MY_RUN/KTEST/hapex and rerun pgd.exe, prep.exe and offline.exe
- How to create a new experiment:
- you need to modify $SRC_SURFEX/src/FORC/my_forcing.f90 to introduce the call to the new program that is going to read your dataset
- you need to create a new subroutine named $SRC_SURFEX/src/FORC/my_forc_xxxx.f90 that corresponds to experiment xxxx
- then run successively:
- in src directory, make user (verify that $VER_USER=FORC and that corresponding profile file has been executed).
- in MY_RUN/FORCING directory, prepare_forcing.bash (to create input files related to your experiment)
- then go to $SRC_SURFEX/MY_RUN/KTEST/xxxx and run pgd.exe, prep.exe and offline.exe
– COMPILE YOUR OWN SOURCE FOR SURFEX:
- choose a name for your own source directory in src/, for example MYSRC.
- copy the sources (from OFFLINE or SURFEX directories) that you want to modify onto $SRC_SURFEX/src/MYSRC/
- go to $SRC_SURFEX/src/MYSRC and make your modifications
- go to $SRC_SURFEX/src/ and launch successively
export VER_USER=MYSRC
./configure
. ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-MYSRC-MPIAUTO-O2-X0
make user
make installuser
New executable files for MYSRC will be created in exe directory.