You are on page 1of 5

10/11/21 23:50 srend manual: WRF_install

Srend Manual
Install WRF-ARW 3.8

These directions apply to a fairly recent Gnu/Linux distribution. It has worked in all of them tesuser, and these below apply specifically to Centos 7.5 .

The official UCAR directions are much more detailed, and here they are just in case:

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php

The directions below use key portions of this WRF 3.7 recipe, but they use bash (sh) instead of csh. The directions above include additional tests and further
directions for building WPS and prepping for real cases.

In any case, the steps for incorporating Srend within WRF will be the same, so the directions for building a basic WRF to run stock test cases are sufficient. There
are many documents, tutorials, examples, and pieces of code which can be viewed and downloaded from the WRF Model Users web site. This are stripped-down
essentials-only directions below. Consult the compilation tutorial and WRF site if problems arise. Many people use WRF around the world, so a web search is often
successful in finding solutions to common problems.

1. Create a working directory, say wrf: mkdir /home/user/wrf

Download WRF-ARW from: http://www2.mmm.ucar.edu/wrf/users/

You must register for this, and you must navigate to where you can
download WRF. Directions worked for 3.6, 3.7, and 3.3, but 3.8 is available
and so we go with
the most recent.

Download: WRFV3.8.TAR.gz

2. Extract WRFV3.8.TAR.gz to WRFV3/ in your working directory,


say to /home/user/wrf/WRFV3/ where /home/user/wrf/ is your working directory for this
installation.

3. Create the directory LIBRARIES: mkdir /home/user/wrf/LIBRARIES/

This is where mpich, netcdf, jasper, libpng, and zlib will go. Yes, these can be installed using a package manager using yum or apt-get, but failure is nearly certain
unless netCDF is compiled with the same compiler version used to build WRF, so build these all in this LIBRARIES directory.

4. Make sure that csh, perl, and sh (Bash) are installed.

Make sure that gfortran, gcc, and cpp are installed.

5. Make sure that these standard Gnu/Linux commands work:


ar head sed

awk hostname sleep

cat ln sort

cd ls tar

cp make touch

cut mkdir tr

expr mv uname

file nm wc

grep printf which

gzip rm m4

6. Download these files to /home/user/wrf/LIBRARIES/, then extract each one.

a. mpich-3.0.4

b. netcdf-4.1.3

c. Jasper-1.900.1

d. libpng-1.2.50

e. zlib-1.2.7

7. Issue these commands (bash):


export DIR=/home/user/wrf/LIBRARIES

export CC=gcc

export CXX=g++

exportFC=gfortran

export FCFLAGS=-m64

export F77=gfortran

export FFLAGS=-m64

8. Move to the netCDF directory: cd /home/user/wrf/LIBRARIES/netcdf-4.1.3

Build netCDF by issuing these commands:


./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared

make

make install

export PATH=$DIR/netcdf/bin:$PATH

export NETCDF=$DIR/netcdf

srend.nongnu.org/manual/WRF/wrf_install.html 1/5
10/11/21 23:50 srend manual: WRF_install
9. Move to the mpich directory: cd /home/user/wrf/LIBRARIES/mpich-3.0.4

Issue these commands:


./configure --prefix=$DIR/mpich

make

make install

export PATH=$DIR/mpich/bin:$PATH

10. Move to the zlib directory: cd /home/user/wrf/LIBRARIES/zlib-1.2.7

Issue these commands:


export LDFLAGS=-L$DIR/grib2/lib

export CPPFLAGS=-I$DIR/grib2/include

./configure --prefix=$DIR/grib2

make

make install

11. Move to the libpng directory: cd /home/user/wrf/LIBRARIES/libpng-1.2.50

Issue these commands:


./configure --prefix=$DIR/grib2

make

make install

12. Move to the Jasper directory: cd /home/user/wrf/LIBRARIES/jasper-1.900.1

Issue these commands:


./configure --prefix=$DIR/grib2

make

make install

13. Move to the WRFV3 directory: cd /home/user/wrf/WRFV3

a. Issue this command and answer the questions during the script run:
./configure

b. There are options going through confuration, but select 32 (serial) or 33 (SMP)
from the GNU 32,33,34,35 options.

c. On nesting, select 1 for basic

14. There are many cases to choose from for an ideal run.
em_real (3d real case)

em_quarter_ss (3d ideal case)

em_b_wave (3d ideal case)

em_les (3d ideal case)

em_heldsuarez (3d ideal case)

em_tropical_cyclone (3d ideal case)

em_hill2d_x (2d ideal case)

em_squall2d_x (2d ideal case)

em_squall2d_y (2d ideal case)

em_grav2d_x (2d ideal case)

em_seabreeze2d_x (2d ideal case)

em_scm_xy (1d ideal case)

Here, select em_quarter_ss. Issue this command:


./compile em_quarter_ss

It takes some time to compile, 15-30 minutes! There will be numerous warnings about nonexistent /home/user/wrf/WRFV3/chem, but this is OK as it isn't needed
for this basic setup. If WRF-chem is downloaded and placed in the proper position, the warnings disappear during compilation--which, of course, takes more time
because chem is being built.

15. You should see these executables in /home/user/wrf/WRFV3/main/


-rwxrwxr-x. 1 user user 38368715 Jul 15 11:21 main/ideal.exe*

-rwxrwxr-x. 1 user user 44405672 Jul 15 11:21 main/wrf.exe*

These are linked also in WRFV3/run/ and WRFV3/test/em_quarter_ss/

16. It is usually best to run test cases from the test directories because there
are additional test-specific files there.

Move to the em_quarter_ss directory: cd /home/user/wrf/WRFV3/test/em_quarter_ss

Issue this command: ls -lF


lrwxrwxrwx. 1 user user 33 Jul 15 11:21 bulkdens.asc_s_0_03_0_9 -> ../../run/bulkdens.asc_s_0_03_0_9

lrwxrwxrwx. 1 user user 34 Jul 15 11:21 bulkradii.asc_s_0_03_0_9 -> ../../run/bulkradii.asc_s_0_03_0_9

lrwxrwxrwx. 1 user user 22 Jul 15 11:21 capacity.asc -> ../../run/capacity.asc

lrwxrwxrwx. 1 user user 21 Jul 15 11:21 coeff_p.asc -> ../../run/coeff_p.asc

lrwxrwxrwx. 1 user user 21 Jul 15 11:21 coeff_q.asc -> ../../run/coeff_q.asc

lrwxrwxrwx. 1 user user 23 Jul 15 11:21 constants.asc -> ../../run/constants.asc

lrwxrwxrwx. 1 user user 20 Jul 15 11:21 ideal.exe -> ../../main/ideal.exe*

-rw-r--r--. 1 user user 14469 Apr 7 2014 input_sounding

srend.nongnu.org/manual/WRF/wrf_install.html 2/5
10/11/21 23:50 srend manual: WRF_install
-rw-r--r--. 1 user user 2517 Apr 7 2014 input_sounding_preWRFV3.6

lrwxrwxrwx. 1 user user 32 Jul 15 11:21 kernels.asc_s_0_03_0_9 -> ../../run/kernels.asc_s_0_03_0_9

lrwxrwxrwx. 1 user user 23 Jul 15 11:21 kernels_z.asc -> ../../run/kernels_z.asc

lrwxrwxrwx. 1 user user 20 Jul 15 11:21 masses.asc -> ../../run/masses.asc

-rw-r--r--. 1 user user 5138 Mar 21 2014 namelist.input

-rw-r--r--. 1 user user 5096 Apr 2 2014 namelist.input_2to1

-rw-r--r--. 1 user user 5079 Apr 2 2014 namelist.input_3to1

-rw-r--r--. 1 user user 5084 Apr 2 2014 namelist.input_4to1

-rw-r--r--. 1 user user 5084 Apr 2 2014 namelist.input_5to1

lrwxrwxrwx. 1 user user 25 Jul 15 11:21 README.namelist -> ../../run/README.namelist

-rw-r--r--. 1 user user 1594 Feb 2 2009 README.quarter_ss

-rwxr-xr-x. 1 user user 176 May 14 2004 run_me_first.csh*

lrwxrwxrwx. 1 user user 22 Jul 15 11:21 termvels.asc -> ../../run/termvels.asc

lrwxrwxrwx. 1 user user 18 Jul 15 11:21 wrf.exe -> ../../main/wrf.exe*

17. Let us run the problem.

a. issue this command to prepare the ideal run: ./ideal.exe

You see some setup info like this:


Ntasks in X 1 , ntasks in Y 1

IDEAL V3.8 PREPROCESSOR

*************************************

Parent domain

ids,ide,jds,jde 1 42 1 42

ims,ime,jms,jme -4 47 -4 47

ips,ipe,jps,jpe 1 42 1 42

*************************************

DYNAMICS OPTION: Eulerian Mass Coordinate

alloc_space_field: domain 1 , 57314396 bytes allocauser

pi is 3.14159274

getting dry sounding for base state

input sounding surface parameters

surface pressure (mb) 1000.00000

surface pot. temp (K) 300.000000

surface mixing ratio (g/kg) 14.0000000

1 0.100E+02 0.300E+03 0.140E+02 -0.810E+01 -0.494E+01

2 0.350E+02 0.300E+03 0.140E+02 -0.810E+01 -0.480E+01

...

222 0.300E+05 0.782E+03 0.780E+00 0.271E+02 0.350E+01

number of input levels = 222

surface density is 1.16144013

surface pi is 1.00000000

sounding

k height(m) press (Pa) pd(Pa) theta (K) den(kg/m^3) u(m/s) v(m/s) qv(g/g)

1 1.000E+01 9.989E+04 9.989E+04 3.000E+02 1.160E+00 -8.100E+00 -4.942E+00 0.000E+00

2 3.500E+01 9.960E+04 9.960E+04 3.000E+02 1.158E+00 -8.098E+00 -4.797E+00 0.000E+00

...

220 2.900E+04 1.407E+03 1.407E+03 7.471E+02 2.219E-02 2.715E+01 3.500E+00 0.000E+00

221 2.950E+04 1.303E+03 1.303E+03 7.644E+02 2.052E-02 2.715E+01 3.500E+00 0.000E+00

222 3.000E+04 1.206E+03 1.206E+03 7.821E+02 1.898E-02 2.715E+01 3.500E+00 0.000E+00

returned from reading sounding, nl_in is 222

ptop is 5715.70850

base state grid%mub(1,1), p_surf is 94284.1172 99999.8281

getting moist sounding for full state

input sounding surface parameters

surface pressure (mb) 1000.00000

surface pot. temp (K) 300.000000

surface mixing ratio (g/kg) 14.0000000

1 0.100E+02 0.300E+03 0.140E+02 -0.810E+01 -0.494E+01

2 0.350E+02 0.300E+03 0.140E+02 -0.810E+01 -0.480E+01

3 0.100E+03 0.300E+03 0.140E+02 -0.808E+01 -0.442E+01

...

222 0.300E+05 0.782E+03 0.780E+00 0.271E+02 0.350E+01

number of input levels = 222

surface density is 1.13586390

surface pi is 1.00000000

sounding

k height(m) press (Pa) pd(Pa) theta (K) den(kg/m^3) u(m/s) v(m/s) qv(g/g)

1 1.000E+01 9.989E+04 9.944E+04 3.000E+02 1.135E+00 -8.100E+00 -4.942E+00 1.400E-02

2 3.500E+01 9.961E+04 9.916E+04 3.000E+02 1.133E+00 -8.098E+00 -4.797E+00 1.400E-02

...

221 2.950E+04 1.318E+03 1.318E+03 7.644E+02 2.067E-02 2.715E+01 3.500E+00 7.039E-04

222 3.000E+04 1.220E+03 1.220E+03 7.821E+02 1.912E-02 2.715E+01 3.500E+00 7.804E-04

grid%ph_1 calc 0.00000000 98.2387238 93834.5938 -449.523438 0.881800056 2.16198564E-02 -15.1503830

nxc, nyc for perturbation 20 20

delt for perturbation 3.00000000

grid%mu_1 from comp -449.523438

full state sounding from comp, ph, grid%p, grid%al, grid%t_1, qv

1 0.000E+00 9.686E+04 9.019E-01 3.004E+02 1.400E-02

2 5.586E+03 9.077E+04 9.484E-01 3.016E+02 1.400E-02

...

39 4.880E+02 -3.890E+00 2.669E-02 1.765E+02 9.242E-05

40 4.770E+02 -1.268E+00 2.603E-02 1.891E+02 1.030E-04

wrf: SUCCESS COMPLETE IDEAL INIT

b. run the simulation: ./wrf.exe

You should see something like this for the run:


Ntasks in X 1 , ntasks in Y 1

--- WARNING: traj_opt is zero, but num_traj is not zero; setting num_traj to zero.

srend.nongnu.org/manual/WRF/wrf_install.html 3/5
10/11/21 23:50 srend manual: WRF_install
--- NOTE: sst_update is 0, setting io_form_auxinput4 = 0 and auxinput4_interval = 0 for all domains

--- NOTE: grid_fdda is 0 for domain 1, setting gfdda interval and ending time to 0 for that domain.

--- NOTE: both grid_sfdda and pxlsm_soil_nudge are 0 for domain 1, setting sgfdda interval and ending time to 0 for that domain.

--- NOTE: obs_nudge_opt is 0 for domain 1, setting obs nudging interval and ending time to 0 for that domain.

--- NOTE: bl_pbl_physics /= 4, implies mfshconv must be 0, resetting

Need MYNN PBL for icloud_bl = 1, resetting to 0

--- NOTE: RRTMG radiation is not used, setting: o3input=0 to avoid data pre-processing

--- NOTE: num_soil_layers has been set to 5

WRF V3.8 MODEL

*************************************

Parent domain

ids,ide,jds,jde 1 42 1 42

ims,ime,jms,jme -4 47 -4 47

ips,ipe,jps,jpe 1 42 1 42

*************************************

DYNAMICS OPTION: Eulerian Mass Coordinate

alloc_space_field: domain 1 , 56427484 bytes allocauser

med_initialdata_input: calling input_input

Timing for processing wrfinput file (stream 0) for domain 1: 0.01567 elapsed seconds

Timing for Writing wrfout_d01_0001-01-01_00:00:00 for domain 1: 0.23812 elapsed seconds

Tile Strategy is not specified. Assuming 1D-Y

WRF TILE 1 IS 1 IE 42 JS 1 JE 42

WRF NUMBER OF TILES = 1

Timing for main: time 0001-01-01_00:00:12 on domain 1: 0.61111 elapsed seconds

Timing for main: time 0001-01-01_00:00:24 on domain 1: 0.36062 elapsed seconds

Timing for main: time 0001-01-01_00:00:36 on domain 1: 0.36215 elapsed seconds

...

Timing for main: time 0001-01-01_00:29:48 on domain 1: 0.45171 elapsed seconds

Timing for main: time 0001-01-01_00:30:00 on domain 1: 0.45195 elapsed seconds

Timing for Writing wrfout_d01_0001-01-01_00:30:00 for domain 1: 0.12582 elapsed seconds

Timing for main: time 0001-01-01_00:30:12 on domain 1: 0.57789 elapsed seconds

Timing for main: time 0001-01-01_00:30:24 on domain 1: 0.45161 elapsed seconds

...

Timing for main: time 0001-01-01_00:59:48 on domain 1: 0.43801 elapsed seconds

Timing for main: time 0001-01-01_01:00:00 on domain 1: 0.43815 elapsed seconds

Timing for Writing wrfout_d01_0001-01-01_01:00:00 for domain 1: 0.12411 elapsed seconds

d01 0001-01-01_01:00:00 wrf: SUCCESS COMPLETE WRF

c. You should see these files in the directory: ls -lF /home/user/wrf/WRFV3/test/em_quarter_ss/


-rw-rw-r--. 1 user user 4432888 Jul 15 11:31 wrfinput_d01

-rw-rw-r--. 1 user user 12613988 Jul 15 11:36 wrfout_d01_0001-01-01_00:00:00

18. For a quick look at these netCDF files, install ncview. (This will also install netCDF, but a separate global install
which your WRF install does not use.) Use
yum or apt-get to install ncview.

View results with ncview: ncview wrfout_d01_0001-01-01_00:00:00

The 4d vars are most interesting, and there are 3 time steps and 39-40 levels. Here is what the ncview
dialog window looks like.

Here are some 4D variables extracted at various time steps (t0-2) and bottom-top (z 0-39).

srend.nongnu.org/manual/WRF/wrf_install.html 4/5
10/11/21 23:50 srend manual: WRF_install

19. Last but not least, you will need to recompile WRF each time you do a different test problem or switch between serial, SMP, MPI, SMP+MPI, change nesting,
etc. The commands above exporting environment variables
need to be done each time you start a new shell, so collect them all into a file, say wrf.sh with these
contents:
#!/bin/bash

# These are needed for WRF 3.8, perhaps others in the NCAR code family.

# run it like this: . wrf.sh

export DIR=/home/user/wrf/LIBRARIES

export NETCDF=$DIR/netcdf

export NETCDF_LIB=$DIR/netcdf/lib

export NETCDF_INC=$DIR/netcdf/include

export JASPERLIB=$DIR/grib2/lib

export JASPERINC=$DIR/grib2/include

export LDFLAGS=-L$DIR/grib2/lib

export CPPFLAGS=-I$DIR/grib2/include

export PATH=$DIR/mpich/bin:$DIR/netcdf/bin:$PATH

export FC=gfortran

export CC=gcc

export CXX=g++

export FCFLAGS=-m64

export FFLAGS=-m64

export F77=gfortran

Save this as /home/user/wrf/wrf.sh


Make it executable: chmod 755 /home/user/wrf/wrf.sh

Run this before compiling each time you open a new shell, like this:
cd /home/user/wrf

. wrf.sh

srend.nongnu.org/manual/WRF/wrf_install.html 5/5

You might also like