BISMG:SarahS/jules

Check out code from here
svn co --username sarah-shannon https://puma.nerc.ac.uk/svn/JULES_svn/JULES/trunk jules_trunk

Check out examples: svn co --username sarah-shannon https://puma.nerc.ac.uk/svn/JULES_svn/JULES-DOC/trunk jules-doc

Installation guide on dartagnan with FCM make & intel
Permanently add the fcm make module using, module initadd fcm/2.3.1

Run this shell script

#!/bin/bash

#Build JULES using fcm make. Remember to add fcm module is not already there

export JULES_CFG_COMP=intel

export JULES_CFG_BLD=debug

export JULES_CFG_NCDF=/home/paleo/ggsrs/jules/jules-trunk/config.cfg # Path to netCDF include and libs export FCM_DEBUG=true

fcm make -f etc/fcm-make/make-local.cfg <br /

where config.cfg contains

$fflags = $fflags -I/opt/local/CentOS-64/netcdf/4.0/intel_fc_10.1/include

$ldflags = $ldflags -L/opt/local/CentOS-64/netcdf/4.0/intel_fc_10.1/lib -lnetcdf -lnetcdff

Alternatively,
 * make COMPILER=intel BUILD=fast CDF_LIB_PATH=/opt/local/CentOS-64/netcdf/4.0/intel_fc_10.1/lib CDF_MOD_PATH=/opt/local/CentOS-64/netcdf/4.0/intel_fc_10.1/include

Installation guide on dartagnan with make (gfortran and netcdf4)
Before starting add the gfortran library to your default path by adding this to your .bashrc

Steph has installed a newer version of gfortran in his /opt/directory than is currently on dartagnan.

DDIR=/data/ggslc/opt

export PATH=$DDIR/bin:$PATH

export LD_LIBRARY_PATH=$DDIR/lib64:$LD_LIBRARY_PATH

Log in and out to get the new gfortran compiler working

In the Makefile add the following lines

LIB_PATH += $(LIB_INC)$(HDF_LIB_PATH)

ifeq ($(CDFDUMMY),false)

LIB_LIBS += $(LIB_PRE)netcdff $(LIB_PRE)netcdf $(LIB_PRE)hdf5_hl $(LIB_PRE)hdf5 $(LIB_PRE)z 

endif

Link to Steph's gfortran libraries

make COMPILER=gfortran BUILD=debug CDF_LIB_PATH=/data/ggslc/opt/BISICLES/netcdf/serial/lib CDF_MOD_PATH=/data/ggslc/opt/BISICLES/netcdf/serial/include HDF_LIB_PATH=/data/ggslc/opt/BISICLES/hdf5/serial/lib

Note that Steph built the netcdf libraries with the same version of gfortran that is in your path. This is essential.

Running point-loobos example

 * This example runs point at latitude = 52.168, longitude = 5.744

Running gridded example (see WFD in training manual)

 * Remember to ulimit -s unlimited
 * Example ran in /example/WFD/expt004/
 * Run with jules_fast.exe. Note jules_debug.exe results in a seg fault at seek_all_to_current_datetime in init.F90

General Issues ...
''
 * Running point_loobos example in debug mode fails !. Why ? This is the simplist example
 * Stripes in output when running for land & ocean points - - Fixed by creating mini netCDF input files for the Alps and using this as the model grid.
 * Can't seem to output snow level data when multi layer snow scheme is switched on - Fixed by setting l_aggregate=T
 * When setting up model to run with daily data, set timestep_len to be small or model become numerically unstable. This results in surface temp tstar_gb ~ 3130oK. I have used timestep_len=21600 sec (i.e. 6hrs)''- fixed by setting model time step to 3600 or Andy Wiltshire uses 1800.

Changes to get Andy Wiltshire's code to run on dartagnan (r1444_sub_ice)

 * In Makefile remove the f from the line netcdff

ifeq ($(CDFDUMMY),false)

$(LIB_PRE)netcdff

endif


 * pp files provided are machine dependant. Compile code with flag -convert big_endian in the Makfile.comp.intel i.e. FF_DBG=-g -C -CB -traceback -check noarg_temp_created -convert big_endian

59_glacier_elev_tiles_n192.pp --> 59 maps of elevation, 1-9 have no elevation, 10-59 have elevation in the file

50_glacier_tiles_n192.nc --> 59 maps of fraction of surface types

ajkkga.da60c10.JULES.soil.pp --> 1 map of soil parameters for several variables


 * Uncomment out some of the stash codes in init_drive.F90 so that they match the input pp climate files provided by AW
 * In init_opts.F90 at line 102 change WRITE(char,'(II)') i to WRITE(char,'(I2)') i. because the number of ice levels is > 10


 * Code does not calculate surface mass balance. Create a new subroutine to calculate smb called tile_smb. Put subroutine into ICE directory remember to modify Makefile in ICE directory to include the new subroutine
 * call tile_smb from control.F90
 * save smb variable to offline_diag. Note this is only used for offline JULES. Put here temporarily as it is following what Andy did but may need to change this in the future
 * I have put smb in the offline_diag list but should this be in a better place? Watch out that variables in offline_diag are not deallocated!
 * Put smb variable with AW's other ice variables in allocate_arrays.F90
 * SMB = snowfallT (snowfall_tile_diag) - melt_tile - ei_tile.


 * Therefore smb(i,n) = snowfall_tile_diag - melt_tile(i,n) - ei_tile(i,n)
 * Add smb to the output in output_mod.F90 and init_out_varlist.F90
 * OK crossed checked that smb output = snowfallT - eiT - snowMeltT. Difference is -4e-10 -> 2e-10 :)
 * Conversion of snow to ice (firn_flux is zero). This is because in snowpack.F90 firn_flux is set to zero and not calculated. Uncomment out this line firn_flux(i)=MIN(sice(i,n)/timestep,0.1*dz_ice(1)*ice_rho/timestep)
 * Test what happens when the temperature is increased by 10 deg by changing update_mod.F90 line 336