How to set up and run WRF model Wei Wang NCAR/MMM.

35
How to set up and run WRF model Wei Wang NCAR/MMM

Transcript of How to set up and run WRF model Wei Wang NCAR/MMM.

Page 1: How to set up and run WRF model Wei Wang NCAR/MMM.

How to set up and run WRF model

Wei Wang

NCAR/MMM

Page 2: How to set up and run WRF model Wei Wang NCAR/MMM.

Outline

How to download and compile the WRF model code?

Namelist Input and output files

Page 3: How to set up and run WRF model Wei Wang NCAR/MMM.

How to download and compile WRF?

Download WRF source code from

http://www.wrf-model.org/users/download.html What you get is

WRFV1.3.TAR.gz After gunzip and untar, you should see a directory

WRFV1/ cd to WRFV1/ directory, and you should see ..

Page 4: How to set up and run WRF model Wei Wang NCAR/MMM.

WRFV1 directoryCHANGESMakefileREADMEREADME_test_casesRegistry/ - add/remove input/output, new variablesarch/ - architecture-dependent compile optionscleancompileconfiguredyn_eh/dyn_em/external/frame/inc/main/ - main programs: real, ideal, wrf, executablesphys/ - physics routinesrun/share/test/ - where you run the modeltools/

Page 5: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile?

Type ‘configure’ to create configure.wrf file for your particular computer:

> ./configurechecking for perl5... nochecking for perl... found /usr/local/bin/perl (perl)Will use NETCDF in dir: /usr/local/netcdf-------------------------------------------------------Please select from among the following supported platforms.

1. Compaq OSF1 alpha (single-threaded) 2. Compaq OSF1 alpha SM (OpenMP) 3. Compaq OSF1 alpha DM/SM (RSL, MPICH, RSL IO, OpenMP) 4. Compaq OSF1 alpha DM/SM (RSL, DECMPI, RSL IO, OpenMP)

Enter selection [1-4] : 1

Page 6: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile?You’ll see, for example:

You have chosen: Compaq OSF1 alpha (single-threaded)These are the default options for this platform:--------------------------------------------------------------#OMP = OMPCPP = FC = f90CC = ccCFLAGS =FCOPTIM = -fast -O4 -inline all……--------------------------------------------------------------These will be written to the file configure.wrf here in the top-leveldirectory. If you wish to change settings, please edit that file.If you wish to change the default options, edit the file: arch/configure.defaults

Configuration successful. To build the model type compile .

Page 7: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile?

You may want to edit configure.wrf to change default compile options.

In WRF V1.3, compile options are provided for

SGI (single, OpenMP, MPI)

Sun (single and OpenMP – higher version required)

IBM AIX (single, OpenMP, MPI)

Alpha OSF (single, OpenMP, MPI)

Alpha Linux (single, MPI)

Linix (single, OpenMP, MPI)

Page 8: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile?

After typing compile, you will be given a list of options:

compile em_b_wave

compile em_hill2d_x

compile em_quarter_ss

compile em_real

compile em_squall2d_x

compile em_squall2d_y

Typing one of the above will produce both initialization and model executables

Page 9: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile?

Type one of the above to compile e.g. compile em_real If compile is successful, you should have two executables

built in directory main/: real.exe wrf.exe And these executables are linked to ./test/em_real/ if you

typed compile em_real If you type compile em_quarter_ss you’d have ideal.exe wrf.exe linked to ./test/em_quarter_ss/

Page 10: How to set up and run WRF model Wei Wang NCAR/MMM.

How to compile? - Hints

If the netCDF library is built in a ‘unusual’ location on your computer, you may use the environment variable NETCDF to provide the correct path to configure. e.g.

setenv NETCDF /usr/local/lib32/r4i4

If you compile on a Linux computer, make sure that you have netCDF library installed with PGI compiler.

Page 11: How to set up and run WRF model Wei Wang NCAR/MMM.

WRFV1/test directory

eh_b_wave/eh_hill2d_x/eh_quarter_ss/eh_real/eh_squall2d_x/eh_squall2d_y/em_b_wave/em_hill2d_x/em_quarter_ss/em_real/em_squall2d_x/em_squall2d_y/

There are six subdirectories for each dynamical core (we recommend that you use the em core):

Page 12: How to set up and run WRF model Wei Wang NCAR/MMM.

The following are in the test/em_real/ directory:

LANDUSE.TBL

RRTM_DATA

eta_micro_loopup.dat

tr49t67

tr49t85

tr67t85

namelist.input - require editing

real.exe -> ../../main/real.exe

wrf.exe -> ../../main/wrf.exe

test/em_real directory

Physics data

Page 13: How to set up and run WRF model Wei Wang NCAR/MMM.

Before you run real.exe or ideal.exe, and wrf.exe, edit the namelist.input for runtime options

More information on namelist can be found in

WRFV1/run/README.namelist

and on the Web:

http://www.mmm.ucar.edu/wrf/users/wrf-namelist.html

namelist.input

Page 14: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_01 time_step_max = 1, number of time steps to run max_dom = 1, number of domains (leave as is) dyn_opt = 2, dynamics option: 1 = Eulerian height coordinate 2 = Eulerian mass coordinate 3 = Semi-Lagrangian (not yet implemented)

rk_ord = 3, time-integration scheme option

2 = Runge-Kutta 2nd order

3 = Runge-Kutta 3rd order

Description of namelist_01

Page 15: How to set up and run WRF model Wei Wang NCAR/MMM.

diff_opt = 1, diffusion option:

0 = no turbulence or explicit spatial numerical filters

1 = old diffusion scheme, evaluates diffusion terms on coordinate surfaces(uses khdiv,kvdif)

2 = new diffusion scheme, evaluates mixing terms in physical space (stress form turbulence parameterization by specifying km_opt)

km_opt = 1, eddy coefficient option 1 = constant (use khdiv kvdif) 2 = 1.5 order TKE closure 3 = Smagorinsky first order closure (3d)

4 = Smagorinsky first order closure (2d)

damp_opt = 1, upper level damping flag (for diff_opt=2 only) 0 = without damping 1 = with damping

Description of namelist_01

Page 16: How to set up and run WRF model Wei Wang NCAR/MMM.

ISFFLX = 1, heat and moisture fluxes from the surface 1 = with fluxes from the surface 0 = no flux from the surface

IFSNOW = 0, snow-cover effects (for bl_surface_physics=1 only)

1 = with snow-cover effect 0 = without snow-cover effect

ICLOUD = 1, cloud effect to the optical depth in radiation

(for ra_lw_physics = 1 and ra_sw_physics = 1 only) 1 = with cloud effect

0 = without cloud effect

Description of namelist_01

Page 17: How to set up and run WRF model Wei Wang NCAR/MMM.

num_soil_layers = 4, number of soil layers in land surface model

spec_bdy_width= 5, number of rows for specified boundary value nudging

spec_zone = 1, number of points in specified zone (spec b.c. option)

relax_zone = 4, number of points in relaxation zone (spec b.c. option)

tile_sz_x = 0, number of points in tile x direction

tile_sz_y = 0, number of points in tile y direction

numtiles = 1, number of tiles per patch (alternative to above two)

debug_level = 0/ 50,100,200,300 values give increasing prints

Description of namelist_01

Page 18: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_02

grid_id = 1, domain identifier

level = 1, domain nest level

s_we = 1, start index in x (west-east) direction

e_we = 32, end index in x (west-east) direction

s_sn = 1, start index in y (south-north) direction

e_sn = 32, end index in y (south-north) direction

s_vert = 1, start index in z (vertical) direction

e_vert = 31, end index in z (vertical) direction

Description of namelist_02

Page 19: How to set up and run WRF model Wei Wang NCAR/MMM.

Description of namelist_02

time_step_count_start = 0, start time-step (leave as is)

time_step_count_end = 10, end time-step (this is inactive)

time_step_count_output = 10, time-steps between history outputs

frames_per_outfile = 10, output times per history file

time_step_count_restart = 10, time-steps between restart outputs

time_step_begin_restart = 0, time-step of restart beginning

0=not a restart

time_step_sound = 4, number of sound steps per timestep

Page 20: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_03

dx = 2000, grid length in x direction

dy = 2000, grid length in y direction

dt = 12., time-step for advection

ztop = 20000., the height of the model top

zdamp = 5000., damping depth from model top

dampcoef = 0.2, damping coefficient (dampcoef <= 0.25)

smdiv = 0, divergence damping (0.1 is typical)

emdiv = 0.01, external-mode filter coef for mass coord (0.01 is typical for real data)

epssm = .1, time off-centering for vertical sound waves

khdif = 0, horizontal diffusion constant (m^2/s)

kvdif = 0, vertical diffusion constant (m^2/s)

mix_cr_len = 200, the critical value of the mixing length for

isotropic and anisotropic diffusion

Description of namelist_03

Page 21: How to set up and run WRF model Wei Wang NCAR/MMM.

radt = 10, minutes between radiation physics calls

bldt = 0, minutes between boundary-layer physics calls

cudt = 5, minutes between cumulus physics calls

julyr = 0, Julian Year for model start

julday = 1, Julian Day for model start

gmt = 0./ GMT time for model start

Description of namelist_03

Page 22: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_04

periodic_x = .false., periodic boundary conditions in x direction

symmetric_xs = .false., symmetric boundary conditions at x start (west)

symmetric_xe = .false., symmetric boundary conditions at x end (east)

open_xs = .false., open boundary conditions at x start (west)

open_xe = .false., open boundary conditions at x end (east)

periodic_y = .false., periodic boundary conditions in y direction

symmetric_ys = .false., symmetric boundary conditions at y start (south)

symmetric_ye = .false., symmetric boundary conditions at y end (north)

open_ys = .false., open boundary conditions at y start (south)

open_ye = .false., open boundary conditions at y end (north)

nested = .false., nested boundary conditions (inactive)

specified = .true., specified boundary conditions (inactive)

top_radiation= .false., upper radiative boundary conditions (inactive)

Description of namelist_04

Page 23: How to set up and run WRF model Wei Wang NCAR/MMM.

chem_opt = 0, chemistry option

mp_physics microphysics option

= 0, no microphysics

= 1, Kessler scheme

= 2, Lin et al. scheme

= 3, NCEP 3-class simple ice scheme

= 4, NCEP 5-class scheme

= 5, Ferrier (new Eta) microphysics

= 99, Zhao-Carr (old Eta) microphysics

Description of namelist_04

Page 24: How to set up and run WRF model Wei Wang NCAR/MMM.

ra_lw_physics longwave radiation option

= 0, no longwave radiation

= 1, rrtm scheme

= 99, GFDL (Eta) longwave (semi-supported)

*remove –DTRIEDNTRUE from compile flags

ra_sw_physics shortwave radiation option

= 0, no shortwave radiation

= 1, Dudhia scheme

= 2, Goddard short wave

= 99, GFDL (Eta) shortwave (semi-supported)

*remove –DTRIEDNTRUE from compile flags

Description of namelist_04

Page 25: How to set up and run WRF model Wei Wang NCAR/MMM.

bl_sfclay_physics surface-layer option

= 0, no surface-layer

= 1, Monin-Obukhov scheme

= 2, Monin-Obukhov (Janjic Eta) scheme

bl_surface_physics land-surface option

= 0, no land-surface

= 1, thermal diffusion scheme

= 2, OSU land-surface model

bl_pbl_physics boundary-layer option

= 0, no boundary-layer

= 1, mrf scheme

= 2, Mellor-Yamada-Janjic (Eta) TKE scheme

Description of namelist_04

Page 26: How to set up and run WRF model Wei Wang NCAR/MMM.

cu_physics cumulus option

= 0, no cumulus

= 1, Kain-Fritsch (new) scheme

= 2, Betts-Miller-Janjic (Eta) scheme 

= 99, previous Kain-Fritsch scheme

Description of namelist_04

Page 27: How to set up and run WRF model Wei Wang NCAR/MMM.

h_mom_adv_order = 5, horizontal momentum advection order (5=5th,etc.)

v_mom_adv_order= 3, vertical momentum advection order

h_sca_adv_order= 5, horizontal scalar advection order

v_sca_adv_order= 3, vertical scalar advection order 

io_form_history = 2,

io_form_restart = 2,

io_form_initial = 2,

io_form_boundary = 2,

= 1, (not active)

= 2, netCDF format

Description of namelist_04

Page 28: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_05 (only used for real.exe pre-processed files, ignored otherwise)  

start_year = 2000, four digit year of starting time

start_month= 11, two digit (01-12) month of starting time

start_day = 20, two digit (01-31) day of starting time

start_hour = 12, two digit (00-23) hour of starting time

start_minute= 00, two digit (00-59) minute of starting time

start_second= 00, two digit (00-59) second of starting time 

end_year = 2000, four digit year of ending time

end_month = 11, two digit (01-12) month of ending time 

end_day = 21, two digit (01-31) day of ending time

 end_hour = 00, two digit (00-23) hour of ending time

end_minute = 00, two digit (00-59) minute of ending time 

end_second = 00, two digit (00-59) second of ending time

interval_seconds= 43200, time interval in seconds between analysis (and boundary) times

Description of namelist_05

Page 29: How to set up and run WRF model Wei Wang NCAR/MMM.

real_data_init_type which type of real input:

= 1, WRF SI

= 2, MM5 data (height model only at this time)

= 3, user written routine read_generic in module_si_io.F

 

Description of namelist_05

Page 30: How to set up and run WRF model Wei Wang NCAR/MMM.

&namelist_quilt

nio_tasks_per_group = 0, default value is 0, no quilting

nio_groups = 1, default 1, don’t change

Description of namelist_quilt

The following namelist controls asynchronized I/O for MPI:

Page 31: How to set up and run WRF model Wei Wang NCAR/MMM.

WRF input files

Running real.exe turns

real_input_em.d01.yyyy-mm-dd_hh:mm:ss

to

wrfinput_d01 and wrfbdy_d01

Running ideal.exe creates

wrfinput_d01 (and wrfbdy_d01, but wrfbdy is not used)

Page 32: How to set up and run WRF model Wei Wang NCAR/MMM.

How to run WRF?

To run WRF on a single processor, type

> wrf.exe >& wrf.out & To run WRF using OpenMP, one may need to choose how

many processors to use. To do this, type

> setenv OMP_NUM_THREADS 4

> wrf.exe >& wrf.out &

to select to run on 4-processor shared-memory computer. (Note, on some computer, if one doesn’t set the number of processors to use, the wrf.exe may use all processors available.)

Page 33: How to set up and run WRF model Wei Wang NCAR/MMM.

How to run WRF?

To run WRF on a MPI machine with MPICH, type > mpirun –np 4 wrf.exe The standard-out and error will go into the following files: show_domain_0000: domain-deposition info rsl.out.0000 rsl.error.0000 rsl.out.0001 rsl.error.0001 rsl.out.0002 rsl.error.0002 rsl.out.0003 rsl.error.0003 There will be one pair of files for each running processor

For other MPI-implementation, the run command may be different. For example, on IBM, the MPI run-command is

> poe wrf.exe

Page 34: How to set up and run WRF model Wei Wang NCAR/MMM.

WRF output files

After one runs wrf.exe, WRF produces these output files:

wrfout_d01_000000: history file

wrfrst_d01_nnnnnn: restart file where nnnnnn is model time step when the restart file is written.

If one splits output files, one may obtain:

wrfout_d01_xxxxxx

where xxxxxx is the time step at which the output file is written. For example,

wrfout_d01_000000

wrfout_d01_003600

Page 35: How to set up and run WRF model Wei Wang NCAR/MMM.

WRF output files

WRF input and output files

wrfinput_d01

wrfbdy_d01

wrfout_d01_xxxxxx

wrfrst_d01_xxxxxx

are netCDF files. So one can use netCDF utilities to look at file header and values of any fields. e.g.

ncdump –h wrfout_d01_000000 – gives a list of fields

ncdump –v U wrfout_d01_000000 – prints out values of

U field in the file.