Preparing to Calculate the Modified Red Flag Threat Index

Preparing to Calculate the Modified Red Flag Threat Index carson Mon, 03/04/2019 - 14:53

The calculation of the RFTIM is based on the 2-m relative humidity in percent (rh2m) and on the 6-m wind speed in miles per hour (ws6m). It uses a geographically-dependent climatology of thresholds for the two quantities to return an integer value between 0 and 5 for each of the two variables. In our simplified version, we use the climatological values derived for KAMA (Rick Husband, Amarillo International Airport, Amarillo, TX), independent of the geographical location.  This calculation could be made more sophisticated by using a spatially-varying climatology and by considering additional variables, such as snow cover.

Add the new variables 

This calculation is done best in the existing scheme sfc_diag (ccpp/physics/physics/sfc_diag.f), because all the necessary quantities to derive relative humidity and wind speed are computed in the scheme. Before making changes to sfc_diag.f, note that the required input variables, rh2m and ws6m, are not provided by the model. The first task therefore is to add these two variables to FV3/gfsphysics/GFS_layer/GFS_typedefs.F90.

First let’s work with rh2m and ws6m Both rh2m and ws6m are pure interstitial variables, i.e. they do not need to be persistent in memory from one time step to another. It is thus recommended to add them to the GFS_interstitial data type.

Variable rh2m:
   standard_name : relative_humidity_at_2m
   units         : percent
   rank          : 1
   type          : real
   kind          : kind_phys

Variable ws6m:
   standard_name : wind_speed_at_6m_in_miles_per_hour
   units         : mi h-1
   rank          : 1
   type          : real
   kind          : kind_phys

FYI: When variables have non-standard units, such as miles per hour, the variables standard name are decorated with information about the units, This is the case with variable ws6m above.

Each variable that is added to FV3/gfsphysics/GFS_layer/GFS_typedefs.F90 requires a minimum of 4 additions to the file:

  • a metadata table entry
  • a variable declaration inside one of the derived type definitions
  • an allocation statement within a *_create method for the derived type
  • an initialization statement.

For expediency, you can duplicate the entries pertaining to the variable zt1d for rh2m and ws6m, making the necessary adjustments to use the metadata above, that is, use the proper standard_name and units for each variable added. You will note that zt1d appears a 5th time, which is a print statement.

FYI: For some variables added to the GFS_interstitial_type or GFS_diag_type types, a few more additions are necessary for things like resetting their values in a *_reset method and adding a line to a *_print method.

Hint 1: Refer to presentation day2_5_Host-Side_Coding, section “Adding a variable to the host+CCPP”, “Case 1: the new variable is a member of a derived data type that already exists on the host model side”.

Hint 2: Using the standard_name and units exactly as listed above is critical for this development to work, These are the two aspects of metadata used in communication between the CCPP and the host model. Regarding the longname, you can use any description of your preference.

Hint 3: Use optional=F for all variable declarations in GFS_typedefs.F90

Next let’s work with rftim.  Variable rftim also needs to be added to  FV3/gfsphysics/GFS_layer/GFS_typedefs.F90 in 4 locations:  metadata table, variable declaration, variable allocation, and variable initialization.

Variable rftim:
   standard_name : modified_red_flag_threat_index
   units         : index
   rank          : 1
   type          : real
   kind          : kind_phys

Since variable rftim will be output by the model, it needs to be added to the GFS_diag_type data type. You need to modify the metadata table where the various GFS_diag_type variables are listed and add a line for rftim. For example, you could add a line at the end of the list, right after the line for atmosphere_momentum_diffusivity_for_mynnpbl. Note: if adding to the end of the metadata table list, be sure to leave a blank line starting with !! at the bottom of the table -- this is needed for parsing by the CCPP framework.

Next, you need to declare variable rftim. Add the following to the list of variables in section “Output - only in physics”. You can place this after the declaration for “MP quantities for 3D

   !--- Modified Read Flag Thread Index
    real (kind=kind_phys), pointer :: rftim(:)       => null() !<

You need to allocate the variable rftim in subroutine diag_create and then initialize it. You can enter the text below right before the line call Diag%rad_zero  (Model)

   ! Modified Red Flag Threat Index calculation
   allocate (Diag%rftim (IM))
   Diag%rftim = clear_val

 

Calculate the New Variables

 

To calculate these variables in sfc_diag, you can use the following equations:

   !> - For Modified Red Flag Threat Index calculation,
   !! relative humidity 2m above ground in percent
   rh2m(i) = 100.0*q2m(i)/qss

   !> - Wind speed 6m above ground in miles per hour,
   !! conversion factor from 10m to 6m is 0.886
   !! (Lindley et al., 2011), and m/s to mi/h is 2.23694
   ws6m(i) = sqrt(u10m(i)**2 + v10m(i)**2) * 0.886 * 2.23694

Edit file ccpp/physics/physics/sfc_diag.f. You will need to do the following modifications:

  • Add the new variables (rh2m and ws6m) to the metadata table.
  • Add the new variables as arguments to the subroutine.
  • Declare the variables as real(kind=kind_phys), dimension(im), intent(out)
  • Compute the variables using the equations provided above
  • Print out the variable (optional)

To make these changes, you can follow what is done to variable u10m, since it also goes through the 5 steps above.

Hint 1: Don’t forget to add the new variables to the metadata table.  You can copy/paste the entries from GFS_typdefs.F90 and remember to change the intent to OUT.

Hint 2: Don’t forget to pass your variables in and out of the subroutine. Arguments in the subroutine call must be in the same order as in the table of metadata.  Also don’t forgot to declare them appropriately in the declaration section of the subroutine using intent(out) and dimension (im).