The Runtime I/O Option


WRF’s Runtime I/O option allows output modification - adding, removing, or adjusting the frequency of variables - without editing the Registry or recompiling.

This exercise covers increasing the frequency of variables and adding variables not typically included in the history files.

Existing wrfinput_d01 and wrfbdy_d01 files from a previous case can be reused, skipping WPS pre-processing. If unavailable, return to the Single Domain exercise to regenerate them.



Increase the Frequency of WRF Output Variables

Use the “Runtime I/O” option to increase the frequency of the following variables. They will be saved to a separate file - not the standard history (wrfout*) files.

  • RAINC : Total accumulated cumulus precipitation

  • RAINNC : Total accumulated grid-scale precipitation

  • T2 : Temperature at 2m

  • Q2 : Water vapor at 2m

  1. Edit namelist.input to add the below settings. Tip: Start with the namelist set up for the Single Domain Run.

    &time_control
    restart_interval = 72000
    iofields_filename = "myoutfields_d01.txt",
    io_form_auxhist24 = 2,
    auxhist24_interval = 30,
    
    &domains
    max_dom = 1
    

    Note

    The above namelist settings instruct wrf.exe to read a file called myoutfields_d01.txt and write its data to a new, unused stream (stream 24). io_form_auxhist24 = 2 specifies netCDF output every 30 simulation minutes (auxhist24_interval=30). Set restart_interval to a large value to avoid writing a restart file - while good practice in real-world use, it is unnecessary for this exercise.

  2. Create a file called myoutfields_d01.txt in the wrf/test/em_real/ directory. Declare the variables to output more frequently (every 30 mins). Make sure there are no spaces in the text file.

    +:h:24:RAINC,RAINNC,T2,Q2
    

    The above code indicates the following:

    \(+\)

    add variables

    h:24

    history stream 24

    RAINC, etc.

    the variables to add to the new file

    Note

    Nested domains require a myoutfields_d0* file for each domain. The file can be named anything you choose, as long as its extension is .txt.

  3. There is no need to run real.exe again; just wrf.exe. If successful, in addition to the history and restart files, the following file is generated and includes the requested variables at 30-minute intervals.

    auxhist24_d01_2019-11-25_12:00:00

  4. If interested, use ‘ncview’ to visualize the variables in auxhist24_d01_2019-11-25_12:00:00.



Output Additional Variables

Use the “Runtime I/O” option to output additional variables to the history file (wrfout*). For e.g., to determine the amount of temperature change is results from radiation, PBL, cumulus and microphysics, add the following variables:

  • RTHCUTEN : Theta tendency calculated by the cumulus scheme

  • RTHBLTEN : Theta tendency calculated by PBL parameterization

  • RTHRATEN : Theta tendency calculated by the radiation scheme

  • H_DIABATIC : Latent heating from microphysics

Note

Alternative to using the Runtime I/O option, the same can be accomplished by adding an h to the I/O column for each variable in the Registry.EM_COMMON file, but that requires a full clean and recompile of the code, which can be time consuming.

  1. Edit namelist.input. Start with the namelist set up for the Single Domain Run.

    &time_control
    restart_interval = 72000
    iofields_filename = "myoutfields_d01.txt",
    ignore_iofields_warning = .true.,
    
    &domains
    max_dom = 1
    

    Note

    These namelist settings intruct wrf.exe to read a file called myoutfields_d01.txt, and to either remove or add variables. ignore_iofields_warning=.true. allows the run to continue with only a warning message printed to the log file. If .false., the program aborts if .txt file contains errors. Set restart_interval to a large value to avoid writing a restart file - while outputting a restart file is good practice in the real world, it is unnecessary for this class.

  2. Modify myoutfields_d01.txt - delete all its contents, then declare the new output variables and save the file. Make sure there are no spaces in the text file.

    +:h:0:RTHCUTEN,RTHBLTEN,RTHRATEN,H_DIABATIC
    

    This line of code indicates the following:

    \(+\)

    add variables

    h:0

    history stream 0, which is the standard wrfout stream

    RTHCUTEN, etc.

    the variables to add to the history

  3. There is no need to run real.exe again; just wrf.exe. If successful, the new variables should be included in the history output (wrfout*). Use ncdump -h <file-name> to list the contents of one of the history files, and/or visualize the variables using the “ncview” option.



Return to the Practice Exercise home to page to run another exercise.