Run RAPID in Local Linux
Originally by Cedric H. David
Updated by Tingting Zhao <tzhao6@illinois.edu>
March 20, 2012

Goal
Run RAPID model in a local Linux-friendly computer.

Hardware Requirement
A Linux-friendly computer with gfortran compiler is required. In this case, Ubuntu 11.10 with GNU
Fortran 95 (version: gfortran 4:4.6.1-2 ubuntu5) is used.

Other Requirements
MPI, PETSc scientific library, TAO optimization library and netCDF are required for RAPID. The
corresponding versions and download links are below.
mpich2-1.0.8 (http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/)
PETSc 3.1-p6 (http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/)
TAO 1.10.1-p3 (http://www.mcs.anl.gov/research/projects/tao/download/index.html)
netCDF 3.6.3 (http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_3/index.jsp)
All scientific libraries are compiled with the same complier - gfortran95 (version: gfortran 4:4.6.1-2ubuntu5).
RAPID files can be downloaded from Cedric’s website(http://www.geo.utexas.edu/scientist/david/rapid.htm).

Installation Procedures# Assuming the packages are located at: /home/tingting/RAPID_Software

mpich2-1.0.8 installation
cd /home/tingting/RAPID_Software

tar xfz mpich2-1.0.8.tar.gz
mkdir -p /tmp/tingting/mpich2-1.0.8
cd /tmp/tingting/mpich2-1.0.8~/RAPID_Software/mpich2-1.0.8/configure --disable-cxx -prefix=/home/tingting/mpich2-install |& teec.txt
make |& tee m.txt
make install |& tee mi.txt
export PATH=/home/tingting/mpich2-install/bin:$PATH
cdtouch .mpd.conf
chmod 600 .mpd.conf# write the password into this file in the format "secretword=tingtingting"# here is the pair of command enclosing any mpiexec or mpdtrace command:
mpd &mpdallexit

petsc-3.1-p6 installation:
cd /home/tingting/RAPID_Software
tar xfz petsc-3.1-p6.tar.gz
cd petsc-3.1-p6/
export PETSC_DIR=$PWD# outdated command: ./config/configure.py --download-f-blas-lapack=1./config/configure.py --download-f-blas-lapack=1 --with-clanguage=C++
make PETSC_DIR=/home/tingting/RAPID_Software/petsc-3.1-p6 PETSC_ARCH=linux-gnu-c-debug all
mpd &make PETSC_DIR=/home/tingting/RAPID_Software/petsc-3.1-p6 PETSC_ARCH=linux-gnu-c-debug test
mpdallexit

tao-1.10.1-p3 installation:
cd /home/tingting/RAPID_Software
tar xfz tao-1.10.1-p3.tar.gz
export PETSC_DIR=/home/tingting/RAPID_Software/petsc-3.1-p6
export PETSC_ARCH=linux-gnu-c-debug
export TAO_DIR=/home/tingting/RAPID_Software/tao-1.10.1-p3
make allmake tao_testexamples >& examples_log
make tao_testfortran >& fortran_log

netcdf-3.6.3 installation:
cd /home/tingting/RAPID_Software
tar xfz netcdf-3.6.3.tar.gz./configure
make checksudo make install

Run RAPID model# Assuming rapid files are located at: /home/tingting/RAPID

Modify “makefile” in rapid# insert netCDF stuff into “makefile” (Modified “makefile” is attached in the end)
Add two paths into “include” and then add corresponding path name into the rest part in “ makefile”.
NCINCPATH follows “-I”, NCLIBPATH follows “-L”.
NCINCPATH= /home/tingting/RAPID_Software/netcdf-3.6.3/f90NCLIBPATH= /home/tingting/RAPID_Software/netcdf-3.6.3/f90

Compile RAPID
export PATH=/home/tingting/mpich2-install/bin:$PATH
export PETSC_DIR=/home/tingting/RAPID_Software/petsc-3.1-p6
export PETSC_ARCH=linux-gnu-c-debug
export TAO_DIR=/home/tingting/RAPID_Software/tao-1.10.1-p3
export netcdf_DIR=/home/tingting/RAPID_Software/netcdf-3.6.3
tar –xzf rapid_model_20110716.tar.gz
tar –xzf rapid_input_San_Guad_20110716.tar.gz
cd /home/tingting/RAPID/rapid
ln -s rapid_namelist_San_Guad rapid_namelist ( # only required in the first time for running RAPID)
make clean
make rapid

Run RAPID
mpd &mpirun -np 1 ./rapid
mpdallexit

Appendix (modified makefile)#modified/added texts are in red
include ${TAO_DIR}/bmake/tao_common
NCINCPATH=/home/tingting/RAPID_Software/netcdf-3.6.3/f90
NCLIBPATH=/home/tingting/RAPID_Software/netcdf-3.6.3/f90

rapid: rapid_main.o \rapid_read_namelist.o \rapid_create_obj.o \rapid_net_mat.o \rapid_obs_mat.o \rapid_routing.o \rapid_routing_param.o \rapid_phiroutine.o \rapid_destro_obj.o \rapid_var.o \tao_chkopts-${FLINKER} -o \rapid \
rapid_main.o \rapid_read_namelist.o \rapid_create_obj.o \rapid_net_mat.o \rapid_routing.o \rapid_routing_param.o \rapid_obs_mat.o \rapid_phiroutine.o \rapid_destro_obj.o \rapid_var.o \${TAO_FORTRAN_LIB} ${TAO_LIB} ${PETSC_LIB} -L ${TACC_NETCDF_LIB} ${NCLIBPATH} -lnetcdf${RM} rapid_main.odummy:
echo ${PETSC_FORTRAN_LIB}

rapid_main.o: rapid_main.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_main.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE} \-I ${TACC_NETCDF_INC} ${NCINCPATH}

rapid_destro_obj.o:

rapid_destro_obj.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_destro_obj.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

rapid_phiroutine.o:

rapid_phiroutine.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_phiroutine.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE} \-I ${TACC_NETCDF_INC} ${NCINCPATH}

rapid_routing.o:

rapid_routing.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_routing.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE} \-I ${TACC_NETCDF_INC} ${NCINCPATH}

rapid_routing_param.o:

rapid_routing_param.F90 rapid_var.o tao_chkopts

-${FLINKER} -c rapid_routing_param.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

rapid_obs_mat.o:

rapid_obs_mat.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_obs_mat.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

rapid_net_mat.o:

rapid_net_mat.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_net_mat.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

rapid_create_obj.o:

rapid_create_obj.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_create_obj.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

rapid_read_namelist.o: rapid_read_namelist.F90 rapid_var.o tao_chkopts-${FLINKER} -c rapid_read_namelist.F90

rapid_var.o:

rapid_var.F90 tao_chkopts-${FLINKER} -c rapid_var.F90 ${PETSC_INCLUDE} ${TAO_INCLUDE}

clean::
rm -f *.o *.mod rapid