How download and install STILT
1.) Make a local STILT repository working directory like
2.) Retrieve a working copy of the svn STILT repository
with svn from https://projects.bgc-jena.mpg.de/STILT/svn/trunk usage: cd STILT_svn svn --username USER checkout https://projects.bgc-jena.mpg.de/STILT/svn/trunk if you have no access to the repository please read the remarks in the registration part.
3.) Make a STILT Modelling working directory (e.g. STILT_modelling)
in your home directory or to any directory where you have write permission.
3.) Copy from your working copy of the repository the "stiltR"
directory including all subdirectories in the created modelling working directory. usage: cp -R STILT_svn/trunk/stiltR STILT_modelling
4.) Copy from the "stiltR" subdirectory the file "setup.sh" in
the created STILT modelling working directory and set the execution permission. usage: cp STILT_modelling/stiltR/setup.sh STILT_modelling chmod +x STILT_modelling/setup.sh
5.) Run the script "setup.sh". This script will create some
sub-directories (Output, STILT_Exe) in the STILT modelling working directory and will setup some files The STILT Modelling working directory "must have" now: - a "stiltR" subdirectory or link containing the R part of STILT - Output subdirectory - STILT_Exe subdirectory - "setStiltparam.r" with the STILT run parameters - "stilt.bsub.sh" - "stilt.qsub.csh" - 00README_copy.TXT - this contents of this file is not updated
6.) If not yet done, install R, also libraries "foreign" and "fields".
[ Not required at Jena] You can read more about these libraries in the packages description in the list at: http://cran.r-project.org/web/packages/available_packages_by_date.html You have to install these libraries using the packages installation procedures for R, see at: http://cran.r-project.org/web/packages/
7.) Compile an executable "hymodelc" from the sources and Makefile in
the "trunk/merged_stilt_hysplit/" directory of your working copy of the STILT repository. [ At Jena login at galactica and choose the pgf90 compiler ] Move the "hymodelc" executable file in your STILT modelling directory
8.) set environment variable R_LIBS to the RPackages path
example in .bashrc : export R_LIBS=/usr/local/apps/R/share/RPackages/
9.) Compile the R extensions in stiltR/shlib.
For that, you need a compiled netCDF library with Fortran 90 bindings. See for more info at : http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/ Also make sure that your computing environment is set up properly to run shared libraries; probably they refer themselfs to runtime libraries of the Fortran compiler and need to find them, which is often accomplished by setting some environment variables (see the compiler manual). E.g. at Jena: Please source file /usr/local/etc/sources/Intel_fort.(c)sh (bash or csh) to set Fortran environment and libraries. [At Jena there are already compiled versions under /Net/Groups/BSY/tools/STILT/repository_export/stiltR/shlib_opt/ but these can be not the last version] [In STILT_svn/trunk/stiltR/shlib there is a build.sh shell script, which shows how you can compile the shared library with the Intel fortran compiler at Jena as an example ] Also set netCDF library path, e.g. export LD_LIBRARY_PATH=/usr/local/apps/IntelF/lib:
$LD_LIBRARY_PATH To compile the R extension in stiltR/shlib run R and write within R: help(SHLIB) to see how this works. You have to compile all the f90-Files in stiltR/shlib See the example in help(SHLIB) in R how link the libaries in R. The output of the compiling process will be have the ".so" extension.
10.) Obtain meteorological data in ARL format
Data sources: - http://ready.arl.noaa.gov/archives.php - some are on grid.deas.harvard.edu under /group/wofsy/stilt/Metdata/ - some are on galactica.bgc-jena.mpg.de under /Net/Groups/BSY/data/STILT_Metdata/ (ask Thomas Koch at Jena, firstname.lastname@example.org) - or create from wether forecasting model output (RAMS, BRAMS, WRF, ECMWF) using e.g. RAMS2arl.exe (Ask chg or jcl or Thomas Nehrkorn at AER)
11.) set in "setStiltparam.r" in the STILT Modelling working directory
the variables : path metpath vegpath rundir (set this to ./STILT_Exe if needed) shlibpath
12.) Start R, assign the pathname to the r script directory, and source
all required scripts with sourceall.r Example: sourcepath<-"~/STILT_modelling/stiltR/"; source("~/STILT_modelling/stiltR/sourceall.r")
13.) Only in case of mapping particles to flux grids:
get boundary condition objects with lateral boundary condition for each desired tracer (time dependent latitudinal cross sections) covering desired time period A selection of ASCII files are on grid.deas.harvard.edu in /group/stilt/Boundary/ Example: use function read.bg() (from script read.bg.r) read.bg(spec=c("CO2","CO"),datename="1_1_99_12_31_02", pathin="/group/stilt/Boundary/",pathout="~/Rdat/") read.bg reads -- ASCII files with 4 columns: agl lat co2m sasdate, i.e. altitude (in m), lat (in DEG N), co2 (in ppm), day (since 1/1/1960) Details see in "read.bground.r" or below under 'DIRECTORY LISTING'
14.) Only in case of mapping particles to flux grids AND not running on
grid.deas: get surface flux grids (dumpfile vegflux.dmp), regrid into varying resolution (for dynamic aggregation) -- run script gen_veg_mat.r in R, before need to assign vegpath (e.,g. vegpath<-"/group/stilt/Vegetation/") -- quit R without saving: q(save="no")
15.) we have now added a directory merged_stilt_hysplit which
generates the new hymodelc executable proegram (see News from 1. march 2010 and ask Thomas Nehrkorn tnehrkorn[at]aer.com for more details. A makefile is available in the merged_stilt_hysplit directory