================ Initial Exercise ================ | This exercise outlines the fundamental steps and commands for running WRF, without requiring any setting changes - you'll learn about that in the next exercise. | WRF execution is a five-step process across the following two main programs: .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: WPS .. container:: card-body-def A set of three programs that preprocess static geographic fields and meteorological data to prepare input to the WRF model: 1. **geogrid** : defines the model domain and interpolates static geographical data to the grids 2. **ungrib** : extracts meteorological fields from GRIB-formatted input data files 3. **metgrid** : horizontally interpolates the meteorological fields extracted by ungrib to the model domain defined by geogrid .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: WRF .. container:: card-body-def The primary modeling system, broken into two programs: 4. **real** : vertically interpolates the meteorological fields (from WPS) to WRF eta levels 5. **wrf** : simulates the model run, using all previously-defined settings for the domain, input data, vertical interpolation, physics, and dynamics settings .. figure:: ./images/5_steps_of_wrf.png :align: center :width: 80% | | WPS: Geogrid ============ .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: geogrid .. container:: card-body-def A WPS program that defines the model domain's map projection, geographic location, size, and resolution. It also interpolates static geographic data (e.g., topography height, landuse category) from an external source, onto this domain. .. figure:: ./images/geogrid.png :align: center :width: 80% | Run Geogrid ----------- #. Navigate to the **wps/** directory by issuing the following in your terminal window's command line: .. note:: Any command on this site included in a black code box is copyable. Hover over the right hand side of the box to reveal a "copy" icon, then click on that icon. .. code-block:: :class: copyable cd /glade/derecho/scratch/$USER/practice_exercises/wps |vspace| #. Typically you would need to modify the **namelist.wps** file for your specific case, but it has already been configured for this exercise. |vspace| #. Before running *geogrid.exe*, preview the domain using the **plotgrids_new.ncl** NCL script, located in the **wps/util/** directory. .. important:: `X–forwarding `_ is required to view plots directly from Derecho. |br| |br| **WRF INSTRUCTORS CANNOT HELP WITH THIS INSTALLATION!** |br| |br| Contact your institution's system administrator for assistance or see `Visualization Without X-forwarding <./visualization_no_x_forwarding.html>`_ for alternatives. Issue the following command: .. code-block:: :class: copyable ncl util/plotgrids_new.ncl Expect the following plot to appear on the screen, which may take several seconds. Click the image or use "ctrl-c" to close the window. .. figure:: ./images/plotgrids_ncl_initial_d01.png :align: center :width: 65% |vspace| #. Now run **geogrid.exe** to configure the model grid. .. code-block:: :class: copyable ./geogrid.exe As geogrid processes, status updates are printed to the terminal, followed by **Successful completion of geogrid** when complete. Afterward, a listing of the directory (enter ``ls`` in the terminal command line) should include the following new file: .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote geo_em.d01.nc | | WPS: Ungrib =========== .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: ungrib .. container:: card-body-def A WPS program that processes GRIB-formatted meteorological data, a commonly-used input format. Ungrib extracts the relevant meteorological fields from these files and outputs them in an intermediate format compatible with the metgrid program. .. figure:: ./images/ungrib.png :align: center :width: 80% | For this exercise you'll simulate 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 in 24 hours. |vspace| The following describes the input data: .. csv-table:: :escape: \ **Type**, Global one-degree final analysis from the `NCEP GFS `_ model **Interval**, Every 6 hours **Initial Time**, 2021-03-14_00:00:00 **End Time**, 2021-03-14_12:00:00 **Data Directory**, /glade/campaign/mmm/wmr/wrf_tutorial/input_data/co_blizzard/ **File Root**, fnl_20210314 **Vtable**, Vtable.GFS | Run Ungrib ---------- #. Link the GRIB data to the current directory using the script **link_grib.csh** (located in the *wps/* directory): .. code-block:: :class: copyable ./link_grib.csh /glade/campaign/mmm/wmr/wrf_tutorial/input_data/co_blizzard/fnl_20210314 Run ``ls`` to list the files in the *wps/* directory, which should include the newly linked files (titled *GRIBFILE.XXX* - one for each data file/time period). .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote GRIBFILE.AAA |br| GRIBFILE.AAA |br| GRIBFILE.AAC |vspace| #. Link the correct **Vtable** to the **wps/** directory. .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: Vtables .. container:: card-body-def Tables that define the fields to extract from GRIB files, decode the GRIB data, andassist ungrib.exe with converting the files to intermediate format. |vspace| Since input is from GFS, link the GFS Vtable (**Vtable.GFS**) to the **wps/** directory and rename it to "**Vtable**" - the name expected by the ungrib program. .. code-block:: :class: copyable ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable |vspace| #. Process the input data by running **ungrib.exe**. This is typically quick, but can take up to ~5 minutes. .. code-block:: :class: copyable ./ungrib.exe As ungrib processes, status updates are printed to the terminal, followed by **Successful completion of ungrib** when complete. Afterward, a listing of the directory (``ls``) should include the following new files: .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote FILE\:2021-03-14_00 |br| FILE\:2021-03-14_06 |br| FILE\:2021-03-14_12 The data are now in intermediate format and are ready for the metgrid.exe process. | | WPS: Metgrid ============ .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: metgrid .. container:: card-body-def A WPS program that horizontally interpolates meteorological data extracted by ungrib onto the simulation domain(s) defined by geogrid, creating input files required by real and wrf. .. figure:: ./images/metgrid.png :align: center :width: 80% | Run Metgrid ----------- To run the metgrid program, type: .. code-block:: :class: copyable ./metgrid.exe As metgrid processes, status updates are printed to the terminal, followed by **Successful completion of metgrid** when complete. Afterward, a listing of the directory (``ls``) should include the following new files: .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote met_em.d01.2021-03-14_00:00:00.nc |br| met_em.d01.2021-03-14_06:00:00.nc |br| met_em.d01.2021-03-14_12:00:00.nc | | Real Program ============ .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: real .. container:: card-body-def A WRF program that defines the WRF model vertical coordinate by vertically interpolating the horizontal meteorological data from WPS (met_em* files). This process creates the initial condition and lateral boundary files required to run WRF. .. figure:: ./images/real.png :align: center :width: 65% | #. To run the real.exe and wrf.exe programs, move to the **wrf/test/em_real** directory. From the *wps/* directory, type: .. code-block:: :class: copyable cd /glade/derecho/scratch/$USER/practice_exercises/wrf/test/em_real |vspace| #. Link metgrid output data files (**met_em.***) from **wps/** to the current directory. These files are used as input to the real.exe program. .. code-block:: :class: copyable ln -sf /glade/derecho/scratch/$USER/practice_exercises/wps/met_em* . |vspace| #. Typically, you'd modify the **namelist.input** file at this point to specify the domain, dates, physics options, etc. Since the namelist is already configured for this exercise, simply run the **real.exe** program, which uses the *met_em\** files to produce model initial condition and lateral boundary files. |vspace| .. important:: Unlike WPS, WRF was compiled for parallel computing (enabling the use of multiple processors). Because the NCAR HPC uses a queueing system, a batch script is required to queue and execute the model on the requested processors. |vspace| The real.exe batch script is called **runreal.sh.** Issue the following command: .. code-block:: :class: copyable qsub runreal.sh |vspace| #. Wait about one minute and then check the status of your request, using the following command: .. code-block:: :class: copyable qstat -u $USER |vspace| **If the run is still queued or actively running** |br| It will be displayed in the output from the above command, and will look similar to: .. code-block:: Job ID Username Queue Jobname SessID NDS TSK Memory Time S Time --------------- -------- -------- ---------- ------ --- --- ------ ----- - ----- 1873233.desche* user cpu real -- 1 36 235gb 00:20 Q -- The "S" column above indicates the status, where the following definitions apply: * **Q** : the simulation is still sitting in the queue and hasn't started running yet * **R** : the simulation is actively running * **E** : the simulation is finishing and will be done momentarily |vspace| When the run finishes successfully the following initial condition and boundary files should be in your directory: .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote wrfbdy_d01 |br| wrfinput_d01 .. dropdown:: If no output appears Look for *rsl.\** files in your directory. If they exist, check the end of one of the files for the message **SUCCESS COMPLETE REAL_EM INIT**, indicating the program completed successfully. .. code-block:: :class: copyable tail rsl.out.0000 | | Run WRF ======= .. container:: row m-0 p-0 .. container:: col-md-12 pl-0 pr-3 py-3 m-0 .. container:: card px-0 h-100 .. rst-class:: card-header-def .. rubric:: wrf .. container:: card-body-def 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). .. figure:: ./images/wrf.png :align: center :width: 65% | To run wrf.exe, use the *runwrf_initial.sh* batch script, which queues and executes the wrf simulation. .. code-block:: :class: copyable qsub runwrf_initial.sh Wait about one minute and then check the status of your request, using the ``qstat`` command: .. code-block:: :class: copyable qstat -u $USER * If the run is still queued or actively running, it will be displayed in the output. * If no output appears, look for *rsl.\** files in your directory. * If *rsl.\** files exist, check the end of one of the files for the message **SUCCESS COMPLETE WRF**, indicating a successful completion. If successful, the following history files should be available in the running directory. *Note that the namelist.input file was set to output every 3 hours*: .. container:: row m-0 p-0 .. container:: col-md-6 pl-0 pr-3 py-3 m-0 .. container:: card-blockquote wrfout_d01_2021-03-14_00:00:00 |br| wrfout_d01_2021-03-14_03:00:00 |br| wrfout_d01_2021-03-14_06:00:00 |br| wrfout_d01_2021-03-14_09:00:00 |br| wrfout_d01_2021-03-14_12:00:00 |br| | | Check Your Output ================= If interested in viewing fields in the wrf output files, try the netCDF data browser **ncview**: .. code-block:: :class: copyable ncview wrfout_d01* **To quit ncview**, use the keyboard command "ctrl-c", or click on the "quit" button. With the ncview window open, 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. .. dropdown:: Interesting fields to visualize with ncview * **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) | | Organization Suggestion ======================= Create a new directory within **wrf/test/em_real/** (e.g., "initial_exercise") for each exercise to save your work and avoid overwriting existing files that will be used later. .. code-block:: :class: copyable mkdir initial_exercise then copy the necessary files into that directory: .. code-block:: :class: copyable mv wrfbdy_d01 wrfinput_d01 wrfout* rsl* initial_exercise cp namelist.input initial_exercise When these files are required in later exercises, simply copy them back into the working directory. For example: .. code-block:: :class: copyable cp initial_exercise/wrfbdy_d01 . | | Return to the `Practice Exercises <./practices.html>`_ home to page to run the *Single Domain Run*. | |