Get JULES

You need to download and install JULES itself, which you do through FCM.

 

STEP 1: Where should you put it? On my system I put all my versions of JULES (and any other models I use) in a directory called ~/MODELS/, which I'm going to refer to as $M from now on (you can of course decide to put them elsewhere, in which case substitute that location for $M). So, from a terminal:
   mkdir ~/MODELS
   export M=$HOME/MODELS
   cd $M

 

STEP 2: Download a version of JULES: either a trunk (released version) or a branch (version under development):

  • TRUNK: this command will download a copy of ('check out') a particular version of JULES for you (you need to replace the X.X with a real version number, which you can get from the list here) and place it in a directory called <DIR> (you need to substitute a meaningful name for <DIR>, e.g. "jules-vnX.X" would be fairly standard). If you omit the @vnX.X bit then it will download the latest ('head of trunk') version for you. 

   fcm co fcm:jules.x_tr@vnX.X <DIR>

  • BRANCH: If you substitute in <USER> and <BRANCH_NAME> then the following command will check out a particular user's branch (you can see all of these on Browse Source on the JULES TRAC here) (I usually omit the <DIR> on the end here and accept the name it automatically assigns).

   fcm co fcm:jules.x_br/dev/<USER>/<BRANCH_NAME> <DIR>

(the keywords "fcm:jules.x_tr" and "fcm:jules.x_br" are short for "https://code.metoffice.gov.uk/svn/jules/main/trunk" and "https://code.metoffice.gov.uk/svn/jules/main/branches", respectively). For many more variations on these two commands, see e.g. Kerry Smout-Day's Quick Reference Guide.

 

** If you see a message about the password for the ‘authentication realm’ then DO NOT agree to store the password unencrypted: please check that your MOSRS password has been cached correctly **

 

STEP 3: Record the location of this version of JULES in an environment variable $JULES_ROOT: cd into the directory that appeared during the fcm command you used above
   cd <DIR>
   export JULES_ROOT=$PWD
   echo $JULES_ROOT
(it should work out that $JULES_ROOT contains the path $M/<DIR>).

 

STEP 4: Compile JULES

*** n.b. if you are working at a standard SITE, then there will be a platform file set up for you already in etc/fcm-make/platform/ and rose stem testing will work without the changes in this STEP ***

You need to link your JULES setup to the NetCDF files on your system by editing the FCM configuration file at $JULES_ROOT/etc/fcm-make/make.cfg (in these steps we are not using platform files like those in $JULES_ROOT/etc/fcm-make/platform/: see section 8.1 of the JULES on Jasmin Unofficial Guide here for a bit about them). Under "# Load the environment variables that control the build" (after line 22), change the following options from

   $JULES_COMPILER{?}        = gfortran
   $JULES_BUILD{?}           = normal
   $JULES_OMP{?}             = noomp
   $JULES_MPI{?}             = nompi
   $JULES_NETCDF{?}          = nonetcdf
   $JULES_NETCDF_PATH{?}     = /path/to/netcdf
   $JULES_NETCDF_INC_PATH{?} = $JULES_NETCDF_PATH/include
   $JULES_NETCDF_LIB_PATH{?} = $JULES_NETCDF_PATH/lib
to:
   $JULES_COMPILER{?}        = gfortran
   $JULES_BUILD{?}           = normal
   $JULES_OMP{?}             = noomp
   $JULES_MPI{?}             = nompi
   $JULES_NETCDF{?}          = netcdf
   $JULES_NETCDF_PATH{?}     =
   $JULES_NETCDF_INC_PATH{?} = /usr/lib64/gfortran/modules
   $JULES_NETCDF_LIB_PATH{?} = /usr/lib64
Please note that these last two are the paths for the linux system at CEH Wallingford: you will amost certainly have different paths on your system and need to find out what they are. $JULES_NETCDF_INC_PATH is the NetCDF include path, which must be the directory containing the NetCDF module file netcdf.mod; $JULES_NETCDF_LIB_PATH is the NetCDF library path, which must be the directory containing the NetCDF library files libnetcdf.a and/or libnetcdff.a . If you use a different Fortran compiler from gfortran, then you will also have to change $JULES_COMPILER. For more information on what these options mean, go to the JULES Manuals page -> your version -> Building JULES using FCM.

Now the FCM compile should work:
   cd $JULES_ROOT
   fcm make -j 2 -f etc/fcm-make/make.cfg --new
After a few minutes of [info] lines you should see “[done] make” which indicates it’s finished compiling and an executable jules.exe will appear in $JULES_ROOT/build/bin/ , which you can check using
   ls $JULES_ROOT/build/bin
A confusing part of JULES is that it currently supports two different compilation methods: the executable you've just created is the one that will be used if you run JULES outside the Rose system, but running through Rose it recompiles and stores another executable elsewhere (and doesn't use this one). Even if you're only planning to run JULES through Rose, I still recommend to do this compilation as a check that the NetCDF libraries have been correctly linked.

 

STEP 5: Make sure you have permission to execute the JULES create and run commands (sometimes this does not happen automatically):
   chmod 777 $JULES_ROOT/build/bin/*
   chmod 777 $JULES_ROOT/bin/*

and append the JULES command set to your library. This must be done every time you log on, so best to add the following two lines to the end of your ~/.bashrc file to accomplish this:
export PATH=[Put here the full path of $JULES_ROOT]/bin:$PATH
export PATH=[Put here the full path of $JULES_ROOT]/build/bin:$PATH
Run your .bashrc file (or log off and log in again):
   . ~/.bashrc

 

All done: JULES has now been installed.