Skip to content

Configuring WRF for Brazil

dlebauer edited this page Nov 4, 2014 · 11 revisions

Setting up WRF for meteorological downscaling in Brazil

WRF / WPS Documentation: http://www2.mmm.ucar.edu/wrf/users/docs/user_guide_V3/contents.html

Stampede documentation: https://github.com/ebimodeling/wrf-downscaling/blob/master/Stampede/instructions/wps-wrf-workflow-run

Download boundary conditions

geography

wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_complete.tar.bz2 
tar -xvjf geog_complete.tar.bz2 

Meteorology

  1. Download ERA interim files
python era-int/retrieve_eraint_data_for_wps.py --strt_dt='1987-09-30' --end_dt='1987-10-02'
  • this should provide the following files:
ERA-Int_pl_1987-09-29.grb
ERA-Int_pl_1987-09-30.grb
ERA-Int_sfc_1987-09-29.grb
ERA-Int_sfc_1987-09-30.grb

Download and extract WRF v 3.5.1

wget http://www2.mmm.ucar.edu/wrf/src/WRFV3.5.1.TAR.gz
mkdir WRFV351
tar -xzvf WRFV3.5.1.TAR.gz --strip-components 1 -C ./WRFV351/

Then replace the following files:

cd WRFV351/phys/
wget http://www2.mmm.ucar.edu/wrf/users/wrfv3.5/module_cu_gf.F
wget http://www2.mmm.ucar.edu/wrf/users/wrfv3.5/module_bl_mynn.F
wget http://www2.mmm.ucar.edu/wrf/users/wrfv3.5/module_radiation_driver.F

cd ../Registry/
wget http://www2.mmm.ucar.edu/wrf/users/wrfv3.5/Registry.EM_COMMON

Compiling WRF

On blacklight.psc.edu, the netcdf4 lib with parallel computing capability is version 4.1.3 compiled with phdf5 1.8.7. So we have to change configure.{wps|wrf} to add phdf5 lib path, otherwise netcdf lib linking fails.

install/namelist.wps bounding box for domain

Download and extract WPS

Download WPS geography data and untar into geog/ directory.

Create a WRF run directory which will house WRF output and have links to (or copies of) important WRF and WPS executables. Typically, this is on a /data or /scratch drive array with efficient I/O performance.

  • On Blacklight this is in /brashear/dlebauer/geog/ a.k.a. $SCRATCH/geog

WPS generates the WRF input files (see details in WRF guide Chapter 3).

wget http://www2.mmm.ucar.edu/wrf/src/WPSV3.5.1.TAR.gz
mkdir WPSV351
tar -xzvf WPSV3.5.1.TAR.gz --strip-components 1 -C ./WPSV351/

Configure WPS

Download ERA-Interim files: ERA-Int_pl_YYYY-MM-DD.grb = Pressure level atmospheric data ERA-Int_sfc_YYYY-MM-DD.grb = Surface data

From the WRF run directory, link to the ERA-Interim Vtable (located off the WPS build directory: ./ungrib/Variable_Tables/): ./link_grib.csh /directory/of/ERA-Int/data/ERA-Int

Edit namelist.wps in the run directory to provide start and end dates for the simulation and the interval_seconds of the atmospheric data.

ERA-Int_pl_1987-01-30.grb ERA-Int_sfc_1987-09-30.grb

 start_date = '1987-01-30_12:00:00',' '1987-01-30_12:00:00',
 end_date   = '1987-01-30_18:00:00','1987-01-30_12:00:00',
 interval_seconds = 21600
  • namelist.wps

The namelist.wps file identifies all the parameters related to the WPS model.

TODO ? Does this go after downloading the boundary conditions?

Run WPS

The WPS stage has three major steps:

  • TODO How to use these? What are the inputs and outputs for each step?
  1. geogrid.exe Run "geogrid.exe" to build static geography data on the domain: Determines latitude, longitude, map scale factors and Coriolis parameters at every grid point. Terrain height, soil type, land use category, vegetation fraction, etc. are regridded onto simulation domains.
mpirun -n 8 geogrid.exe # <arg1> <arg2> ...
  1. ungrid.exe

This will create intermediate files with the naming scheme as follows: :YYYY-MM-DD_HH where prefix is set in the namelist.wps file (in the &ungrib section).

ungrid.exe <arg1> <arg2> ...
  1. metgrid.exe (update "prefix" to reflect the "prefix" in the &ungrib section if necessary). This will generate met_em.d0.YYYY-MM-DD_HH:MIN:SS.nc netcdf files.
ungrid.exe <arg1> <arg2> ...

Initialize WRF (Configure and run real.exe)

  • Edit namelist.input to make domain settings consistent with namelist.wps.
  • Edit namelist.input to set start and end dates and interval_seconds appropriately for the atmospheric dataset.
  • Set the timestep appropriately for the domain resolution.
  • Set the num_metgrid_levels accordireal.eng to the atmospheric dataset vertical resolution.
  • Set the num_metgrid_soil_levels according to the number of soil levels in the land model of the forcing dataset.
  • Specify your desired vertial levels (for countless other parameters in this namelist, see the WRF documentation).

Run: real.exe (submit job scheduler script). Check rsl.out.0000 for successful completion.

Set up interactive node

qsub  -I -q debug -l ncpus=16 -l walltime=29:00
mpirun -np 4 ./real.exe

Configure WRF

After the WPS preprocessing, run WRF using two steps:

  1. Configure namelist.input file is the one that describes the parameters related to WRF model.
  • namelist.input control start/finish of run

Run WRF

Restart Run

Check the time of the last outputted WRF restart file: wrfrst_d0_YYYY-MM-DD_HH:MIN:SS Update start date in namelist.input and change restart to ".true.". Submit job scheduler script. Check rsl.out.0000 for successful completion. Follows same as New run except ... (?)

  • TODO what are the differences between settings for new run and estart?
    • namelist.input
      • set restart = .false., in namelist.input?
      • start_* must be the same as restart files
    • grib files from previous run - is the format the same?

Benchmark to optimize performance

Some key files to understand

  1. make_wrf_run_dir.py
  2. metgrid/METGRID.TBL
  3. Folder: wrfv351_eraint_1_5_2_1_1_1_1_spectral_18-6-2km/metgrid
  4. Folder: wrfv351_eraint_1_5_2_1_1_1_1_spectral_18-6-2km/Vtable
  5. retrieve_eraint_data_for_wps.py in the folder of /brashear/dlebauer/era-int
  6. ecmwf-api-client-python.tgz?version=4
  7. link_grib.csh
  8. namelist.wps
  9. namelist.input