Chapter 4: WRF Initialization

Table of Contents

 

Introduction

The WRF model has two classes of simulations it can generate: those with an ideal initialization and those utilizing real data. Idealized simulations typically manufacture an initial condition file for the WRF model from an existing 1-D or 2-D sounding and assume a simplified analytic orography. Real-data cases usually require pre-processing from the WPS package, which provides each atmospheric and static field with fidelity appropriate to the chosen grid resolution for the model. The WRF model executable itself is not altered by choosing one initialization option over another (idealized vs. real), but the WRF model pre-processors (the real.exe and ideal.exe programs) are specifically built based upon a user's selection. Either real.exe or ideal.exe will be run prior to running the WRF model.

Ideal vs. real cases are divided as follows:

Selection of the type of forecast is made when issuing the ./compile statement. When selecting a different case to study, the code must be re-compiled to choose the correct initialization for the model. For example, after configuring the setup for the architecture (with the ./configure command), if users issues the command ./compile em_real, then the initialization program is built using module_initialize_real.F as the target module (one of the ./WRF/dyn_em/module_initialize_*.F files).

For ideal initializations, there is a combination of files that may used to build the executable. For the em_fire, em_heldsuarez, em_scm_xy, and em_tropical_cyclone cases, a separate initialization file exists (e.g., module_initialize_fire.F for the em_fire case). For the remaining idealized cases, the file ./WRF/dyn_em/module_initialize_ideal.F is used. Note the WRF forecast model is identical for both of these initialization programs.  In each of these initialization modules, the same type of activities occur:

Both the real.exe program and ideal.exe programs share a large portion of source code to handle the following duties:

The real-data case does some additional processing:

The “real.exe” program may be run as either a serial or a distributed memory job.  Since the idealized cases only require that the initialization run for a single time period (no lateral boundary file is required) and are, therefore, quick to process, all of the “ideal.exe” programs should be run on a single processor. The Makefile for 2-D cases will not allow users to build the code with distributed memory parallelism. For large 2-D cases, if users requires OpenMP, the variables numtiles_x and numtiles_y must be set in the domains portion of the namelist file namelist.input  (numtiles_y must be set to 1, and numtile_x then set to the number of OpenMP threads).

 

Initialization for Ideal Cases

"ideal.exe" is the program in the WRF system that allows users to run a controlled scenario. Typically this program requires no input except for the namelist.input and the input_sounding files. There are exceptions, for example the baroclinic wave case uses a 2-D binary sounding file. The program outputs the wrfinput_d01 file that is read by the WRF model executable ("wrf.exe").  Since no external data is required to run idealized cases, even for researchers interested in real-data cases, idealized simulations are an easy way to ensure the model is working correctly on a particular architecture and compiler.

Idealized runs can use any of the boundary conditions except "specified" and are not, in general, set up to run with sophisticated physics. Most have no radiation, surface fluxes or frictional effects (other than the sea breeze case, LES, and the global Held-Suarez). Idealized cases are mostly useful for dynamical studies, reproducing converged or otherwise known solutions, and idealized cloud modeling. Again, there are exceptions. The tropical cyclone case lacks only radiation schemes, and the sea breeze case has a full complement of parameterization options.

There are 1-D, 2-D and 3-D examples of idealized cases, with and without topography, and with and without an initial thermal perturbation. The namelist controls the size of the domain, number of vertical levels, model top height, grid size, time step, diffusion and damping properties, boundary conditions, and physics options. A large number of settings already exist in the default namelists found in each case directory.

The input_sounding file (already in appropriate case directories) can be any set of levels that goes at least up to the model top height (ztop) in the namelist. The first line includes surface pressure (hPa), potential temperature (K) and moisture mixing ratio (g/kg). Each subsequent line has five input values: height (meters above sea-level), dry potential temperature (K), vapor mixing ratio (g/kg), x-direction wind component (m/s), and y-direction wind component (m/s). The “ideal.exe” program interpolates data from the input_sounding file and will extrapolate if enough data is not provided.

The base state sounding for idealized cases is the initial sounding, minus moisture, and therefore does not have to be defined separately. Note for the baroclinic wave case: a 1-D input sounding is not used because the initial 3-D arrays are read-in from the file input_jet. This means for the baroclinic wave case, the namelist.input file cannot be used to change the horizontal or vertical dimensions since they are specified in the input_jet file.

Making modifications, apart from namelist-controlled options or soundings, must be done by editing the Fortran code. Such modifications would include changing the topography, distribution of vertical levels, properties of an initialization thermal bubble, or preparing a case to use more physics, such as a land-surface model. The Fortran code to edit is contained in ./WRF/dyn_em/module_initialize_[case].F, where [case] is the case chosen during compilation (e.g.,  module_initialize_fire.F. or module_initialize_ideal.F). The subroutine to modify is init_domain_rk. To change the vertical levels, only the 1-D array znw must be defined, containing the full levels, starting from 1 at k=1, and ending with 0 at k=kde. To change the topography, only the 2-D array ht must be defined, making sure it is periodic if those boundary conditions are used. To change the thermal perturbation bubble, search for the string "bubble" to locate the code to modify.

Each ideal case provides an excellent set of default examples for users. The method to specify a thermal bubble is given in the super cell case. In the hill2d case, the topography is accounted for properly in setting up the initial 3-D arrays, so that example should be followed for any topography cases. A symmetry example in the squall line cases tests that your indexing modifications are correct. Full physics options are demonstrated in the seabreeze2d_x case.

 

 

 

 

Available Ideal Test Cases

The available test cases are

  1. 2-D squall2d_x (test/em_squall2d_x)
  2. 2-D squall2d_y (test/em_squall2d_y)
  3. 3-D quarter-circle shear supercell simulation (test/em_quarter_ss).
  4. 2-D flow over a bell-shaped hill (x,z) (test/em_hill2d_x)
  5. 3-D baroclinic waves (test/em_b_wave)
  6. 2-D gravity current (test/em_grav2d_x)
  7. 2-D sea breeze (test/em_seabreeze_x)
  8. 3-D large eddy simulation (test/em_les)
  9. 3-D Held-Suarez (test/em_heldsuarez)
  10. 1-D single column model (test/em_scm_xy)
  11. 3-D surface fire (test/em_fire)
  12. 3-D tropical cyclone (test/em_tropical_cyclone)
  13. 3-D convective-radiative equilibrium (test/em_convrad)

 

Initialization for Real Data Cases

Real-data WRF cases use input data to the “real.exe” program provided by the WRF Preprocessing System (WPS), which was originally generated from a previously-run external analysis or forecast model (e.g., GFS).

Suppose a single-domain WRF forecast is desired, with the following criteria:

The following coarse-grid files will be generated by the WPS (starting date through ending date, at 6-h increments):

The convention is to use "met_" to signify data output from the WPS “metgrid.exe” program and input into the “real.exe” program. The "d01" portion of the name identifies to which domain this data refers (which permits nesting). The next set of characters is the validation date/time (UTC), where each WPS output file has only a single time-slice of processed data. The file extension suffix “.nc” refers to the output format from WPS, which must be in netCDF for the “real.exe” program. For regional forecasts, multiple time periods must be processed by “real.exe” so that a lateral boundary file is available to the model. The global option for WRF requires only an initial condition. 

The WPS package delivers data that is ready to be used in the WRF system by the “real.exe” program.

 

Real Data Test Case: 2000 January 24/12 through 25/12

 

Considerations for Recent Releases

The default behavior is to include the moist potential temperature option and to include the hybrid vertical coordinate. These two options make backward compatibility difficult.

The initial moist potential temperature capability was introduced in the WRF system with v3.8. In v3.8 through v3.9.1.1, all processing for moist theta was handled by the model. This caused repeated toggling back and forth inside the main solver routine, so that the definition of the variable grid%t_2 was dependent on the location within the routine. The code has now been properly ported so that the moist theta option is incorporated in the real/ideal pre-processor, and the meaning of the grid%t_2 variable is always the same. All real and ideal cases support the moist potential temperature option. Because the code assumes the input variables are consistent with the namelist setting for moist theta, wrfinput_d0x and wrfbdy_d01 files from earlier versions may not generally be used.

If users have older input data (pre v4.0), and they turn off the moist theta option, then wrfinput_d0x and wrfbdy_d01 data may be used.

If users turns on the moist potential temperature option, only new wrfinput_d0x and wrfbdy_d01 data may be used.

 

WRF code supports a hybrid vertical coordinate, but only for all real-data and ideal cases. The same sort of proscriptions applies with the hybrid vertical coordinate as with the moist theta option.

If users have older input data (pre v4.0) that does not use HVC, and they turn off the hybrid vertical coordinate option in the WRF model, then wrfinput_d0x and wrfbdy_d01 data may be used.

If users turn on the HVC option, only new wrfinput_d0x and wrfbdy_d01 data may be used.

A namelist option is available (force_use_old_data=.TRUE.) to explicitly allow bringing in old wrfinput_d0x and wrfbdy_d01 files to the WRF model.

 

Setting Model Vertical Levels

Users may explicitly define full eta levels using the namelist option eta_levels. Given are two distributions for 28 and 35 levels. The number of levels must agree with the number of eta surfaces allocated (e_vert). Users may alternatively request only the number of levels (with e_vert), and the real program will compute values. There are two methods that can be selected: auto_levels_opt = 1 (old) or 2 (new). The old computation assumes a known first several layers, then generates equi-height spaced levels up to the top of the model. The new method uses surface and upper stretching factors (dz_stretch_s and dz_stretch_u) to stretch levels according to log p, up to the point of maximum thickness (max_dz), and starting from thickness dzbot. The stretching transitions from dzstretch_s to dzstretch_u by the time the thickness reaches max_dz/2.

 

Minimum number of levels as function of dzstretch and p_top for dzbot=50 m and max_dz=1000 m

dzstretch\ptop

50

30

20

10

1

1.1

44

47

50

54

67

1.2

32

35

37

41

54

1.3*

28

31

33

37

50

 

*1.3 reaches 1 km thickness below about 5 km (level 13) – probably not recommended

1.2 reaches 1 km thickness at around 7 km (level 19)

1.1 reaches 1 km thickness at around 13 km (level 36)

 

dzstretch = 1.1 has 12 levels in lowest 1 km, 34 levels below 10 km

dzstretch = 1.2 has 9 levels in lowest 1 km, 22 levels below 10 km

dzstretch = 1.3 has 8 levels in lowest 1 km, 18 levels below 10 km

 

Minimum number of levels when dzstretch_s and dzstretch_u are used

dzstretch\ptop

50

30

20

10

1

1.2-1.02

53

58

62

67

81

1.2-1.04

46

49

51

55

68

1.2-1.06

41

44

47

50

63

1.3-1.1

33

36

39

43

56

 

To avoid max thickness in the upper troposphere, stretching levels need to extend above the tropopause before going to constant d (logp). This can be done by using low enough dzstretch_u values (but larger than ~1.02) to reach the tropopause, while also stretching fast enough to compensate lapse rate.

 

Two other namelists can be used to add flexibility: dzbot, which is the thickness of the first model layer between full levels (the default value is 50 m), and max_dz, which is the maximum layer thickness allowed with the default value of 1000 m.