Let say $REGCM_ROOT = “the path where your put the code” and “>” means UNIX command needed to inout.
Step 1: download the RegCM4.2 user guide from http://gforge.ictp.it/gf/download/docmanfileversion/26/569/UserGuide-4.2.pdf
Step 2: Read Chapter 3.1 to see software needed to compile
and install RegCM4.2
Step 3: Read Chapter 9 to see how to install the
pre-required software.
FYI: I only installed NETCDF library and OpenMPI library
Step 4: Edit .tcshrc (for C shell) in your home directory to
define the following shell environment variables according to the compiler on
your system
# (Don’t use “ ” in your shell, here I just want to make
clear)
setenv NETCDF “path of Netcdf Libary”
setenv MPI “path of Openmpi libary”
set path = ($MPI/bin $path)
# If LD_LIBRARY_PATH is not defined, please define as the
following. Otherwise add the Netcdf library and MPI library to previous one
setenv LD_LIBRARY_PATH $NETCDF/lib
setenv LD_LIBRARY_PATH $MPI/lib:$LD_LIBRARY_PATH
Step 4: Patch $REGCM_ROOT/configure file to fix the
configure can not find NETCDF Library file, MPI library file (mpi.h) and the
files in clmlib.
Download the attached file configure.patch to $REGCM_ROOT,
and patch it
> patch –p0 –i configure.patch
Step 5: Patch $REGCM_ROOT/Main/ mod_lm_interface.F90 to fix
Bug 1 and Bug 3 found here: https://lists.ictp.it/pipermail/regcnet/2012/006083.html
Download the attached file mod_lm_interface.F90.patch and
put it in $REGCM_ROOT/Main
> patch -p0 -i mod_lm_interface.F90.patch
Step 6: Patch $REGCM_ROOT/PreProc/ICBC/mod_sst_1deg.F90 to
fix Bug 2 found here: https://lists.ictp.it/pipermail/regcnet/2012/006083.html
Download the attached file mod_sst_1deg.F90.patch and put it
in $REGCM_ROOT/PreProc/ICBC
> patch -p0 -i mod_sst_1deg.F90.patch
Step 7: To fix Bug 3 found here: https://lists.ictp.it/pipermail/regcnet/2012/006083.html, you need the following patches:
mod_bats_common.F90.patch
mod_lm_interface.F90.patch
(already used in Step 5)
mod_mtrxclm.F90.patch
surfrdMod.F90.patch
Download mod_bats_common.F90.patch and put it in $REGCM_ROOT/Main/batslib
> patch -p0 -i mod_bats_common.F90.patch
Download mod_mtrxclm.F90.patch and put it in $REGCM_ROOT/Main/clmlib
> patch -p0 -i mod_mtrxclm.F90.patch
Download surfrdMod.F90.patch and put it in $REGCM_ROOT/Main/clmlib/patchset
to replace the old one coming with the code.
Step 8: To fix Bug 4 in there: https://lists.ictp.it/pipermail/regcnet/2012/006083.html
Download clm2rcm.F90.patch and put in $REGCM_ROOT/PreProc/CLM
> patch -p0 -i clm2rcm.F90.patch
Step 9: To fix But 5 (CLM can not recognize Gregorian
calendar) found there:
https://lists.ictp.it/pipermail/regcnet/2012/006083.html
Download clm_time_manager.F90.patch and put it in $REGCM_ROOT/Main/clmlib/patchset
to replace the old one
Download ESMF.inc.patch and put it in $REGCM_ROOT/Main/clmlib/clm3.5/src/utils/esmf_wrf_timemgr
> patch -p0 -i ESMF.inc.patch
If you use no_leap calendar, Please define -DNO_LEAP_CALENDAR
in CPPFLAGS during configuration. (I will show you later).
Step 10: To fix the bug (segmentation fault caused by
reallocation of c2r_allout in clm_atmlnd.F90) found here:
https://lists.ictp.it/pipermail/regcnet/2012/006113.htm
Download clm_atmlnd.F90.patch and put it in $REGCM_ROOT/Main/clmlib/patchset
to replace the old one
Step 11: Run configure
> setenv CPPFLAGS '-I/parth_MPI_library/include'
If you use no_leap calendar, use the following one:
> setenv CPPFLAGS '-I/parth_MPI_library/include -DNO_LEAP_CALENDAR'
> ./configure --with-netcdf=parth_netcdf_libary --enable-clm
Step 12: make all and make install
Step 13: Run RegCM4.2
mpirun -np 10 ./Bin/regcmMPI_clm regcm.in > & std.out
&