tutorial_reg
DOWNLOAD
Please download the data HERE (current for regional simulation only)
Change Log
ver 2007/12/21 M.Satoh NICAM tutorail seminar @CCSR
ver 2009/07/22 M.Satoh NICAM english version
ver 2009/08/02 M.Hara LSM:MATSIRO and initial condition:NCEP FNL data
ver 2009/08/19 C.Kodama regional NICAM -> global NICAM
ver 2009/08/** C.Kodama add split grid (merge M.Hara's tutorial)
ver 2009/09/11 C.Kodama revise for higher rlevel/glevel
ver 2010/04/05 M. Hara reformated for wiki
Case Study
- Initial condition:
- 00UTC 1. June 2004 NCEP Final Analysis
- Boundary condition:
- 1-deg, weekly Reynolds SST/ICE
- Resolution:
- glevel-5, 40 vertical layers (nicam_gl05_rl00.tar.gz)
- glevel-10, 40 vertical layers (nicam_gl10_rl05.tar.gz)
Note: mod_adm.f90 PRC_ -> 10240
'''Caution: NICAM is still under construction and it may have some bugs.'''
A. Preparing NICAM source code
A. 1 Extraction of test-run kit
You can choice any directory to extract testrun kit
% mkdir ~/test/ % cd test
(on Linux)
% tar xvzf nicam_src_????????.tar.gz % tar xvzf NICAM_DATABASE-????????.tar.gz % tar xvzf NICAM_DATABASE_global-????????.tar.gz % tar xvzf dataset.tar.gz % tar xvzf nicam_gl05_rl00.tar.gz ##(for glevel-05) % tar xvzf nicam_gl10_rl05.tar.gz ##(for glevel-10)
A. 2 Directory Structure in the test/ directory
NICAM_DATABASE (commonly used datasets)
|-- amip2o3_bin.dat (ozone)
|-- hgrid (horizontal grid)
|-- _hgrid (horizontal grid before mkgcgrid)
|-- radpara (parameter tables for radiation scheme)
|-- rawdata (binary data for land surface and ocean models)
|-- refstate (reference state of atmosphere)
|-- sfcdata (topography for gl05-10 / land data for gl05 )
dataset (original data, e.g. analysis/reanalysis dataset)
|-- fnl (NCEP Final Analysis)
|- iosst_v2 (Reynolds SST)
nicam_gl05_rl00 or nicam_gl10_rl05
|-- external_data (boundary conditions)
| |-- MATSIRO (input data for MATSIRO, ex. orography, vegetation, albedo, lai, soil)
| | `-- check (visualize output data of MATSIRO)
| |-- O3 (3D ozone data)
| | `-- check (visualize output data of O3)
| `-- OCN (ocean data)
| `-- check (visualize output data of OCN)
|-- grid (grid setup)
| |-- hgrid (horizontal grid)
| |-- llmap (table for converting ICO grid to lat-lon grid)
| `-- vgrid (vertical grid)
|-- initial_data (initial conditions)
| |-- ATM (initial data for atmosphere)
| | `-- check (visualize output data of ATM)
| |-- LND (initial data for land)
| | `-- check (visualize output data of LND)
| `-- OCN (initial data for ocean)
| `-- check (visualize output data of OCN)
|-- local (special programs for preperation)
| |-- bin
| `-- src
|-- mnginfo (managing information for regions and processes)
`-- run (directory for NICAM simulation)
NICAM (NICAM source code)
A. 3 Compiling NICAM
A. 3. 1 Configuration of Mkinclude
% cd NICAM/ % ln -s Mkinclude.[your_environment] Mkinclude
If you use NICAM on Linux PC, type as follows:
% ln -s Mkinclude.Linux Mkinclude
Change 'TOPPATH' in Mkinclude. 'TOPPATH' is the directory name which contains the NICAM source code. You can use your favorite editor, e.g., vi, emacs, to edit Mkcinlude.
% vi Mkinclude.[your_environment]
Hereafter, ${TOPPATH} in this tutorial means TOPPATH in Mkinclude
A. 3. 2 Compiling NICAM
% make >& make.log
After compiling, please check ${TOPPATH}/bin.
% ls bin/ CVS/ ico2ll* mkinit_CFMIP_LL* mkllmap* prelai* cnvgfile* ico2ll_omp_mpi* mkinit_aero* mkmnginfo* presoil* cnvlatlon* ico_calc* mkinit_atm* mko3* relmap* cnvlatlon2* ll2grads* mkinit_ecmwf_yotc* mksst* rlev2rlev* cnvlatlon2-2* ll2ico* mkinit_gpvgsm* mkvlayer* rotategrid* cnvlatlon2_merge* mergeobsd* mkinit_gpvgsm2* nhm_driver* showvlayer* cnvvertical* mergetopo* mkinit_lnd* nhm_mkinit* splitgrid* diaggrid* mkchem* mkinit_ncep* nhm_mkrestart* swm_driver* endcnv* mkemit* mkinit_ocn* obsloc2ico* swm_mkinit* grd2ico* mkgcgrid* mkkonedata* offline_driver* transgrid* ico2ico* mkgisst* mklanddata* prealbedo* zonalmean* ico2ico_land* mkgrid* mklanddata2* prebcveget* zonalwave*
On ES2, when running ${TOPPATH}/bin/*, you must set F_RECLUNIT as environment variable:
% setenv F_RECLUNIT BYTE
B. mnginfo
B. 1 Edit mkmnginfo.cnf
% cd ~/test/nicam_gl05_rl00/mnginfo/ % vi mkmnginfo.cnf
&MKMNGINFO_CNF
rlevel = 0, prc_num = 5, output_fname = './data/rl00-prc05.info',
For example, we set "rlevel-0 with 5 processes" above. In mkmnginfo.cnf, " output_fname = 'rl00-prc05.info' " means "rlevel-0 with 5 processes". If you run NICAM with rlevel higher than 0, you must prepare management files for both rlevel 0 and rlevel r (r>0). You'll use rlevel-0 mng file when you increase rlevel.
"prc_num" should be the divisor of the total number of the rombuses. The globe is covered by 10 rhombuses. There are 10 rombuses if rlevel = 0. "prc_num" should be 2, 5, 10. There are 40 rombuses if rlevel = 1. "prc_num" should be 2, 4, 5, 8, 10, 20, 40. There are 160 rombuses if rlevel = 2. "prc_num" should be 2, 4, 5, 8, 10, 20, 40, 80, 160.
B. 2. 3 Run mkmnginfo
% ${TOPPATH}/bin/mkmnginfo
mkmnginfo should be executed serially. This generates "rl00-prc05.info".
% ls data/ rl00-prc05.info
C. Preparing horizontal grid
Horizontal grid files for glevel-5 rlevel-0 are provided in NICAM_DATABASE/hgrid. Skip section C if you use them. Horizontal grid files in any rlevel between glevel 4-10 can be created using rlevel-0 files in NICAM_DATABASE/_hgrid. Follow Section C. Section C is how to make gl10rl05 horizontal grid files.
C. 1 Splitting grid
If you don't need to increase rlevel, skip subsection C.1.
C. 1. 1 Editing "splitgrid.cnf"
% cd ~/test/nicam_gl10_rl05/grid/splitgrid/ % vi splitgrid.cnf
&ADMPARAM glevel = 10, rlevel = 0, vlayer = 1, rgnmngfname='../../mnginfo/data/rl00-prc05.info', (You must prepare it before.) / &GRDPARAM / &SPLITGRIDPARAM input_base = '../../../NICAM_DATABASE/_hgrid/gl10/rl00/grid', output_base = 'data/_grid', alt_rlevel = 5, /
C. 1. 2 Run splitgrid
% mpirun -np 5 ${TOPPATH}/bin/splitgrid
splitgrid must be executed with mpirun This creates "_grid.rgn?????" in "data" directory, which are horizontal grid files BEFORE modification necessary for NICAM run.
C. 2 Create SPRING-gc grid
C. 2. 1 Edit "mkgcgrid.cnf"
% cd ~/test/nicam_gl10_rl05/hgrid/ % vi mkgcgrid.cnf
&ADMPARAM glevel = 10, rlevel = 5, vlayer = 1, rgnmngfname = '../../mnginfo/data/rl05-prc05.info', / &MKGCGRIDPARAM input_base = '../splitgrid/data/_grid', output_base = 'data/grid', /
C. 2. 2 Run
% mpirun -np 5 ${TOPPATH}/bin/mkgcgrid ## mkgcgrid must be executed with mpirun
This creates "grid.rgn?????" in "data" directory, which are horizontal grid files used in NICAM.
D. Lat-Lon Mapping
D. 1 Creating map files.
These files define the relation between icosahedral grids and latitude-longitude grids, and will be used at the postprocess to transform output files into latitude-longitude grid GrADS files.
D. 1. 1 Edit "mkllmap.cnf"
% cd ~/test/nicam_gl05_rl00/grid/llmap % vi mkllmap.cnf
&ADMPARAM glevel = 5, rlevel = 0, vlayer = 1, rgnmngfname = '../../mnginfo/data/rl00-prc05.info', / &LATLONPARAM imax = 144, jmax = 72, / &MKLLMAP_PARAM output_dir = './data/' / &GRDPARAM hgrid_fname = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid' /
imax and jmax are number of lat-lon grid points where icosahedral data will be interpolated. Using above configure file, you can convert any icosahedral data into lat-lon data, -90<=lat<=90 and 0<=lon<=357.5.
D. 1. 2 Run mkllmap
% mpirun -np 5 ${TOPPATH}/bin/mkllmap
mkllmap must be executed with mpirun. It will generate llmap.rgn????? in data/ directory.
E. 1 Generating vertical grid
% cd ~/test/nicam_gl05_rl00/grid/vgrid
E. 1. 1 Prepare vertical levels.
Prepare text files of vertical levels as "vgrid40.txt", which is the standard 40 levels (half-level).
% vi vgrid40.txt
0.000000000000000E+000 161.683000000000 335.958000000000 523.806000000000 726.285000000000 944.534000000000 1179.78100000000 1433.34900000000 1706.66700000000 2001.27200000000 2318.82200000000 2661.10400000000 3030.04500000000 3427.72000000000 3856.36800000000 4318.40000000000 4816.41800000000 5353.22300000000 5931.83700000000 6555.51600000000 7227.76900000000 7952.38000000000 8733.42800000000 9575.30600000000 10482.7530000000 11460.8760000000 12515.1790000000 13651.5960000000 14876.5210000000 16196.8500000000 17620.0100000000 19154.0120000000 20807.4880000000 22589.7440000000 24510.8110000000 26581.4960000000 28813.4570000000 31219.2520000000 33812.4180000000 36607.5550000000 39620.3830000000
E. 1. 2 Edit mkvlayer.cnf
% vi mkvlayer.cnf
&MKVLAYER_CNF num_of_layer = 40, layer_type = 'GIVEN', infname = './vgrid40.txt', outfname = './data/vgrid40.dat', /
E. 1. 3 Run mkvlayer
% ${TOPPATH}/bin/mkvlayer
mkvlayer must be executed "without" mpirun. This generates binary file (vgrid40.dat) in data/ directory.
F. MATSIRO files
All the MATSIRO files necessary for gl05rl00 run are included in the tutorial packages (NICAM_DATABASE). Therefore, skip section F. Section F describes how to create gl10rl05 MATSIRO files.
F. 1 Generating topography files (topog.rgn?????)
If you run NICAM with gl05rl00, gl06rl00, gl07rl01, gl08rl02, gl09rl03, or gl10rl04, skip subsection F.1 and use topography files provided by us. Followings are example of creating gl10rl05 topography files from gl10rl04 topography files provided by us.
% cd ~/test/nicam_gl10_rl05/external_data/MATSIRO
F. 1. 1 Edit cnvrlev.cnf
&ADMPARAM glevel = 10, rlevel = 4, vlayer = 1, rgnmngfname = '../../mnginfo/data/rl04-prc05.info', / &SPLITGRIDPARAM num_data = 1, input_base = '../../../NICAM_DATABASE/sfcdata/gl10/rl04/B/topog2', input_direct = .false., output_base = 'data/topog', output_direct = .false., output_rlevel = 5, /
F. 1. 2 Run cnvrlev
% mpirun -np 5 ${TOPPATH}/bin/cnvrlev
cnvrlev must be executed with mpirun. This generates topog.rgn????? in data/ directory.
F. 2 Generating MATSIRO files
% cd ~/test/nicam_gl05_rl00/external_data/MATSIRO
F. 2. 1 Edit mklanddata2.cnf.1 & mklanddata2.cnf.2
We need to run "mklanddata2" 2 times. See mklanddata2.cnf.? for details
F. 2. 2 First Run
% rm -f mklanddata2.cnf % ln -s mklanddata2.1.cnf mklanddata2.cnf % mpirun -np 5 ${TOPPATH}/bin/mklanddata2
mklanddata2 must be executed with mpirun. Following files will be generated in data/ directory:
albedo_nir.rgn????? albedo_vis.rgn????? gradz.rgn????? slidx.rgn????? topog_not_used.rgn????? ## not used for NICAM run topog_std.rgn????? veget_mat.rgn?????
F. 2. 3 Second Run
% rm -f mklanddata2.cnf % ln -s mklanddata2.2.cnf mklanddata2.cnf % mpirun -np 5 ${TOPPATH}/bin/mklanddata2
This will generate lai_clm_1982-1998.rgn????? in data directory.
G. 1 Generating Ozone Data
% cd ~/test/nicam_gl05_rl00/external_data/O3
G. 1. 1 Edit "mko3.cnf"
&ADMPARAM glevel = 5, rlevel = 0, vlayer = 40, rgnmngfname = '../../mnginfo/data/rl00-prc05.info', / &GRDPARAM hgrid_fname = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid', vgrid_fname = '../../grid/vgrid/data/vgrid40.dat', topo_fname = '../MATSIRO/data/topog', / &MKO3PARAM input_fname = '../../../NICAM_DATABASE/amip2o3_bin.dat', output_base = './data/amip2o3', data_num = 12, / &GMTRPARAM polygon_type = 'ON_SPHERE', /
G. 1. 2 Run mko3
% mpirun -np 5 ${TOPPATH}/bin/mko3
mko3 must be executed with mpirun. This generates amip2o3.rgn????? in data/ directory
H. Ocean Condition (for nudging slab ocean)
% cd ~/test/nicam_gl05_rl00/external_data/OCN
H. 1 Edit "mkgisst.cnf.1" to create SST
&ADMPARAM glevel = 5, rlevel = 0, vlayer = 1, rgnmngfname = '../../mnginfo/data/rl00-prc05.info', / &GRDPARAM hgrid_fname = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid', vgrid_fname = '../../grid/vgrid/data/vgrid40.dat', topo_fname = '../MATSIRO/data/topog', / &MKGISSTPARAM sst_lldata_fname = '../../../dataset/oisst_v2/sst.grd', output_sst_base = './data/sst', num_data = 16, data_periodic = .false., imax = 360, jmax = 180, slat = 89.5, slon = 0.5, dlat = 1.0, dlon = 1.0, opt_southward = .false., direct_access = .true., / &GMTRPARAM polygon_type = 'ON_SPHERE', /
- num_data: number of time step. e.g. num_data=31 if daily SST in January
- imax, jmax: number of grid points in longitude/latitude direction
- slat, slon: start latitude/longitude
- dlat, dlon: grid interval in latitude/longitude direction
- Each date is specified in nhm_driver.cnf (section J)
H. 1. 2 Run mkgisst
% ln -s mkgisst.cnf.1 mkgisst.cnf % mpirun -np 5 ${TOPPATH}/bin/mkgisst % rm mkgisst.cnf
mkgisst must be executed with mpirun. This generates "sst.rgn????? in data/ directory.
H. 2 Edit "mkgisst.cnf.2" to create climatological sea ice mass
&ADMPARAM glevel = 5, rlevel = 0, vlayer = 1, rgnmngfname = '../../mnginfo/data/rl00-prc05.info', / &GRDPARAM hgrid_fname = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid', vgrid_fname = '../../grid/vgrid/data/vgrid40.dat', topo_fname = '../MATSIRO/data/topog', / &MKGISSTPARAM sst_lldata_fname = '../../../NICAM_DATABASE/rawdata/hadsst1979-1999_clm.dat', ice_lldata_fname = '../../../NICAM_DATABASE/rawdata/cmip3sit1979-1999_clm.dat', snw_lldata_fname = '../../../NICAM_DATABASE/rawdata/cmip3snw1979-1999_clm.dat', output_sst_base = './data/hadsst1979-1999_clm', output_ice_base = './data/cmip3ice1979-1999_clm', output_snw_base = './data/cmip3snw1979-1999_clm', num_data = 12, data_periodic = .false., direct_access = .true., offset = 0.0, ice_fact = 1000.0, /
H. 2. 2 Run mkgisst
% ln -s mkgisst.cnf.2 mkgisst.cnf % mpirun -np 5 ${TOPPATH}/bin/mkgisst % rm mkgisst.cnf
mkgisst must be executed with mpirun. This generates "cmip3ice1979-1999.rgn?????" in data/ directory.
I. 2. 3 Run mkinit_atm
% ${TOPPATH}/bin/mkinit_atm
mkinit_atm must be executed "without" mpirun. This generates "restart_atm.rgn?????"
I. 2. 4 Check (if necessary)
% cd check % ${TOPPATH}/bin/ico2ll
open init_atm.ctl using GrADS and check!
I. 3 Generating initial condition of the ocean
I. 3. 1 convert ocean data into NICAM input data format
% cd ~/test/nicam_gl05_rl00/initial_data % sh mk_ocn.sh ../../dataset/fnl/fnl_20040601_00_00
This scripts generates "ocn.dat". Check ocn.ctl by GrADS.
I. 3. 2 convert ocean data
% cd OCN % vi mkinit_ocn.cnf
&NM_MKINIT_OCN glevel = 5, rlevel = 0, hgrid_basename = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid', veget_basename = '../../../NICAM_DATABASE/sfcdata/gl05/rl00/matsiro/veget_mat', latlon_ocean_fname = 'ocn.dat', fpath_in = '..', fpath_out = '.', init_basename = 'init_ocn', /
I. 3. 3 Run mkinit_ocn
% ${TOPPATH}/bin/mkinit_ocn
mkinit_ocn must be executed "without" mpirun. This generates "restart_ocn.rgn?????"
I. 3. 4. Check
% cd check % ${TOPPATH}/bin/ico2ll
You can open init_ocn.ctl using GrADS.
I. 4 Generating land data
I. 4. 1 convert land data into NICAM input data format
By default, mk_lnd.sh is for grib1 data of NCEP Final Analysis (1999.07.30-). If you use grib2 data (2007.12.06-), comment out lines of "# for grib1" and comment in those of "# for grib2"
% cd ~/test/nicam_gl05_rl00/initial_data % sh mk_lnd.sh ../../dataset/fnl/fnl_20040601_00_00
This scripts generates "lnd.dat".
I. 4. 2 convert land data
% cd LND % vi mkinit_lnd.cnf
&NM_LAND_GRID glevel = 5, rlevel = 0, hgrid_basename = '../../../NICAM_DATABASE/hgrid/gl05/rl00/grid', / &NM_MKINIT_LND opt_ncep2mat = .true., merged_rst_in = .true., fpath_out = './', fpath_in = '../', ncep_sfc_filename = 'lnd.dat', merged_output_restfname(2) = 'init_lnd', opt_albsfc_in = .false., opt_albsfc_out = .true., / &NM_LAND_INIT /
I. 4. 3 Run mkinit_lnd
% ${TOPPATH}/bin/mkinit_lnd
mkinit_lnd must be executed "without" mpirun. This generates "restart_lnd.rgn?????".
I. 4. 4 Check
% cd check % ${TOPPATH}/bin/ico2ll
J. 1 Start NICAM!
J. 1. 1 Edit "nhm_driver.cnf"
% cd ~/test/nicam_gl05_rl00/run/output_01-03dy % vi nhm_driver.cnf
See nhm_driver.cnf for details.
If you want to change integration time, modify LSTEP_MAX in &TIMEPARAM. If you use daily SST data, change &nm_extdata, for example,
&nm_extdata dataname = 'SST', fname = '../../external_data/OCN/data/sst', num_of_data = 7, data_date(:,1) = 2004, 6,01,0,0,0, data_date(:,2) = 2004, 6,02,0,0,0, data_date(:,3) = 2004, 6,03,0,0,0, data_date(:,4) = 2004, 6,04,0,0,0, data_date(:,5) = 2004, 6,05,0,0,0, data_date(:,6) = 2004, 6,06,0,0,0, data_date(:,7) = 2004, 6,07,0,0,0, layer_type = 'SFC', opt_periodic_year = .false., /
(num_of_data should be less <= 1280)
J. 1. 2 Run nhm_driver (NICAM)
% mpirun -np 5 ${TOPPATH}/bin/nhm_driver
Check "msg.rgn*****" for whether integration is successfully finished.
J. 1. 3 Output File Description
- restart.rgn????? : restart file of the atmosphere
- restart_ocn.rgn????? : restart file of the ocean
- restart_lnd.rgn????? : restart file of the land
- restart_diagvar.rgn????? : restart file
- [varname].rgn????? : output in icosahedral grid
- history.info : output file information
Output files below are not used in the current NICAM
- restart_ALB_SFC.rgn?????
- restart_ALB_SFC.pl
- restart_CBMFX.rgn?????
J. 1. 4 Move Files
% rm restart_ALB_SFC* restart_CBMFX* % mv restart.* restart_* restart/ % mv *rgn* icodata/
K. 1 post process - ico2ll
ico2ll converts output in icosahedral grid to lat-lon grid for GrADS.
K. 1. 1 Edit "ico2ll.cnf"
% vi ico2ll.cnf
&ico2ll_param glevel = 5, rlevel = 0, input_dir = './icodata/', output_dir = './lldata/' info_fname = 'history.info', llmap_dir = '../../grid/llmap/data/' llmap_base = 'llmap', lon_swap = .true., input_size = 4, init_year = 2004, init_month = 6, init_day = 1, /
set start time. history.info and llmap are used by ico2ll.
J. 1. 2 Run ico2ll
% ${TOPPATH}/bin/ico2ll
This generates "*.ctl *.grd" in lldata/ directory.
L. Combine control files for GrADS (if necessary)
% cd ../ctl % vi ctl_gen.sh (edit DAY_LIST) % ./ctl_gen.sh
You can access everytime data from control files here.
Appendix. Input data for NICAM (tentative)
1. 1 topography data
- USGS GTOPO30
- Resolution: 30 arc sec. (approximately 1km)
- URL: http://edc.usgs.gov/products/elevation/gtopo30/gtopo30.html
Original GTOPO30 data is devided into several blocks. We must combine the block files into one file.
1. 2 vegetation data
- USGS GLCC Simple Biosphere 2 Model (GSiB22)
- Resolution: 30 arc sec. (approximately 1km)
- URL: http://edcftp.cr.usgs.gov/pub/data/glcc/globdoc2_0.html
Other Information
If you need other information, please check the previous version of NICAM tutorial
Keyword(s):
References: