This page gives an overview into how to compile and run WRF on Magnus.

Compiling and running standard WRF on magnus

Before running a particular version of WRF, it is useful to go to the WRF users site and look at the "Known Issues" section for that particular version for both WRF and WPS.

It also helps to subscribe to the WRF users mailing list as well as the WRF news mailing list.

There is also a WRF Discussion forum


Get the WRF and WPS (WRF pre-processor) source code, for example, using wget:

wget http://www2.mmm.ucar.edu/wrf/src/WRFV3.8.1.TAR.gz 
wget http://www2.mmm.ucar.edu/wrf/src/WPSV3.8.1.TAR.gz

Now decompress and un-tar the files:

tar -zxvf WRFV3.8.1.TAR.gz
tar -zxvf WPSV3.8.1.TAR.gz

WRF must be compiled before compiling WPS. So:

cd WRFV3
./clean -a

"clean -a" is required every-time before you re-compile WRF. This applies to compilation of most codes. This in not strictly necessary if you just got the code, but good practice as a matter of principle. WRF requires the NetCDF library, so:

module swap PrgEnv-cray PrgEnv-intel 
module load cray-netcdf 
export NETCDF=/opt/cray/pe/netcdf/default/INTEL/160


50 (dmpar). INTEL (ftn/icc): Cray XC

and choose to compile with basic nesting (option 1):

Open configure.wrf and edit the line

#OPTAVX          =       -xAVX

OPTAVX          =       -xAVX

i.e. remove the #.

To compile on Magnus, you need to compile on the command line and NOT as a batch job:

nohup ./compile em_real >& compile_log &

nohup runs the compilation in the back-ground and makes the process immune to ssh hang-ups.

To check if the code compiled, the following executable files should have been created in the "main" directory:

ls -l main/*.exe

Should return something like this:

-rwxrwx--- 1 jatinkala y98 35308789 Jan 22 15:14 main/ndown.exe
-rwxrwx--- 1 jatinkala y98 34628021 Jan 22 15:14 main/nup.exe
-rwxrwx--- 1 jatinkala y98 35291483 Jan 22 15:15 main/real.exe
-rwxrwx--- 1 jatinkala y98 34763221 Jan 22 15:14 main/tc.exe
-rwxrwx--- 1 jatinkala y98 39887815 Jan 22 15:13 main/wrf.exe

Note, that symbolic links will have automatically been crated in the "run" directory:

ls -l run/*.exe

Should return something like this:

lrwxrwxrwx 1 jatinkala y98 17 Jan 22 15:15 run/ndown.exe -> ../main/ndown.exe
lrwxrwxrwx 1 jatinkala y98 15 Jan 22 15:15 run/nup.exe -> ../main/nup.exe
lrwxrwxrwx 1 jatinkala y98 16 Jan 22 15:15 run/real.exe -> ../main/real.exe
lrwxrwxrwx 1 jatinkala y98 14 Jan 22 15:15 run/tc.exe -> ../main/tc.exe
lrwxrwxrwx 1 jatinkala y98 15 Jan 22 15:13 run/wrf.exe -> ../main/wrf.exe

The "run" directory is where we will be running WRF later on.

Now, to compile WPS, fist cd there:

cd ../WPS

As with compiling WRF, first run "clean -a":

./clean -a

Then run the configure:


Pick option 40:

40.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar_NO_GRIB2)

Compiling WPS on the command line:

nohup ./compile >& compile_log &

After compilation, the following 3 executables should have been created:

ls -l *.exe

Should return something like this:

lrwxrwxrwx 1 jatinkala y98 23 Jan 22 15:27 geogrid.exe -> geogrid/src/geogrid.exe
lrwxrwxrwx 1 jatinkala y98 23 Jan 22 15:28 metgrid.exe -> metgrid/src/metgrid.exe
lrwxrwxrwx 1 jatinkala y98 21 Jan 22 15:27 ungrib.exe -> ungrib/src/ungrib.exe


Before running WRF and WPS, it's a good idea to get yourself a copy of the
WRF-ARW Documentation

Also refer to the WRF tutorial page. Select the latest available tutorial under WRF Basic Tutorial Presentations. Click on the latest one, and refer to the slides on WPS "General" and "Setup and Run". Have a browse through the slides.


Ok, as per the tutorial slides, the first step is to run geogrid.exe to set-up the domain of interest and pick a projection. Here is a sample namelist.wps file which will work. We are running over two nested domains, over a period of 5 days only (some namelist inputs have 3 values, the 3rd in this case will be ignored although its there, because max_dom is set to 2).

 wrf_core = 'ARW',
 max_dom = 2,
 start_date = '2009-10-01_00:00:00','2009-10-01_00:00:00','2009-10-07_00:00:00',
 end_date   = '2009-10-05_00:00:00','2009-10-05_00:00:00','2009-10-05_00:00:00',
 interval_seconds = 21600,
 io_form_geogrid = 2,
 opt_output_from_geogrid_path = 'geogrid-out/',
 debug_level = 0,

 parent_id         = 1,1,2,
 parent_grid_ratio = 1,5,5,
 i_parent_start    = 1,34,58,
 j_parent_start    = 1,28,37,
 e_we          = 103,176,331,
 e_sn          = 84,141,276,
 geog_data_res = '10m','5m','30s',
 dx = 50000,
 dy = 50000,
 map_proj =  'lambert',
 ref_lat   = -32.5,
 ref_lon   = 116.66,
 truelat1  = -31.5,
 truelat2  = -33.5,
 stand_lon = 116.66,
 geog_data_path = '/group/y98/jatinkala/WRF35_geog/geog', 
 ref_x = 51.5,
 ref_y = 42.0,

 out_format = 'WPS',
 prefix = 'ungrib-out/FNL',

 fg_name = 'ungrib-out/FNL',
 io_form_metgrid = 2,
 opt_output_from_metgrid_path = 'metgrid-out/',


Some important notes at this point:

  1. Each and every one of these namelist options is described in details in WRF-ARW Documentation. It pays to have a good look through!
  2. Note that you need to create the directory "geogrid-out" before running geogrid.exe, as this is where outputs will be written. If "opt_output_from_geogrid_path" was not defined, then ouputs would be created in the current directory. However, you will probably want to have several different domains for different simulations, hence, it is useful to output to different directory each time.

Here is a sample job script to run geogrid.exe:

#SBATCH --account=y98
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=00:30:00
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=juliaandrys@gmail.com
#SBATCH --export=NONE
module load netcdf/4.1.3
srun ./geogrid.exe >& geogrid_out

Note: Previously, one could run this on the command-line, but that no longer seems to work, so submitting a job script is required.

You know geogrid.exe finished sucessfully as the output log-file should end with:

!  Successful completion of geogrid.        !

Now, have a look at the output:

module load ncview
ncview geogrid-out/geo_em.d01.nc
ncview geogrid-out/geo_em.d02.nc


Ok, you are now happy with your domain. Now is the time to prepare the input forcing data to run WRF with. These are usually re-analyses datasets, most of which come in GRIB file format. WRF cannot use this file format, so we first need to un-grib the files. This is the sole purpose of ungrib.exe.

There are 3 main re-analysis data-sets used to run WRF with, these are:

  • The NCEP/NCAR, also referred to as NNRP
    • Available from 1940's onwards, 2.5 by 2.5 degree resolution
    • Stored on data.pawsey.org.au at:
/projects/SWWA Downscaled Climate/RE-ANALYSIS-DATA-SETS/NNRP
  • The NCEP Final re-analysis, also referred to as FNL
    • Available from late 1999 onwards
    • 1 by 1 degree resolutiion
    • stored on cortex at:
/projects/SWWA Downscaled Climate/RE-ANALYSIS-DATA-SETS/FNL
  • The ERA-interim re-analysis
    • Available from 1980 onwards
    • 0.75 by 0.75 degrees resolution
    • Stored on cortex at:
/projects/SWWA Downscaled Climate/RE-ANALYSIS-DATA-SETS/ERA-INT-0.75

In this example, we are going to use the FNL re-analysis data grib files. Please refer to the page on Moving Data for information on how to access data from the data store.

Once you have the grib files, you need to use the "./link_grib.csh" utility, as per the WPS slides:

./link_grib.csh fnl_200910*

This should produce a whole bunch of files called GRIBFILE.AAA, GRIBFILE.AAB, and so forth.

Now, variables in grib files are given particular numbers for variable names. These are defined in Variable Grib tables. Depending on where the data came from, you need to use a different so-called "Vtable". See the WPS documentation.

When running with FNL data you need this Vtable:


When running with NNRP data you need this Vtable:


When running with Era-Interim you need this Vtable:


Since we are using FNL data, we need to do:

ln -s ungrib/Variable_Tables/Vtable.GFS Vtable

This created a soft-link called Vtable, which points to the right file:

ls -l Vtable

Should return:

lrwxrwxrwx 1 jatinkala y98 33 Jan 23 14:24 Vtable -> ungrib/Variable_Tables/Vtable.GFS

Now we are ready to run ungrib.exe over the period that we are interested in. Here is a sample job script:

#SBATCH --account=y98
#SBATCH --ntasks=1 --ntasks-per-node=1
#SBATCH --time=12:00:00
#SBATCH --mail-type=END --mail-type=FAIL
#SBATCH --mail-user=juliaandrys@gmail.com
#SBATCH --export=NONE
srun ./ungrib.exe >& ungrib.out

You will know ungrib.exe successfully finished if the log file ends with:

!  Successful completion of ungrib.   !

You should probably clean up your directory as this point as well

rm fnl_*

Have a quick look at the files in "ungrib-out" or whatever you decided to name the directory where outputs from ungrib.exe are going to be written.


Now that we have un-gribbed the files, we need to interpolate it the domain specified when we ran geogrid.exe. This is done by metgrid.exe.

Metgrid uses data stored in METGRID.TBL. The METGRID.TBL file varies with the forcing data used and tables for some of the reanalysis and GCM data we have used are as follows:
- ERA-Interim
- MIROC3.2
- CSIROmk3.5

Sample job script:

#SBATCH --account=y98
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=18:00:00
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=juliaandrys@gmail.com
#SBATCH --export=NONE
module load netcdf
srun ./metgrid.exe >& metgrid.out

Note here we are running metgrid.exe in parallel. This provides a bit of mileage, but one should not use any more than say 10 to 12 cpus.

You know metgrid.exe finished successfully if the log file ends with:

!  Successful completion of metgrid.  !

Have a look at the met_em_d0* files in "metgrid-out" directory, or whatever you decide to call your directory. Namely, pay attention to the number of metgrid levels and soil levels, for example:

ncdump -h met_em.d01.2009-10-01_00\:00\:00.nc | grep 'num_metgrid_levels ='
ncdump -h met_em.d01.2009-10-01_00\:00\:00.nc | grep 'num_sm_layers ='

This will vary depending on the data we use. The number of metgrid levels and soil layers is used later in the namelist.input file used to run real.exe and wrf.exe later.

This is the end of WPS pre-processing!


Ok, the WPS processing is over now. Before before running wrf.exe, we still need one additional step of post-processing. This is because there are many different ways that wrf.exe can use the input data in the met_em_d0* files. Depending on some options in the namelist.input file (this is the input file for running real.exe and wrf.exe), real.exe will prepare the final input files which will be used by wrf.exe.

First we need to go the the WRF run directory:

cd ../WRFV3/run

Ok, we can run WRF in this directory. If we do outputs will be written here. But what if you want to run several simulations? Hence it is useful to create a new directory and link everything to it. For example:

mkdir test_run1
cd test_run1
ln -s ../* .

The last ln command links everything from 1 level back-wards to where we are. THERE IS ONE GOTCHA HERE!!! Make sure you delete the namelist.input file provided by default before you do anything:

rm namelist.input

We do not want the namelist.input file to be a link. It may create confusions later on.

Now, since real.exe needs as input met_em_d0* files, these need to be in the directory where we run real.exe. Rather than making a copy, we can just make soft links:

ln -s ../../../WPS/metgrid-out/met_em.d0* .

Now, you need to have a namelist.input file. Here is a sample:

 run_days                            = 5,
 run_hours                           = 0,
 run_minutes                         = 0,
 run_seconds                         = 0,
 start_year                          = 2009, 2009, 2009,
 start_month                         = 10,   10,   10,
 start_day                           = 01,   01,   07,
 start_hour                          = 00,   00,   01,
 start_minute                        = 00,   00,   00,
 start_second                        = 00,   00,   00,
 end_year                            = 2009, 2009, 2010,
 end_month                           = 10,   10,   12,
 end_day                             = 05,   05,   01,
 end_hour                            = 00,   00,   00,
 end_minute                          = 00,   00,   00,
 end_second                          = 00,   00,   00,
 interval_seconds                    = 21600
 input_from_file                     = .true.,.true.,.true.,
 history_interval                    = 60,  60,   60,
 frames_per_outfile                  = 1, 1, 1, 
 restart                             = .false.,
 restart_interval                    = 10080,
 io_form_history                     = 2
 io_form_restart                     = 2
 io_form_input                       = 2
 io_form_boundary                    = 2
 debug_level                         = 0 
 io_form_auxinput4                   = 2 ! this is to use sst data
 auxinput4_inname                    = "wrflowinp_d<domain>" ! this is to use sst data
 auxinput4_interval                  = 360,360,360, ! to use sst data

 time_step                           = 300,
 time_step_fract_num                 = 0,
 time_step_fract_den                 = 1,
 max_dom                             = 2,
 e_we                                = 103,176,331,
 e_sn                                = 84,141,276,
 e_vert                              = 30,30,30,
 eta_levels = 1.00,0.995,0.99,0.98,0.97,0.96,0.94,0.92,0.89,0.86,0.83,0.80,0.77,0.72,0.67,0.62,0.57,0.52,0.47,0.42,0.37,0.32,0.27,0.22,0.17,0.12,0.07,0.04,0.02,0.00
 p_top_requested                     = 5000,  
 num_metgrid_levels                  = 27,
 num_metgrid_soil_levels             = 4,
 dx                                  = 50000, 10000,2000,
 dy                                  = 50000, 10000,2000,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 i_parent_start                      = 1,34,58,
 j_parent_start                      = 1,28,37,
 parent_grid_ratio                   = 1,     5,     5,
 parent_time_step_ratio              = 1,     5,     5,
 feedback                            = 0,
 smooth_option                       = 0

 mp_physics                          = 4,     4,     4,
 mp_zero_out                         = 2 ! from J.Evans namelist
 mp_zero_out_thresh                  = 1.e-8 ! from J.Evans namelist
 ra_lw_physics                       = 1,     1,     1,
 ra_sw_physics                       = 1,     1,     1,
 radt                                = 10,    10,    10,
 cam_abs_freq_s                      = 10800 
 levsiz                              = 59 ! same as above comment
 paerlev                             = 29 ! same as above comment
 cam_abs_dim1                        = 4 ! same as above comment
 cam_abs_dim2                        = 28 ! same as above comment
 sf_sfclay_physics                   = 1,     1,     1,
 sf_surface_physics                  = 2,     2,     2,
 bl_pbl_physics                      = 1,     1,     1,
 bldt                                = 0,     0,     0,
 cu_physics                          = 1,     1,     0,
 cudt                                = 5,     0,     5,
 isfflx                              = 1,
 ifsnow                              = 0,
 icloud                              = 1,
 surface_input_source                = 1,
 num_soil_layers                     = 4,
 sst_update                          = 1, ! from J.Evans script to use sst data
 sst_skin                            = 1,
 tmn_update                          = 1,
 lagday                              = 150,
 usemonalb                           = .true. ! from J.Evans script, this is to use monthly albedo maps
 slope_rad                           = 1, ! from J.Evans script, this turns on slope effects for ra_sw_physics
 sf_urban_physics                    = 0,     0,     0,
 maxiens                             = 1,
 maxens                              = 3,
 maxens2                             = 3,
 maxens3                             = 16,
 ensdim                              = 144,

 grid_fdda                           = 0, 0, 0, ! apply spectral nudging to outer grid
 gfdda_inname                        = "wrffdda_d<domain>",
 gfdda_interval_m                    = 360,
 fgdt                                = 0,
 xwavenum                            = 5, ! total grid size in x divide by 1000
 ywavenum                            = 4, ! total grid size in y divide by 1000
 if_no_pbl_nudging_ph                = 1, ! no nudge in pbl
 if_no_pbl_nudging_uv                = 1,
 if_no_pbl_nudging_t                 = 1,
 if_zfac_ph                          = 1, ! nudge above k_zfac_ph only
 k_zfac_ph                           = 10,
 dk_zfac_ph                          = 1,
 if_zfac_uv                          = 1,
 k_zfac_uv                           = 10,
 dk_zfac_uv                          = 1,
 if_zfac_t                           = 1,
 k_zfac_t                            = 10,
 dk_zfac_t                           = 1,
 gph                                 = 0.0003,
 guv                                 = 0.0003,
 gt                                  = 0.0003,
 io_form_gfdda                       = 2,

 rk_ord                              = 3, ! from J.Evans script
 w_damping                           = 0,
 diff_opt                            = 1,
 km_opt                              = 4,
 diff_6th_opt                        = 0,      0,      0,
 diff_6th_factor                     = 0.12,   0.12,   0.12,
 base_temp                           = 290.
 damp_opt                            = 3,
 zdamp                               = 5000.,  5000.,  5000.,
 dampcoef                            = 0.05,    0.05,    0.05
 khdif                               = 0,      0,      0,
 kvdif                               = 0,      0,      0,
 non_hydrostatic                     = .true., .true., .true.,
 moist_adv_opt                       = 1,      1,      1,
 scalar_adv_opt                      = 1,      1,      1,

 spec_bdy_width                      = 10,
 spec_zone                           = 1,
 relax_zone                          = 9,
 specified                           = .true., .false.,.false.,
 nested                              = .false., .true., .true.,


 nio_tasks_per_group = 0,
 nio_groups = 1,

Sample job script to run real.exe:

#SBATCH --account=y98
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=18:00:00
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=juliaandrys@gmail.com
#SBATCH --export=NONE
module load netcdf
srun  ./real.exe >& real.out

You will know if real.exe finished sucessfully if the rsl.error.* and rsl.out.* files finish with something like this:

d01 2009-10-05_00:00:00 real_em: SUCCESS COMPLETE REAL_EM INIT


  • These sample namelist files are already designed to work. If you are doing a simulation from scratch with a different domain, you need to make sure the domain specs and time specs in namelist.wps and namelist.input match.
  • You need to become familiar with all these namelist option. There is no substitute but to go over them one by one in the WRF-ARW Documentation.

real.exe will produce the following files:

  • wrfbdy_d01 - This contains the boundary conditions every 6 hours which will be used to update boundary conditions during the simulation. No matter how many domains you use, this file will only exist for d01, and the second nest gets it's info from the outer nest
  • wrfinput_d0* files - This has initial conditions to initialise the model. You will find that there is only "1 time" in these files, which makes sense, because we only need initial conditions at the start.
  • wrflowinp_d0* files - These contain SST data, deep soil temperatures, climatological albedos etc, if you choose to use these data as per the namelist.input file.
  • wrffdda_d0* files - These will only be created if you decided to use any form of nudging.


Ok, now we are ready to run WRF!!! Usually one would run real.exe for 1 extra day than required, to be sure all input data is there. So, for the purposes of this test-case, before running wrf.exe, edit the namelist.input to run for only 4 days and not 5, i.e., change "run_days" to 4, and "end_day" to 04, to be on the safe side. Here is a sample script:

#SBATCH --account=y98
#SBATCH --ntasks=168
#SBATCH --ntasks-per-node=24
#SBATCH --time=18:00:00
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=juliaandrys@gmail.com
#SBATCH --export=NONE
module swap PrgEnv-cray PrgEnv-intel
module load cray-netcdf
export NETCDF=/opt/cray/netcdf/4.3.0/INTEL/130/
srun ./wrf.exe >& wrf.out

Note: The number of CPUs you request needs to be "proportional" to the domain size. Bigger domain = more CPUs. If you request too many CPUs for a relatively small domain, wrf.exe will probably blow up. It can be a matter of trial and error.

You know wrf.exe finished sucessfully if the rsl.error.* files and rsl.out.* files end with:


You should see wrfout_d0* files. These are the WRF output files. You can ncview these. Use NCL to analyze, plot the outputs.

rsl.error and rsl.out files are created for each CPU used. If wrf.exe crashes, the error may only be written in the last modified file. The only way to find which was the last modified file is:

ls -lrt rsl.out.*
ls -lrt rsl.error.*

The last modified file will be listed last, you can then tail it.

Compiling and running modified WRF for Climate CORDEX type simulations

Workflow for WRF regional climate simulations and scripts to automate the 30 year runs are available from the Murdoch Atmos Lab Bitbucket in the WRF-Workflow directory.

A modified version of WRFV3.5.1 is available to run CORDEX type simulations. The difference to standard WRFV3.5.1 is that the radiation schemes can update CO2 concentrations and additional diagnostics are computed.

For information about the diagnostics, a manual is available here (this was written for the WRF3.3-CORDEX version).

Info on how the CO2 concs are read can be found here (this was also written for the WRF3.3-CORDEX version, and contains info relevant to running on the NCI machines, which is not directly relevant).

To use this code, first create a dir where you want to run, cd to it and clone the code:

git clone /scratch/y98/jatinkala/WRF3.5.1-Cordex/WRFV_3.5.1/WRFV_3.5.1

cd to WRF dir:

cd WRFV_3.5.1/WRFV3/

load modules:

module swap PrgEnv-cray PrgEnv-intel 
module load cray-netcdf 
export NETCDF=/opt/cray/netcdf/4.3.0/INTEL/130/

run clean:

./clean -a

Now, DO NOT run ./configure (explained later), but:

cp configure.wrf.magnus configure.wrf
nohup ./compile em_real >& compile_log &

To compile WPS:

cd ../WPS/
./clean -a

Again, DO NOT run configure:

cp configure.wps.magnus configure.wps
nohup ./compile >& compile_log &

It should compile fine.

That's it, you are ready to roll. For more details on what Jatin modified, read on if you wish.

This modified version was git cloned by Jatin using:

git clone z3381484@cyclone.ccrc.unsw.edu.au:/home/z3368490/S/WRFV_3.5.1

The configure script and files in the arch directory in this version of the code have been modified to automatically have the right "machine options" for running at the NCI. I had to put back the default:

rm configure
cp /scratch/y98/jatinkala/WRF_testing/WRFV3/configure .
rm -rf arch/
cp -r /scratch/y98/jatinkala/WRF_testing/WRFV3/arch .

After running ./configure, i added -DCLWRFGHG to configure.wrf in ARCHFLAGS (this is to update CO2 concs):

I replaced around line 61:




I've also made a copy of the configure.wrf:

cp configure.wrf configure.wrf.magnus

For compiling WPS, i also needed to replace the configure file with default, as it has been tweaked with to provide the right options for raijin at NCI.

rm configure
cp /scratch/y98/jatinkala/WRF_testing/WPS/configure .
rm -rf arch/
cp -r /scratch/y98/jatinkala/WRF_testing/WPS/arch .

I've also made a copy of the configure.wps:

cp configure.wps configure.wps.magnus

Compiling and running standard WRF on zeus

It is useful to use zeus, rather than magnus, to run WPS and real.exe.
To compile, run the following on the command line:

module swap gcc intel
module load netcdf/4.5.0
module load openmpi/2.1.2

During configure, for both WRF and WPS, pick the dmpar intel ifort/icc option:

INTEL (ifort/icc)


On zeus, unlike magnus, WRF and WPS must be compiled via a job script, which is sbatch'ed:

#!/bin/bash --login
#SBATCH --nodes=1
#SBATCH --partition=workq
#SBATCH --time=04:00:00
#SBATCH --account=y98
#SBATCH --export=NONE
module swap gcc intel
module load netcdf/4.5.0
module load openmpi/2.1.2
./compile em_real >& compile_log

Both WRF and WPS should compile fine.

To run WPS on zeus:

#!/bin/bash --login
#SBATCH --nodes=1
#SBATCH --partition=workq
#SBATCH --time=04:00:00
#SBATCH --account=y98
#SBATCH --export=NONE

module swap gcc intel
module load netcdf/4.5.0
module load openmpi/2.1.2
srun --export=all -n 1 ./geogrid.exe >& geogrid_log
srun --export=all -n 1 ./metgrid.exe >& metgrid_log

Navigating through the WRF source code

All the physics options source code can be viewed (and modified if you wish), under the ../phys directory.
If you have already compiled WRF, there will be three types of files there, *.F, *.f90, and *.mod.
*.mod files are the compiled modules, no need to look at these!
*.F is the original code
*.f90 is the original code, but will all comments removed.
When you run ./clean -a, the *.mod and *.f90 are deleted. The *.F come with the source. This is what you want to look at.

e.g. I want to know how roughness length is computed by the noah lsm?

Well, the lsm is specified in namelist.input as:
So, the source code is going to be names something like:

You will figure out that the noah LSM source code is:

You can then search for "roughness length", and you will find two roughness lenghts defined as:

!   Z0BRD      Background fixed roughness length (M)
!   Z0         Time varying roughness length (M) as function of snow depth

You can search for these, and see how they are computed.
Good luck.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License