Home Agenda Lectures Virtual Mtg. Etiquette



  Quick Links

Initial Exercise

The purpose of this exercise is to familiarize yourself with the basic process of running WRF. For this case, the namelists have already been modified, so you should not need to make any modifications.

There are 5 steps to running WRF, broken down into 2 major programs: The WRF Preprocessing System (WPS) and the WRF model.



The WPS is a set of three programs that prepare input for the WRF program:

  • geogrid : defines the model domain and interpolates static geographical data to the grids
  • ungrib : extracts meteorological fields from GRIB-formatted input data files
  • metgrid : horizontally interpolates the meteorological fields extracted by ungrib to the model domain defined by geogrid

The WRF model is broken into 2 programs:

  • real : vertically interpolates the meteorological fields (from WPS) to WRF eta levels
  • wrf : simulates the model run, using all previously-defined settings for the domain, input data, vertical interpolation, physics, and dynamics settings


**Go through the steps in order, but if you later come back and want to skip ahead to a specific section, click on the link to jump to the desired section.**

1. Run Geogrid
2. Run Ungrib
3. Run Metgrid
4. Run Real
5. Run WRF
Check your output



1. Run Geogrid

The geogrid program defines the model domain (e.g., map projection, geographic location, size, and resolution of the domain). It also uses static fields (e.g., topography height, landuse category, etc.) from an external source, and interpolates them to the domain.




  1. To run geogrid, you must be in the wps directory.
    cd /glade/derecho/scratch/$USER/practice_exercises/wps
  2. Typically at this point, you would need to make modifications to the namelist.wps file to define your domain settings, but for this exercise, it is already done for you!


  3. Before running geogrid.exe, take a look at the domain, using an NCL script called plotgrids_new.ncl.


    Note:

    Make sure you have X–forwarding installed to be able to view plots directly from Derecho.

    If you do not have x-forwarding capability on your system, WRF INSTRUCTORS ARE NOT ABLE TO HELP YOU GET IT INSTALLED! You will need to work with a systems administrator at your institution to get it installed. If you are not able to get x-forwarding installed, see this alternative method for visualization.

    From the terminal command line, type:

    ncl util/plotgrids_new.ncl

    You should see the following plot appear on the screen (NOTE that this can take several seconds for this to pop up on the screen - especially if this is your first time executing this command):
    To close the X11 display window, simply click on the image, or type 'ctrl-c'.



  4. Now configure the model grid by running the program geogrid.exe:


    Note:

    Typically WPS executables do not need to be run with parallel processing (using multiple processors). The programs run so quickly that it doesn't usually make sense to compile WPS with anything other than a "serial" option. The only exception to this is when your domains are very large (e.g., 1000s x 1000x of grid spaces).


    ./geogrid.exe

    You should see "Successful completion of geogrid" at the end of the print out, and the following file should appear in your wps directory:

    geo_em.d01.nc



Notes:
  • You may see a message that says "Optional fields not processed by geogrid" with a list of fields below it. That's ok! These are optional fields that we do not want to process at this time.

  • If you are interested in viewing all fields in the geo_em.d01.nc file, use the ncview tool. Play around with the different buttons/options.
    ncview geo_em.d01.nc
    To quit ncview, simply type "ctrl-c", or click on the "quit" button.


Go back to top



2. Run Ungrib

Typically, input data from large–scale models is provided in "Grib" format. The ungrib program reads these data, extracts the meteorological fields, and then writes those fields to an intermediate file format, so that the next program (metgrid) can read them.





The case for this exercise is a blizzard that took place in northeast Colorado 13-14 March, 2021. It was ranked as the 4th largest snowstorm in Denver history, dropping 27.1 inches of snow.

Input data are one degree GFS FNL data, which are available every 6 hours. Data files are stored in the /glade/campaign/mmm/wmr/wrf_tutorial/input_data/co_blizzard directory on Derecho.


  1. Again, essential modifications have already been made to the namelist, so you will not need to modify it at this time.


  2. Link the GRIB data into the current directory using the script file "link_grib.csh":
    ./link_grib.csh /glade/campaign/mmm/wmr/wrf_tutorial/input_data/co_blizzard/fnl_20210314


  3. Notes:

    • There is no "." at the end of this command, since you are running a script.

    • Take care to link to FILES and not to a DIRECTORY.

    • Only the root of the files is needed for the command. Once you've typed through the name of the directory that holds the grib files, simply hit the 'tab' button and auto-complete will provide the prefix of the files, which is all that is necessary.



    Now if you use the following command:
    ls -1 GRIB*
    you should see the following GRIB* files, linked to their corresponding input data file (one for each time period):
    GRIBFILE.AAA
    GRIBFILE.AAB
    GRIBFILE.AAC

    Note:

    The GRIBFILE.XXX formatted name is expected by the ungrib.exe program.


  4. Link the correct Vtable to your wps directory (recall input data for are from the GFS model, so use the GFS Vtable). Vtables determine which fields to extract from grib files (not all fields are needed) and decode the grib data and convert the files to intermediate format, used as input to the metgrid program. Here you are linking the proper Vtable to the WPS directory and renaming it to a generic name 'Vtable' so ungrib.exe will recognize it for processing.
    ln  -sf  ungrib/Variable_Tables/Vtable.GFS   Vtable

  5. Ungrib the input data by running ungrib.exe. This should be quick, but can sometimes take up to 5 minutes.
    ./ungrib.exe

    If successful, you will see "Successful completion of ungrib" at the end of the print out, and the following files should now be in the wps directory:

    FILE:2021-03-14_00
    FILE:2021-03-14_06
    FILE:2021-03-14_12

    The data are now in intermediate format and are ready for the metgrid.exe process.




Go back to top



3. Run Metgrid

The metgrid program horizontally interpolates meteorological data (extracted by the ungrib program) to the simulation domain(s) (defined by geogrid). This program combines domain information with meteorological data to create new files that will be used to run the WRF model.




To run the metgrid program, simply type:

./metgrid.exe

If successful, you will see "Successful completion of metgrid" at the end of the print out. And if you issue:
ls -l met_em*
You should now see the following files:
met_em.d01.2021-03-14_00:00:00.nc
met_em.d01.2021-03-14_06:00:00.nc
met_em.d01.2021-03-14_12:00:00.nc



Note:

If interested in viewing all the fields in the met_em* files, use the ncview tool:
ncview met_em.d01*
To quit ncview, simply type "ctrl-c", or click on the "quit" button.


Go back to top



4. Run Real

The real program defines the WRF model vertical coordinate. It uses horizontally-interpolated meteorological data (met_em* files from wps) and vertically interpolates them for use with the WRF model. It creates initial condition files and a lateral boundary file that will be used by WRF.




  1. To run the real.exe and wrf.exe programs, you need to move to the wrf/test/em_real directory. From wps/, type:
    cd ../wrf/test/em_real
  2. Link metgrid output data files from wps to the current directory:
    ln -sf ../../../wps/met_em* .
  3. Typically at this point, you would need to make modifications to the namelist.input file to specify the domain, dates, physics options, etc.; however, as the namelist has already been prepared for this exercise, simply run the real.exe program, which uses the met_em* files as input to produce model initial condition and lateral boundary files.

    Unlike WPS, WRF was compiled for parallel computing. To run in parallel, a batch script is necessary to run the executables. The batch script places your request in the queue, and when nodes are free, your executable will be run. For real.exe, the batch script is called "runreal.sh." Issue the following command:
    qsub runreal.sh

    Wait about one minute and then check the status of your request, using the following command:
    qstat -u $USER
    If your executable is still in the queue, or is running, it will show up after you issue the above "qstat" command. If nothing shows up, check to see if you have rsl.* files, and if so, check the end of those files. You should see
    SUCCESS COMPLETE REAL_EM INIT

    If successful the following input files for wrf will be created:

    wrfbdy_d01
    wrfinput_d01



Go back to top



5. Run WRF

The WRF model uses the intitial and boundary condition files generated by the real program to perform model integration, using user-specified options provided in the namelist.input file (e.g., physics options).




  1. Use the "runwrf_initial.sh" batch script to run wrf.exe. The batch script places your request in the queue, to execute the wrf simulation.
    qsub runwrf_initial.sh

    Wait about one minute and then check the status of your request, using the following command:
    qstat -u $USER
    If your executable is still in the queue, or is running, it will show up after you issue the above "qstat" command. If nothing shows up, check to see if you have rsl.* files, and if so, check the end of those files. You should see
    SUCCESS COMPLETE WRF

    If successful, this will generate the following history files (we specified in the namelist.input file to output every 3 hours):

    wrfout_d01_2021-03-14_00:00:00
    wrfout_d01_2021-03-14_03:00:00
    wrfout_d01_2021-03-14_06:00:00
    wrfout_d01_2021-03-14_09:00:00
    wrfout_d01_2021-03-14_12:00:00


Go back to top



Check your output:

If interested in viewing some of your output, try the NetCDF data browser "ncview" to examine your wrf output files.

ncview wrfout_d01*

Notes:

WRF output fields are available to view. Click on one of the variable boxes (1d vars, 2d vars, or 3d vars), and then choose a field to view. You can then click through different time periods and, if the variables are in the 3d column, you can also look at each level. The following fields may be of interested:
RAINC: Accumulated total cumulus precipitation (under the list of "3d vars")
RAINNC: Accumulated total grid scale precipitation (3d)
SNOWC: Snow coverage (3d)
SNOWNC: Accumulated total grid scale snow and ice (3d)
PSFC: Surface pressure (3d)
Q2/T2: Water Vapor/Temperature at 2m above ground (3d)
U10/V10: X/Y Component of wind (speed) at 10m above ground (3d)
MU: Perturbation dry air mass in column (3d)
PH: Perturbation geopotentail (under the list of "4d vars")
QVAPOR/QCLOUD/QRAIN/QICE/QSNOW: Vapor/Cloud water/Rain water/Ice/Snow mixing ratio (4d)
U/V: X/Y-wind component (speed) (4d)


WRF Tutorial Exercises



Continue to More Exercises

If you plan to attempt more exercises right now, you can access the cases studies menu by clicking here.