Introduction

The Weather Research and Forecasting (WRF) Model is an open-source mesoscale numerical meteorological model from NOAA. It has two dynamical cores (NMM designed for atmospheric research and ARW for operational forecasting needs), data assimilation and parallelization capabilites. It covers a wide range of meteorological applications across scales from tens of meters to thousands of kilometers [1].


This brief tutorial refers to WRF-ARW and covers:

Model Overview

WPS (WRF Pre Processing System)
  • configured by namelist.wps
  • geogrid.exe - static domain information
  • ungrib.exe - convert Grib files to a specific binary file (intermediate file format)
  • metgrid.exe - horizontal interpolator of FILEs to domain resolution


WRF model
  • configured by namelist.input
  • real.exe - vertical interpolator
  • wrf.exe - meteorological model


Inputs


WRFWorkflow.png
Figure 1 : WRF model workflow

Compile for Windows

Please contact Action Modulers for details.

Configure a new WRF domain

  1. Contact Action Modulers to obtain a template and copy it into a folder called WRF_MyDomain.
  2. Download WRF geographical datasets from WRF Portal into geog folder (15.4 GB unpacked).
  3. Add your domain(s) configuration in the &share and &geogrid sections of namelist.wps file. Domains can be build with:
    1. python plot_domains.py namelist.wps
    2. WRF Domain Wizard
    3. Note: nest number of grid points must be one greater than a multiple of parent_grid_ratio
  4. Adjust geographical data resolution according to domain resolution (as similar as possible). Possible resolutions include '30s', '2m', '5m', and '10m', corresponding to 30-arc-second data, 2-, 5-, and 10-arc-minute data.
    geog_data_res resolution [km]
    10 min 10*111/60 = 18.5 km
    5 min 5*111/60 = 9.25 km
    2 min 2*111/60 = 3.7 km
    30 sec 30*111/3600 = 0.925 km
  5. Run geogrid.exe to generate files geo_em.d01.nc, geo_em.d02.nc, etc.., one per domain, where domain 1 is the parent, 2, 3,.. are nested domains.
  6. View geo_em.dX.nc in any netcdf viewer tool (example: ncview, ncBrowse)


Example

The following example is for Portugal with 2 domains (max_dom = 2). The parent domain (d01) refers to the first column and nest domain (number 2) refers to the second column. A third, fourth, etc domain could be added by increasing max_dom and adding more columns.

Parent domain (d01):

  • Continental Portugal
  • 9 km horizontal resolution ( dx = dy = 9000.)
  • 61x101 grid points (e_we x e_sn)
  • centered in 8W 40N degrees.

Nest domain (d02):

  • nest of d01 (parent_id = 1)
  • 3 km of horizontal resolution (parent_grid_ratio = 3)
  • 103x199 grid points (e_we x e_sn)
  • lower left corner at grid location (i,j) = (13,12) of the parent grid (i_parent_grid = 13, j_parent_grid = 12)

Note: number of grid points minus 1 are integer multiples of parent_grid_ratio: 102/3 and 198/3.


Namelist.wps for geogrid.exe:

   &share
    wrf_core = 'ARW',
    max_dom = 2,
    io_form_geogrid = 2,
    start_date = '2015-04-29_00:00:00'
    end_date   = '2015-05-08_00:00:00'
    interval_seconds = 10800,
    nocolons = .true.,
   /
   
   &geogrid
    parent_id         =   0,   1
    parent_grid_ratio =   1,   3
    i_parent_start    =   1,   13,
    j_parent_start    =   1,   12,
    e_we              =  61,   103,
    e_sn              =  101,  199,
    geog_data_res     = '2m', '2m'
    dx = 9000,
    dy = 9000,
    map_proj = 'lambert',
    ref_lat   =  40.0,
    ref_lon   = -8.0,
    truelat1  =  30.0,
    truelat2  =  60.0,
    stand_lon = -8.0,
    geog_data_path = 'geog'
    opt_geogrid_tbl_path = '.'
   /

Result of python plot_domains.py namelist.wps 0:

WRF Portugal 3km.png
Figure 2 : Domain extents

Map Projections

WRF model grid is regular in projected coordinates. Possible grid projections are:

map_proj Map projection Projection parameters
lambert Lambert Conformal truelat1, truelat2 (optional), stand_lon
mercator Mercator truelat1
polar Polar stereographic truelat1, stand_lon
lat-lon Regular latitude-longitude, or cylindrical equidistant pole_lat, pole_lon, stand_lon

Run WRF

After the domain is configured and geo_em.dX.nc files are generated for each domain, namelist.wps and namelist.input files must be edited.

1. Add new domain(s), vertical resolution and nesting options (one-way or two-way) to &domain section of namelist.input:

Note: WRF bug - here, dx and dy are needed for all domains.

  &domains
    time_step                           = 54,    ! time step of each domain (recommended 6*dx in km for a typical case)
    time_step_fract_num                 = 0,
    time_step_fract_den                 = 1,
    max_dom                             = 2,
    grid_id                             =   1,   2,
    parent_time_step_ratio              =   1,   1,
    ! ----- copy from namelist.wps -----
    parent_id                           =   0,   1, 
    parent_grid_ratio                   =   1,   3,
    i_parent_start                      =   1,   13,
    j_parent_start                      =   1,   12,
    e_we                                =  61,   103,
    e_sn                                =  101,  199,
    dx                                  = 9000., 3000.,
    dy                                  = 9000., 3000.,
    ! ----- end copy from namelist.wps -----
    e_vert                              = 30,      30,   ! number of grid points in z-direction (bottom-top)
    p_top_requested                     = 5000,          ! pressure at top [Pa]
    num_metgrid_levels                  = 32,            ! number of vertical levels in metgrid files
    num_metgrid_soil_levels             = 4,             ! number of soil levels in metgrid files
    feedback                            = 1,             ! 0 - one-way nesting, 1 - two-way nesting 
    smooth_option                       = 0              ! if feedback is on.
    /

2. Add &metgrid and &ungrib sections to namelist.wps (if they are not there already):

  &ungrib
    out_format = 'WPS',   ! intermediate file format (binary WPS specific)
    prefix = 'FILE',      ! prefix name of intermediate files
   /
   
   &metgrid
    fg_name = 'FILE'                       ! prefix name of intermediate files
    io_form_metgrid = 2,                   ! Use netcdf format for IO
    opt_metgrid_tbl_path = '.'             ! path for METGRID.TBL
    opt_output_from_metgrid_path = '.'     ! path to write output netcdf files (met_em.dX)
   /


3. Adapt time parameters in both namelist files (&share in namelist.wps and &time in namelist.input):

namelist.wps:

   &share
    wrf_core = 'ARW',
    max_dom = 2,
    io_form_geogrid = 2,
    start_date = '2015-04-29_00:00:00'
    end_date   = '2015-05-08_00:00:00'
    interval_seconds = 10800,               ! interval between each GFS file [seconds]
    nocolons = .true.,
   /

namelist.input:

  &time_control
    run_days                            = 0,
    run_hours                           = 36,
    run_minutes                         = 0,
    run_seconds                         = 0,
    start_year                          = 2015, 2015, 2015,
    start_month                         = 05,   03,   03,
    start_day                           = 27,   21,   21,
    start_hour                          = 00,   00,   00,
    start_minute                        = 00,   00,   00,
    start_second                        = 00,   00,   00,
    end_year                            = 2015, 2015, 2015,
    end_month                           = 05,   03,   03,
    end_day                             = 28,   21,   21,
    end_hour                            = 12,   06,   06,
    end_minute                          = 00,   00,   00,
    end_second                          = 00,   00,   00,
    interval_seconds                    = 10800
    input_from_file                     = .true.,.true.,.true.,
    history_interval                    = 60,  60,   60,
    frames_per_outfile                  = 1000, 1000, 1000,
    restart                             = .false.,
    restart_interval                    = 5000,
    io_form_history                     = 2
    io_form_restart                     = 2
    io_form_input                       = 2
    io_form_boundary                    = 2
    debug_level                         = 1
    iofields_filename                   = "iofields.txt"
    ignore_iofields_warning             = .true.
    /

4. Copy GFS grib2 files to the current directory under the name GRIBFILE.AAA, GRIBFILE.AAB, using script link_grib.bat.

5. Run ungrib.exe to convert GFS files into intermediate format files with names FILE_yyyy-MM-DD_HH

6. Run metgrid.exe to interpolate GFS FILEs to the domain resolution, generating met_em.dX.yyyy-MM-DD_HH.nc files.

7. Run real.exe to interpolate metgrid necdf files to the chosen number of vertical layers, generating wrfst and wrfini files (netcdf)

8. Run wrf.exe [or mpiexec -n X wrf.exe] to run WRF model, generating wrfout_dX.yyyy-MM-DD_HH for each domain.

References

  1. WRF Model: http://www.wrf-model.org
  2. Geographical datasets: http://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html
  3. WRF-ARW Page: http://www2.mmm.ucar.edu/wrf/users
  4. GFS model: http://www.nco.ncep.noaa.gov/pmb/products/gfs/

Links

Action Server WRF Runner Plugin

WRF User Guide

Geographical datasets

Description of namelist.wps

Description of namelist.input