# Presentation: 033960

## Slide 1

## CHAPTER 1

- Getting Started

## TOPICS

- INTRODUCTION
- Requirements
- Where to obtain MM5 source code ?
- Where to find data to run MM5 ?
- Conventions used in MM5 system
- MM5 Home Page

- INSTALLATION OF SOFTWARE
-    TERRAIN
-    REGRID
-    INTERPF
-     MM5
- Visualization
-   MM5toGrADS

## Requirements

- The code is portable
- The entire modeling system software can be run on most vendor’s computers
-      - Computers running Linux
-      - Unix workstations
-      -  Mainframes

## Requirements

- The code has been ported to
-   -DEC-Alpha
-   -SGI,SUN,IBM,HP
-   -PC’s running Linux
-   -Cray
-   -Fujitsu,NEC
- The code does not run on PC’s running Windows

## Requirements

- MM5 model and its preprocessing software are written in Fortran
-   - Older programs are in Fortran 77
-   - Newer programs are in Fortran 90
-   - A few utility routines are in C

## Requirements

- Must-have
-     Fortran 90 and 77 compiler
-     C compiler
-      For Linux :
-          -Fortran and C compilers from Portland
-           Group
-         -Extra library libf2c.a (ftp.ucar.edu/mesouser/MM5V3/Test/libf2c.a)

## Requirements

- Optional
-     - NCAR Graphics (free), _[http://ngwww.ucar.edu](http://ngwww.ucar.edu/)_
-     - MPI tools for running MPI MM5 model
- Hardware :
-     -0.5 Gb or more memory
-     - a few Gb disk space

## Conventions used in MM5

- Time
-     All times are in UTCs
- Array indices
-    Indices I,J & K -   I is in y direction, J in x direction and K in Z direction
- All gridded wind components (U and V) are with respect to model coordinate

## MM5 Home Page

- _[http://www.mmm.ucar.edu/mm5/mm5v3](http://www.mmm.ucar.edu/mm5/mm5v3)_

## File Format Types

-  ASCII
-  Binary
-  NetCDF
-  HDF

## ASCII File Formats

- ASCII means a text file ; Files can be read with a text editor
- Files are platform independent
- Data must be formatted
- Files are bulky

## Binary File Formats

- A very compact way to store data; files can be half as large when stored as binary versus ascii
- No need to format data
- Cannot look at the files
- Different computers use different binary formats (big endian,little endian)

## Universal File FormatsNetCDF, HDF, GRIB

- Files are machine independent; So issues like endianess don’t matter.  A file written on one machine can be read by another...with the right tools
- Data sets are “self-describing”
- Tools are provided to both read and write data
- Cannot see the data easily

## GRIB Format

- WMO format for gridded data
- Fields are “self-describing”
- Files are typically 1⁄2 to 1/3 of the size of normal binary files
- An open, international standard

## GRIB Decoders

- Wgrib is one of many decoders.  Output from wgrib can then be read by fortran, or C
- Gempack, IDL and GrADS can directly or indirectly display GRIB data
- GrADS is a very powerful, freely available software
- GrADS control file can be written using the grib2ctl.pl

## Where to obtain TAR files?

- NCAR’s anonymous ftp site:
-    _[ftp://ftp.ucar.edu/mesouser/MM5V3](ftp://ftp.ucar.edu/mesouser/MM5V3)_
- On any computer at the ftp prompt, Type
- ftp     _[ftp.ucar.edu](ftp://ftp.ucar.edu/)_
- Name: anonymous
- Password: your email address
-   cd mesouser/MM5V3
-    binary
-    get MM5.TAR.gz
-    quit

## What is in a tar file ?

- A tar file contains the following:
- README: instructions on how to compile and run
- CHANGES: description of changes
- Makefile: top-level makefile for creating executable
- Templates/: directory with job deck & script
- src/: source directory (MM5 has several dirs.)

## How to run the MM5 programs:

- FORTRAN 90 programs
-    - make (compile)
-    - edit namelist.input OR edit script
-    - run the executable
- FORTRAN 77 programs
-    - make x.deck
-    - edit x.deck
-    - ./x.deck (compile & run)

## Functions of a job deck/script

- Help setup and run programs
- Assume source code to be local
- Control how and where to get input data
- Job switches
- Parameter statements
- Fortran namelists (runtime options)

## TERRAIN

- Tasks of TERRAIN
-     - setup the mesoscale domains; coarse and fine grids
-      -  Produce the terrestrial data files for all of the mesoscale domains, which will first be used by REGRID and then by MM5
-     - also computes a few constant fields; latitude and     longitude, map scale factors and coriolis parameter

## Overview of TERRAIN

- Source data input
- Interpolation from lat/lon source data to mesoscale grid
- Nest interface adjustment and feed back
- Output terrain elevation, land use and other terrestrial data in MM5 format

## Data Format

- Latitude by latitude from north to south in one latitude, the data points are arranged from west to east
- Data files are direct-access

## How to run TERRAIN

- Gunzip TERRAIN.TAR.gz
- tar xvf TERRAIN.TAR
- Make terrain.deck – A cshell script, terrain.deck is created
- Edit terrain.deck
- -Shell variables: ftp, where30sTer, users
- -IIMX and JJMX in parame.incl are used to declare the arrays holding the mesoscale gridded data
- -ITRH,JTRH are used to declare the arrays holding the source lat/lon data

## How to run TERRAIN

- Run terrain.deck by typing “terrain.deck”
- Check your output
- log file from compilation: make.terrain.out
- A plot file, TER.PLT if NCAR graphics is used
- Binary files, TERRAIN_DOMAIN1, TERRAIN_DOMAIN2
- -  Printout file from the execution-terrain.print.out

## REGRID

- Purpose : To read archived meteorological analyses on pressure levels and interpolate those analyses from some native grid and map projection to the grid and map projection defined by the MM5 preprocessor program TERRAIN

## REGRID (contd.)

- Consists of two main components
- Data input (i.e. reading the original meteorological analyses).  Handled by the program called “pregrid”
- Interpolation to MM5 grid.  Handled by the program “regridder”
- Communication between the components is accomplished via intermediate files

## REGRID(contd.)

## REGRID(contd.)Input to pregrid

- Expects files of meteorological analyses
- Can read GRIB and non-GRIB data sets
- GRIB datasets expect Vtables-which tell what fields to access from the input files
- A fortran namelist file-pregrid.namelist-passes user-specified options to pregrid

## REGRID(contd.)Input to pregrid

- Multiple data time periods are required-this is because the model not only requires initial condition to start but also needs lateral boundary conditions to carry on integration

## REGRID(contd.)

- Where to get analysis data?
- Your local weather service may have
- Real-time data from NCEP
- Reanalysis data
- _[http://dss.ucar.edu/datasets/ds090.0/data/pgbf00-grb2d/](http://dss.ucar.edu/datasets/ds090.0/data/pgbf00-grb2d/)__ _

## REGRID(contd.)Pregrid VTables

- Easy to use GRIB data sets
- GRIB format describes each field by several code numbers
- First 4 columns of the Vtable represent the GRIB method of identifying fields; the last 3 columns represent the MM5 method of identifying fields

## REGRID(contd.)

**GRIB | Level| Level| Level| REGRID   |  REGRID  | REGRID                                   **
**Code | Code |   1  |   2  | Name     |  Units   | Description                                 |**
**-----+------+------+------+----------+----------+---------------------------------------------+**
** ****11  | 100  |   *  |      | T        | K        | Temperature                                 |**
** ****33  | 100  |   *  |      | U        | m s{-1}  | U                                           |**
** ****34  | 100  |   *  |      | V        | m s{-1}  | V                                           |**
** ****52  | 100  |   *  |      | RH       | %        | Relative Humidity                           |**
**  ****7  | 100  |   *  |      | HGT      | m        | Height                                      |**
** ****11  | 105  |   2  |      | T        | K        | Temperature                                 | At 2 m**
** ****33  | 105  |  10  |      | U        | m s{-1}  | U                                           | At 10 m**
** ****34  | 105  |  10  |      | V        | m s{-1}  | V                                           | At 10 m**
** ****51  | 105  |   2  |      | SPECHUMD | kg kg{-1}|                                             | At 2 m**
** ****2   | 102  |   0  |      | PMSL     | Pa       | Sea-level Pressure                          |**
** ****1   |  1   |   0  |      | PSFC     | Pa       |                                             |**
**-----+------+------+------+----------+----------+---------------------------------------------+**

## REGRID(contd.)Input to regridder

- Output files from pregrid--fields of temperature, horizontal wind components, relative humidity, height of pressure levels, sea-level pressure, sea-surface temperature & snow-cover data
- Other fields may be used as well
- Output from TERRAIN-finds terrain, land-use and map data
- Regrid.namelist with user-specified options

## REGRID(contd.)How to run REGRID

- Gunzip regrid.tar.gz
- Tar xvf regrid.tar; creates a top level directory called REGRID
- Cd REGRID
- Make
- Cp analysis files into REGRID/data
- Untar data files (tar xvf A22063-0308.pgb.f00.tar; tar xvf A22066-0308.grb2d.tar)

## REGRID(contd.)REGRID/data

- grb2d03080100
- grb2d03080106
- grb2d03080112
- grb2d03080118
- grb2d03080200
- grb2d03080206
- grb2d03080212
- grb2d03080218
- grb2d03080300
- grb2d03080306
- grb2d03080312
- grb2d03080318
- grb2d03080400

- pgb.f0003080100
- pgb.f0003080106
- pgb.f0003080112
- pgb.f0003080118
- pgb.f0003080200
- pgb.f0003080206
- pgb.f0003080212
- pgb.f0003080218
- pgb.f0003080300
- pgb.f0003080306
- pgb.f0003080312

## REGRID(contd.)REGRID/data

- wgrib -V pgb.f0003080100 | more
- rec 1:4:date 2003080100 HGT kpds5=7 kpds6=100 kpds7=1000 levels=(3,232) grid=2 1000
-  mb anl:
-   HGT=Geopotential height [gpm]
-   timerange 10 P1 0 P2 0 TimeU 1  nx 144 ny 73 GDS grid 0 num_in_ave 0 missing 0
-   center 7 subcenter 1 process 180 Table 2
-   latlon: lat  90.000000 to -90.000000 by 2.500000  nxny 10512
-           long 0.000000 to -2.500000 by 2.500000, (144 x 73) scan 0 mode 128 bdsgri
- d 1
-   min/max data -468 589  num bits 11  BDS_Ref -468  DecScale 0 BinScale 0

## REGRID(contd.)

- #  Tell the pregrid programs which Vtables to use.  Do this only
- #  if you have selected GRIB-formatted input using SRC___ = GRIB above.
- #  The directories referenced here are relative to REGRID/pregrid/.
- #
- #  The Vtable files specified in VT3D will be applied to the files
- #  specified in the InFiles variable.  Similarly, the Vtable files
- #  specified in VTSST, VTSNOW, and VTSOIL will be applied to the files
- #  listed above in InSST, InSNOW, and InSoil, respectively.
- #
-    set VT3D = ( grib.misc/Vtable.NNRP3D )
-    set VTSST = ( grib.misc/Vtable.NNRPSST )
-    set VTSNOW = ( grib.misc/Vtable.NNRPSNOW )
-    set VTSOIL = ( grib.misc/Vtable.NNRPSOIL )

## REGRID(contd.)

- Chmod u+x pregrid.csh
- ./pregrid.csh
- Check your output; make sure files are created for every time between your starting and ending dates
- -rw-r--r--  1 sriki ghcc 3631264 Jul 29 15:51 FILE:2003-08-01_00
- -rw-r--r--  1 sriki ghcc 3920736 Jul 29 15:51 FILE:2003-08-01_06

## REGRID(contd.)

- SNOW_FILE:2003-08-01_06
- SNOW_FILE:2003-08-01_12
-  SOIL_FILE:2003-08-01_00
- SOIL_FILE:2003-08-01_06
- SST_FILE:2003-08-01_06
- SST_FILE:2003-08-01_12

## REGRID(contd.)

- Cd regridder
- Edit namelist.input
- &record1
-  start_year                      =  2003
-  start_month                     =    08
-  start_day                       =    01
-  start_hour                      =    06
-  end_year                        =  2003
-  end_month                       =    08
-  end_day                         =    31
-  end_hour                        =    00
-  interval                        = 43200 /

## REGRID(contd.)

- Run regridder
- Creates output file
-   REGRID_DOMAIN1
- Edit namelist.input; change TERRAIN_DOMAIN1 to TERRAIN_DOMAIN2; Run regridder
- Output for Domain2 is created
-   REGRID_DOMAIN2

## INTERPF

- Takes output of REGRID as input
- Does vertical interpolation, diagnostic computation and data reformatting
- Outputs model initial, lateral boundary condition and lower boundary condition

## INTERPF(contd.)

- Gunzip INTERPF.TAR.gz
- Tar xvf INTERPF.TAR; creates INTERPF sub-directory
- Cd INTERPF
- Type “make” to create an executable
- Edit namelist.input

## INTERPF(contd.)

- &record0
-  input_file     = '/data5/fitz/jay/REGRID/regridder/REGRID_DOMAIN1' /   ! pressure-
- level data file name
- &record1
-  start_year     =  2003                              ! The starting and
-  start_month    =    08                              ! ending dates to
-  start_day      =    01                              ! process
-  start_hour     =    06
-  end_year       =  2003
-  end_month      =    08
-  end_day        =    31
-  end_hour       =    00
-  interval       = 43200                              ! time difference (s)
-  less_than_24h  = .FALSE. /                          ! if input is less than 24 h

## INTERPF(contd.)

- Run the executable  ./interpf for domain 1 & domain 2
- Output files :
- BDYOUT_DOMAIN1
- BDYOUT_DOMAIN2
- LOWBDY_DOMAIN1
- LOWBDY_DOMAIN2
- MMINPUT_DOMAIN1
- MMINPUT_DOMAIN2

## MM5

- This is the numerical weather prediction of the modeling system
- Gunzip MM5.TAR.gz; tar xvf MM5.TAR
- Creates a subdirectory called MM5
- Cd MM5

## MM5(contd.)

- Type “make”
- Edit mm5.deck
- NESTIX =  98,  103,  136,  181,  211,  221
-  NESTJX =  150, 151,  181,  196,  211,  221
-  NESTI  =   1,   34,   28,   35,   45,  50,
-  NESTJ  =   1,   52,   25,   65,   55,  50,
-  XSTNES =   0.,  0.,900.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-  XENNES =99999.,99999.,99999.,720.,720.,720.,720.,720.,720.,720.
-  IOVERW =   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,

## MM5(contd.)

- ;      ************* FORECAST TIME AND TIME STEP ******************
-  ;
-  TIMAX  = 360.,         ; forecast length in minutes
-  TISTEP = 150.,         ; coarse domain DT in model, use 3*DX

## MM5(contd.)

- Cd to MM5/Run
- Input files are expected in this directory
- BDYOUT_DOMAIN1 -> ../../INTERPF/BDYOUT_DOMAIN1
- BDYOUT_DOMAIN2 -> ../../INTERPF/BDYOUT_DOMAIN2
- LOWBDY_DOMAIN1 -> ../../INTERPF/LOWBDY_DOMAIN1
- LOWBDY_DOMAIN2 -> ../../INTERPF/LOWBDY_DOMAIN2
- MMINPUT_DOMAIN1 -> ../../INTERPF/MMINPUT_DOMAIN1
-  MMINPUT_DOMAIN2 -> ../../INTERPF/MMINPUT_DOMAIN2

## MM5(contd.)

- Run mm5 - ./mm5.deck
- Check “mm5.print.out” file to see if all domains are correctly inititated and if the physics options are correctly specified
- STOP 99999 print statement indicates that MM5 completed without crashing
- Binary Output Files : MMOUT_DOMAIN1, MMOUT_DOMAIN2

## MM5toGrADS

- GrADS home page http://grads.iges.org
- Gunzip MM5toGrADS.TAR.gz
- Untar; tar xvf MM5toGrADS.TAR
- Cd to MM5toGrADS
- Make the executable “make”
- Edit the namelist.input file

## MM5toGrADS

- Edit mm5_to_grads.csh script
- set infilename = "/data5/fitz/jay/MM5/Run/MMOUT_DOMAIN1"
- set outfilename = "test1"
- Run ./mm5_to_grads.csh

## MM5toGrADS

- Graphical output is in “test1.dat” for domain1; control file is in “test1.ctl”
- Edit mm5_to_grads.csh for domain 2 and execute.  Output files will be created for domain2
- Go into grads and open the control file to view the plots

## Utilities

- Tovis5d
- Vis5D version 5.2 is available at _[ftp://ftp.ssec.wisc.edu/pub/vis5d-5.2](ftp://ftp.ssec.wisc.edu/pub/vis5d-5.2)_

## Input Data

- Mesouser provides six-resolution terrestrial datasets including:
-    - elevation
-    -Landuse/vegetation
-    -Land-water mask
- If you want to use the land-surface model option in MM5:
-    -soil types
-    -vegetation fraction
-     -deep soil temperature