NICAM tutorial summary
H. Miura, Feb 23, 2012
About this document
The document contains a set of easy-to-follow instruction that we will
be using in this introductory lecture on a Non-hydrostatic Icosahedral
Atmosphere Model (NICAM). Since a formal tutorial document,
nicam_tutorial-vl2012.txt, can be bit confusing and tricky forfirst-timers, this is created to make life easier for such people who justwant to run NICAM simulations. Keep in mind that“nicam_tutorial-vl2012.txt” includes detailed information about how to
execute a simulation in NICAM; therefore, you may want to refer to theformal document if you need to know more about it.
A flow chart of this lecture is as follows. You are
A-1. coping NICAM source files and templates of environments,
A-2. making NICAM binaries,
B. creating “mnginfo file”,
C. generating icosahedral mesh,
D. computing weights of a lat-lon interpolation,
E. generating vertical mesh,F. setting topography and land surface conditions,G. making O3 data,
H. generating initial conditions of Atmosphere, Ocean and Land,
I. making SST data,
J. making sea ice and snow data,
K. computing reference states in vertical,
L. running NICAM main program,
M. and converting data from icosahedral mesh to lat-lon mesh.
At a glance, this could be a huge task. But, do not worry. You can finish
the task quite easily by just following the list of commands here.
A. Preparing NICAM
At the beginning, we are making the NICAM binary files on the Linux1

machine named “nicamgate.” Thus we will first login to a nicamgate,
then, move to the computing node as below.
i.

$ ssh -X (your account)@nicamgate.aori.u-tokyo.ac.jpii.

$ ssh -X compute0 (or compute1)

Then, following commands will be used to move to your work directoryand copy files that will be needed in executing NICAM.
iii.

$ cd /data1/(your account)iv.

$ cp /data1/tutorial/nicam_src_20111214.tar.gz ./v.

$ cp /data1/tutorial/reg_nicam_gl05_rl00-20111117.tar.gz ./vi.

$ cp /data1/tutorial/nicam_tutorial-vl2012.txt ./Make links to two data directories that are used as external data sets.
vii.

$ ln -s /data1/tutorial/NICAM_DATABASE

viii.

$ ln -s /data1/tutorial/FNL

Unzip and extract tar files.
ix.

$ tar zxvf nicam_src_20111214.tar.gzx.

$ tar zxvf reg_nicam_gl05_rl00-20111117.tar.gz

The directory “NICAM” includes Fortran/C source files and configure
files to make binaries. The directory “reg_nicam_gl05_rl00” is thetemplate of the NICAM execution environment.
Now, move into “NICAM” directory and create a “Mkinclude” file.
Mkinclude is used to describe special settings of a computer and is usedduring a compilation. Here, we already have such a templete“Mkinclude.vl”, so just copy a Mkinclude.vl to Mkinclude.
xi.

$ cd NICAM

xii.

$ ln -s Mkinclude.vl Mkinclude

Edit Mkinclude for your environment by using Emacs.
xiii.

$ emacs Mkinclude

Here, only line that needs to be edited is on a line 2 “TOPPATH=”. It
must be changed to be “TOPPATH=/data1/(your account)/NICAM”. If
you have modified a file, then save and execute make in a x-terminal asbelow.
xiv.

$ makeYou may wait for a while to create binaries and objects under the2directory bin/. When the make process has been finished, type “$ ls bin/| wc -l”. If count is 73, your make is successful. If not, please let us know.
B. Making “mnginfo”“mnginfo” describes how to redistribute NICAM grid points toindividual computing nodes in its parallel execution. The detail of therule is not the focus of this lecture and we will finish this task by typing
only two lines.
i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/mnginfoii.

$ ../../NICAM/bin/mkmnginfo

Now, you have a file “rl00-prc000005.info” in the directory.
C. Generating icosahedral meshProf. Satoh may teach you about the icosahedral grid, so again we will
not talk about a grid structure in NICAM. Instead, we will focus on thetask to generate “concentrated” icosahedral grid.
At first, we are generating the standard icosahedral grid.
i.

cd /data1/(your account)/reg_nicam_gl05_rl00/grid/hgridii.

mpirun -np 2 ../../../NICAM/bin/mkgrid

You can check the generated mesh by typing as follows:iii.

view_ico.exe setview.cnf-_grid

Then, stretching a grid towards the North Pole.
iv.

mpirun -np 2 ../../../NICAM/bin/transgridv.

$ view_ico.exe setview.cnf-_s10grid

And, moving a center of the stretch to the area of our interest.
vi.

$ mpirun -np 2 ../../../NICAM/bin/rotategridvii.

$ view_ico.exe setview.cnf-_rotate

Next step is to redefine computing nodes to increase computational
accuracy and stability.
viii.

$ mpirun -np 2 ../../../NICAM/bin/mkgcgridix.

$ view_ico.exe setview.cnf-grid

D. Computing latitude-longitude interpolation weights
3

Creating a map that translates from NICAM-grids to alatitude-longitude. Computing an interpolation weights of lat-lon
scheme for each grid points and will be used for data analysis after you
finish NICAM execution (e.g. in an ico2ll.cnf). Thoseinterpolated-weights are generated as follows.
i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/grid/llmapii.

$ mpirun -np 2 ../../../NICAM/bin/mkllmap

E. Generating vertical mesh
Vertical mesh can be generated much easier than the horizontal mesh.
Only two commands are needed here.

F.

i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/grid/vgridii.

$ ../../../NICAM/bin/mkvlayer

Setting topography and land surface conditions
Topography data and land surface conditions for MATSIRO-based
data are generated as follows.
i.

$ cd /data1/(youraccount)/reg_nicam_gl05_rl00/external_data/MATSIRO

ii.

$ mpirun -np 2 ../../../NICAM/bin/mklanddata2

G. Making Ozone data
Ozone data is made as follows.
i.

$ cd /data1/(youraccount)/reg_nicam_gl05_rl00/external_data/O3ii.

$ mpirun -np 2 ../../../NICAM/bin/mko3

H. Generating initial conditionsFirst, we need to convert an original initial data set to a format
assumed by NICAM. We will create such programs that do exactly that,as below.
i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/local/src

ii.

$ emacs Makefile
4

The only line to be edited is a line 4 where a NICAM_TOPDIR must bechanged to “NICAM_TOPDIR=/data1/(your account)/NICAM”. Aftersaving a Makefile, type following commands in the terminal.
iii.

$ cd ../

iv.

$ makeNow you have six programs (conv_lnd, conv_ocn, conv_ocn_ndg,conv_prs, conv_prs_ndg, swap_by_clmsnw) under bin/.
Initial conditions can be generated as follows.

I.

v.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/initial_datavi.

$ sh mk_atm.sh ../../FNL/fnl_20090701_00_00_cvii.

$ sh mk_ocn.sh ../../FNL/fnl_20090701_00_00_cviii.

$ sh mk_lnd.sh ../../FNL/fnl_20090701_00_00_cix.

$ cd ATMx.

$ ../../../NICAM/bin/mkinit_atm

xi.

$ cd ../OCN

xii.

$ ../../../NICAM/bin/mkinit_ocn

xiii.

$ cd ../LND

xiv.

$ ../../../NICAM/bin/mkinit_lnd

Making SST data for a nudging
You can make SST data as follows.
i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/nudging_dataii.

$ sh mk_sst.sh ../../FNL/fnl_20090

iii.

$ cd OCNiv.

$ mpirun -np 2 ../../../NICAM/bin/mkgisst

To check SST data generated, you may use following commands.
v.
J.

$ view_ico.exe setview.cnf-sst

Making sea ice and snow data
Following the previous section, we will make three more data sets.
vi.

$ cd ../OCN_CLM

vii.

$ mpirun -np 2 ../../../NICAM/bin/mkgisst

5K. Computing reference states
Vertical reference states are used to linearize acoustic and gravity
waves. Reference states can be computed and stored as follows.

L.

i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/refstateii.

$ ../../NICAM/bin/mkbsstate

Computing reference states
Now, you can finally run a NICAM main program! It took quite asometime to get here. Well, only two commands are needed here.
i.

$ cd /data1/(your account)/reg_nicam_gl05_rl00/runii.

$ mpirun -np 2 ../../NICAM/bin/nhm_driver

Wait for a while until the NICAM program has been finished. (Yourexecution is limited to a very short period because of weak machine
power of “nicamgate”. We are sorry about that.)
M. Converting data to latitude-longitude grid
Because the structure of the icosahedral grid is a little bit weird, itwould be easier to analyze data on latitude-longitude grid. To do so, weneed to convert NICAN output data to latitude-longitude grid.
i.

$ cd checkii.

$ ../../../NICAM/bin/ico2ll

Data analysis using a graphic tool “GrADS” is one of the topics of thetomorrow lecture.

END
Thank you for your cooperation.

Acknowledgement
I thank Dr. Uchida for significantly improving English of thisdocument.

6