How to use RegCM code.

1.  How to get the code

you can easily get it from the svn/gforge portal:

 svn checkout --username anonsvn https://svn.gforge.escience-lab.org/svn/regcm

if you are part of the developing team and you are a registered user of the portal use your username

 svn checkout --username your_username https://svn.gforge.escience-lab.org/svn/regcm

2.  How to compile the code (parallel version)

Actually regcm does NOT implement dynamic allocation, so a static binary should be compiled for each experiment you want to run. Even the number of cpus should be fixed statically before compilation. There are three major steps in compilation indicated here below. The first two operations are not trivial due to the fact you have to precisely know what the code does. Datasets, parameters and all the other stuff should be known so no way to complete smoothly the first two steps if you are not a researcher. Please refer to the official pdf regmc guide.

2.1  Define the domain, i.e. define the size of the simulation (XxYxZ grid) (Preproc/Terrain directory) and length of the simulation (starting time and final time)

Things to note here:

  • some external libraries are needed at this step(netcdf in particular): be sure they are available and correctly compiled for your architecture/compilers

2.2  Setup Boundary conditions (Preproc/ICBC)

Things to note here:

  • libraries are also needed here (to check)
  •  this step produces a small script to be used to compile the code: our suggestion is to take a look at it and execute the compilation steps manually

2.3  Compile the actual regcm code (Main directory)

Things to note here:

  • Makefile for different platforms are available: you are supposed to create by hand a symbolic link to the one more appropriate
  • for Hg1 cluster and in general 64 bit Linux Cluster architecture Makefile_IFC11 should be ok (Intel compiler)

3.  How to run the code

Once executable is done and all links to datasets needed by the simulation are there, the code can be run in the standard way a parallel MPI program is executed (mpirun in our case) Tips in running the code:

4.  How to build regcm with different compilers

4.1  Pgi compiler (tested against version 8.0)

Just one issue here: remember to change ibyte variable from 1 to 4.

4.2  gfortran compiler (tested against version 4.3)

Makefile_gnu has been inserted: mandatory flag is -fconvert=big_endian to allow reading correctly binary input files.

gfortran complains about wrong namelist syntax on regcm.in. It could be rapidly fixed just replacing $ with / at the end of each namelist.

Due to the fact that regcm.in is generated somewhere in step 2 (ICBC generation) it should be fixed in that part of code.

Same issue as pgi: ibyte should be 4 in regcm.param and regcm.param2

5.  How to create/compile and plays with RegCM test and benchmarks

5.1  How to build a regcm benchmark

We present here a simple recipe to build our own benchmark from an already running simulations. We plan to just change the size of the grid (increasing and/or decreasing) and the length of the simulations: we generally consider one month of simulation as standard benchmark.

We do assume to have a complete Regcm distribution with all the parameters and datasets properly configured and available.

step 1: edit and change the domain.param file in Preproc/Terrain for a standard clean distribution

This is the most important file of the simulation: everything is generated starting from it. We need to build it from scratch accordingly to the information contained in regcm.in and in the standard output produced by regcm. We also need information contained in regcm.param and regcm.param2

Define a new grid

Here below the section of the domain.param file which contains the parameter we need to work on in order to change the size of the simulation:


      parameter(iproj='LAMCON') ! Map projection (LAMCON,NORMER,POLSTR,ROTMER)
      parameter(iy=54)         ! number of grid points in y direction (i)
      parameter(jx=64)         ! number of grid points in x direction (j)
      parameter(kz=18)          ! number of vertical levels (14, 18 or 23)
      parameter(nsg=1)          ! number of subgrids in 1 grid (one direction)

      parameter(ds= 25.0)       ! grid point separation in km
      parameter(ptop= 5.0)      ! pressure of model top in cb.

      parameter(clat= -19.00)    ! Central latitude (North positive)
      parameter(clon= 50.00)    ! Central longitude (East positive)

      parameter(plat=clat)      ! Pole latitude  (used for ROTMER)
      parameter(plon=clon)      ! Pole longitude (used for ROTMER)

      parameter(truelatL= -30.)  ! LAMCON true latitude (low  latitude side)
      parameter(truelatH= -60.)  ! LAMCON true latitude (high latitude side)

The above first four parameters are easily available in regcm standard output looking at the following lines:

**** RegCM IS BEING RUN ON THE FOLLOWING GRID: ****
 ****     Map Projection: LAMCON                ****
 ****     IX=         120  JX=         128  KX=          18              ****
 ****     PTOP=   5.000000      DX=   25000.00            ****
 ****     CLAT=   -19.00000      CLON=   50.00000         ****
 ***************************************************

Note that IY is actually the X direction, while JX is the Y direction. This weird naming convention should be fixed soon or later.. Y should be divisible by the number of CPU, because parallelism is done just on the Y direction. IT is a wise choice to use a power of two number. You can than increase IY and JX keeping constant the KX values.

PTOP and DS variables corresponds to PTOP and DX variable on standard output: please note that dx is actually ds but in the output is written in meter while in this file should be defined in kilometer. Again name of variable are different but this Regcm baby..

Central Latitude and Longitude CLAT and CLON are again available from Regcm standard output with the same name, but please note but please note that if clat, like in this example, is negative you should change put a minus also in the truelatL, truelatH variables above. Numerical values should not be affected.

Define new dates

These two variables define the simulation interval: it is straightforward to change them accordingly to our need:

 

! The following parameters can be reset later in RegCM/ICBC/icbc.param
      parameter(IDATE1=2001010200)   ! First date of simulation
      parameter(IDATE2=2001020100)  ! Last  date of simulation

check datasets

This is the most tricky part because not all the information is reported in regcm output files. You have to be sure to check and define the following variables:

 

!DATTYP: (ECMWF,ERA40,ERAIN,EIN75,EIN15,EIM25,ERAHI,NNRP1,NNRP2,NRP2W,GFS11,FVGCM,FNEST,EH5OM)
      parameter(DATTYP='ERAIN')
! SSTTYP : (GISST,OISST,OI_WK,FV_RF,FV_A2,FV_B2,EH5RF,EH5A2,EH5B1,EHA1B,ERSST,ERSKT)
      parameter(SSTTYP='ERSKT')
      parameter(EHSO4 =.false.)
      parameter(LSMTYP='BATS')      ! LANDUSE legend (BATS or USGS)
      parameter(nveg=20)            ! Number of LANDUSE categories
                                    ! 20 for BATS, 25 for USGS.
      parameter(AERTYP='AER00D0')   ! AEROSOL TYPE option,
      parameter(ntex=17)            ! Number of SOIL TEXTURE categories
      parameter(NPROC=8)            ! Number of CPU used for parallel job.

We suggest to check the Regcm Manual for all the details: be sure that dataset are correctly identified.