# Presentation: 330600

## Setting Up and Running the WRF Standard Initialization

- John Smart
- NOAA / Forecast Systems Laboratory
- June 27, 2002

## Overview

- Required Files
- System Requirements
- Installing the Software
- Configuring Domains
- Configuring Interpolation
- Running
- Initializing the WRF Model
- Summary

## Required Files

- WRFSI.TAR.gz
- Static Geographical Data (large ones in quartersphere files)
-      Geog_Data:
- Topo_30s: 1) topo_30s_SW.tar.gz, 2) _SE.tar.gz,  3) _NW.tar.gz      4) _NE.tar.gz
- Landuse_30s: landuse_30s_NW.tar.gz, 2) _SE.tar.gz, 3 _NW.tar.gz, 4) _NE.tar.gz.
- Green fraction: greenfrac/greenfrac.tar.gz
- Soiltemp: soiltemp_1deg/TGLOBAL.tar.gz
- Soiltype (top layer): soiltype_bot_30s (NW, NE, SW, SE)
- Soiltype (bottom layer): soiltype_bot_30s (NW, NE, SW, SE)
- Albedo: albedo_ncep: albedo.tar.gz
- Available for download
- http://www.wrf-model.org (Officially released versions)
- ftp://ftp.fsl.noaa.gov/pub/frd-laps (Latest version, not necessarily officially released) ... currently wrfsi_20020328.tar.gz

## System Requirements

- Unix or Linux OS
- Routinely built on IBM AIX, Intel-Linux, Alpha-Linux at FSL
- NCAR has built on Alpha-True64 and SGI-IRIX
- Ported to solaris (currently testing)
- FORTRAN 90 Compiler
- C Compiler (gcc is preferred)
- netCDF Libaries
- Perl
- make Utility

## System Requirements

- Disk Requirements
- Recommended Minimum Total Space: 10 GB
- Approx. 10 MB for source code and executables
- Approx. 6 GB for global static fields
- 1-10 GB for each MOAD_DATAROOT
- Depends on domain size, run length, etc.
- NCAR 30km national domain requires approx. 1 GB to contain necessary files for a 48-hour forecast period with 3-hourly boundary conditions
- 2-4 GB for "typical" EXT_DATAROOT
- 48 hours of AVN 1 deg  and ETA 40 km grids with hourly output

## Installing the Software

- Installation Overview
- Set up directories and environment variables
- Check compiler options for your system
- Run the installation script
- Check for successful installation

## Installing the Software

- Set up directories and environment variables
- Source root
- Typically set to top directory of extracted WRFSI.TAR file
- Set the SRCROOT environment variable
- Installation root
- Where executables will be installed
- Can be same as SRCROOT if desired
- Set INSTALLROOT environment variable
- Domain data root
- Top level directory where domain specific data will be kept
- Set MOAD_DATAROOT environment variable
- netCDF Path (NETCDF environment variable)
- Determine fully qualified Perl executable (e.g., /usr/bin/perl)

## Installing the Software

- Check Compiler Settings
- Check $SRCROOT/src/include directory for the existence of a file named "makefile_{MACH}.inc.in where {MACH} is the type of machine on which you are building
- If one exists, check the various compiler options and flag settings
- If one does not exist, copy one of the existing ones to a new name using your machine name and edit the compiler settings

## Installing the Software

- Run the installation script
- $SRCROOT/install_wrfsi.pl
- Example:
- /usr/bin/perl install_wrfsi.pl --installroot=$INSTALLROOT              -- srcroot=$SRCROOT --dataroot=$DATAROOT                        --path_to_netcdf=$NETCDF --machine=MACH                          -- path_to_perl=/usr/bin/perl
- MACH = the machine type corresponding to the makefile_{MACH}.inc.in file
- NOTE: In the latest version (not yet officially released), the arguments will be optional provided the environment variables are set correctly.

## Installing the Software

- Create an EXTDATAROOT
- Location for grib_prep output (allow at least 2 GB)
- Path will be set in wrfsi.nl as well
- Contains various subdirectories that will get created the first time wrfsi.pl is run:
- extprd
- log
- work

## Installing the Software

- Checking for successful installation
- Check $INSTALLROOT/bin for executables:
- grib_prep.exe
- gridgen_model.exe
- hinterp.exe
- vinterp.exe
- Check $INSTALLROOT/etc for scripts:
- wrfsi.pl
- grib_prep.pl
- interp.pl
- If any executables are missing, you can go to $SRCROOT/src and find subdirectories for each executable. From there you can try to make each one manually and observe the errors
- PLEASE REPORT ANY PROBLEMS AND THEIR CORRECTIVE ACTIONS!

## Configuring Domains

- Overview
- Using repository version of wrfsi.nl as domain namelist subset.
- Editing SRCROOT/domains/’domain_name’/wrfsi.nl to your liking
- Set the horizontal domain specifications
- Running localization perl script INSTALLROOT/etc/window_domain_rt.pl
- Checking for a successful localization

## Configuring Domains

- Use SRCROOT/data/static/wrfsi.nl to make a domain namelist subsets for grid specification.
- Edit SRCROOT/data/static/wrfsi.nl
- Replace namelist section “sfcfiles” with the paths to your geog data
- Eg., replace
- Topo_30s = /data/lapb/geog/world_topo_30s  with
- Topo_30s = /your/path/to/geog/data/geog/world_topo_30s
- Create SRCROOT/domains/”domain_name”
- “mkdir SRCROOT/domains/’domain_name’”
- each domain you configure gets a new domain_name under subdirectory “domains”.
- Copy repository file “wrfsi.nl” to the domains/”domain_name” subdirectory
-  “cp SRCROOT/data/static/wrfsi.nl SRCROOT/domains/”domain_name/. “

## Configuring Domains

- Edit SRCROOT/domains/”domain_name”/wrfsi.nl
- project_id section (simulation_name and user_desc)
- hgridspec section (sets up horizontal domain)
- xdim = dimension in E-W direction
- ydim = dimension in N-S direction
- map_proj_name = 'lambert', 'mercator', or 'polar'
- moad_known_lat = center latitude (+ N)
- moad_known_lon = center longitude (+ E)
- moad_stand_lats = true latitude1 (lambert and polar), true latitude for lambert (set to +/- 90 for polar)
- moad_stand_lon = orientation longitude
- moad_delta_x = grid spacing in meters in x-direction
- moad_delta_y = grid spacing in meters in y-direction
- Recommend leaving all other settings at their default values
- Remove all namelist sections/variables that will not be different from the SRCROOT version of wrfsi.nl

## Configuring Domains

- Running  localization perl script “window_domain_rt.pl”
- Ensure your environment variables are properly set
- Run INSTALLROOT/window_domain_rt.pl
- Required:
-  -t  = path to domain subset subdirectory; for example, SRCROOT/domains/”domain_name”
- -w = the system you are localizing (always use –w wrfsi)
- Optional:
- “-s”, “-i”, and “-d” switches override the environment variables if necessary
- “-c”  reconfigures the entire MOAD_DATAROOT; ie., removes silog, siprd, static, and cdl.  Without –c, only static and cdl are rewritten.
- Example command line:
- Perl window_domain_rt.pl –tSRCROOT/domains/”domain_name” –w wrfsi

## Configuring Domains

- Checking for a successful localization
- The “window” script will issue one of the following:
-     success:
-                  “window_domain_rt complete”
-     failure:
-          “Lines with error found in localize_domain.log”
-          “ localization incomplete ”
-          “window_domain_rt incomplete”
- Window output (text information) is in MOAD_DATAROOT/silog/localize_domain.log

## Configuring Domains

- Checking for success
-      Common Error conditions:
- Geog paths not properly set
- Not enough geog tiles to cover you domain (especially true if you only got one or two of the quarterspheres tar files)
- Other settings in wrfsi.nl not properly set. Note that “window” saves the static subdirectory (static_err) in the event of an error (you can check it)
- Check for existence of static file:
- $MOAD_DATAROOT/static/static.wrfsi
- netCDF file that can be viewed with ncdump utility

## Configuring Interpolation

- Overview
- Iinterp options
- Paths to GRIB data and EXTDATAROOT

## Configuring Interpolation

- Grib_prep Options
- Set in $MOAD_DATAROOT/static/wrfsi.nl
- si_controls
- Set frequency of AVN and ETA grid receipt and typical delay after cycle time
- si_paths
- Set EXTDATAROOT
- Set PATH_TO_AVN, PATH_TO_ETA grib file locations
- NOTE:  Other sources can be used if you simply call the other source AVN or ETA.  We will be making this more flexible in the future.

## Configuring Interpolation

- Grib_prep Options
- filetimespec
- Set start and stop times
- NOTE: This will be edited automatically if using the wrfsi.pl script to run the system.
- Variable selection from GRIB files via Vtables
- $MOAD_DATAROOT/static/Vtable.{SOURCE}
- {SOURCE} must match PATH_TO_{SOURCE}
- Contols selection of variables and levels based on GRIB codes
- Allows specification of name to use for each variable in output
- Vtable.AVN and Vtable.ETA provided in distribution

## Configuring Interpolation

- Interp Options
- Set in $MOAD_DATAROOT/static/wrfsi.nl
- interp_control
- PTOP_IN_PA:  Top pressure level to consider from input data
- HINTERP_METHOD
- 0 = nearest neighbor (not recommended)
- 1 = 4-point linear
- 2 = 16-point quadratic
- INPUT_ROOT: Prefix of files in EXTDATAROOT/extprd to use for dynamic data (set automatically when running wrfsi.pl)
- CONSTANTS_FULL_NAME: Full file names of data located in EXTDATAROOT/extprd that contain values to be held constant for entire run
- VERBOSE_LOG: Set to true for more extensive logging
- Recommend leaving all other options as they come

## Configuring Interpolation

- Interp Options (Cont)
- OUTPUT_COORD: which vertical coordinate to use. Set to “ZETA” for height-based R-K WRF or “ETAP” for mass version.
- LEVELS: List of “full” vertical levels from bottom to top of atmosphere starting at 0 for “ZETA” and starting at 1.0 for “ETAP”
- OUTPUT_VARS: controls the final output:
- 1: Output for “REAL.exe” on Arakawa-C stagger
- 2: Same as 1 but with some extra variables
- 3: Output for “REAL.exe” on Arakawa-A stagger
- 4: Same as 3 but with some extra variables
- Leave all other settings as they are

## Running 

- Set MOAD_DATAROOT and INSTALLROOT
- Ensure wrfsi.nl has correct extdataroot
- Ensure you have AVN or ETA data for the correct times available in the correct paths
- GRIB filenaming conventions recognized:
- FSL:  yyjjjhhmmffff
- NCEP: ???.ThhZ.??????ff.????
- NCEP: ???_yymmdd_hh_ff
- If your files do not conform to these naming conventions, the grib_prep script will assume every file is a possible match
- Ensure all previous domain configuration steps have been successfully completed

## Running 

- Run the main driver script with 4 arguments:
- YYYYMMDDHH: Year, month, day, and hour UTC of model start time
- FF: Length of forecast to be produce in hours
- Source:  AVN or ETA
- Window Name:  A name for this run
- Example:
- cd $INSTALLROOT/etc
- wrfsi.pl 2001081612 24 ETA myrun
- You can optionally provide the dataroot and installroot using command line options -d and -i.
- wrfsi.pl -d /my/dataroot -i /my/installroot 2001081612 24 ETA myrun

## Running 

- What happens when wrfsi.pl runs?
- The script edits $MOAD_DATAROOT/static/wrfsi.nl for run time and source of initialization
- The script calls grib_prep.pl to run grib_prep.exe
- The script calls interp.pl to run hinterp.exe and vinterp.exe
- Output ends up in $MOAD_DATAROOT/siprd
- A log file ends up in EXTDATAROOT/log for the grib_prep run
- A log file ends up in $MOAD_DATAROOT/silog for the hinterp/vinterp runs.

## Running 

- Did it run properly?
- Check for output in $MOAD_DATAROOT/siprd
- From previous run example, we should have:
- wrf_input.global.metadata
- wrf_input.d01.2001-08-16_12:00:00
- wrf_input.d01.2001-08-16-15:00:00
- wrf_input.d01.2001-08-16-18:00:00
- ...
- wrf_input.d01.2001-08-17-12:00:00
- Frequency of output files is set in filetimespec portion of wrfsi.nl
- If correct files are not present, check the log files to determine what went wrong.

## Running 

- Checking the output
- Use the IDL routines in the SRCROOT/util directory to read the hinterp/vinterp output files.
- Use the INSTALLROOT/bin/siscan program to dump a summary of file contents (avaialble in latest version, not yet released)
- siscan {file}
- Other Notes of Interest
- Each executable can be run directly without the use of any scripts by simply setting the MOAD_DATAROOT environment variable and ensuring the namelist is correct
- The interp.pl and gribprep.pl scripts can also be run directly without the use of wrfsi.pl

## Initializing the WRF Model

- Edit the WRF namelist.input file to make it consistent with the WRFSI domain configuration
- ztop, dx, dy, io_form, etc.
- Run the WRF real.exe routine using the WRFSI output files (wrf_input.*) as input
- You can then run the model!
- See Dave Gill's presentation for more details.

## Summary

- Setting up and running the WRFSI is most easily done by:
- Building the software
- Configuring your domain
- Running the wrfsi.pl script
- The system is flexible enough to run each component individually
- The WRFSI continues to be a work in progress
- New version will be released soon to support WRF LSM
- Domain configuration will be much easier with the use of templates and localization scripts in latest version
- More enhancements are planned and will be done as resources permit
- We welcome feedback, bug reports, etc.!