You are on page 1of 43

WRF3.

8 compilation

System Information
Processor: Intel Core i7
Graphics: Gallium 0.4 on NV117
Memory: 16Gb
OS: Ubuntu 16.04 LTS

*It is recommended to be the root user always when running all the given commands

sudo -s

The command prompt will start with a # if you are the root user

Chapter 1 – Installation of WRF

1. Checking the compilers and installing.

gcc
gfortran
cpp

which gfortran

If the code outputs a path similar to something like given below, it means the module is
already available in the computer.

/usr/bin/gfortran
If any of the three components are not available, you should download and install using
the following commands. (Should be connected to the Internet with root privileges)

sudo apt-get update


sudo apt-get upgrade
sudo apt-get install gfortran (Install the missing modules)

Check the installed version by using the command

gfortran --version

The output should be something similar to this but might change with new upgrades

GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609


Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.


You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
2. System Environment Tests

Create a new directory for WRF Tests in the home directory using the following
command

mkdir TEST

Go inside the directory using the following command

cd TEST

Download the test files from a terminal opened from the home directory using the
following command line

wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/Fortran_C_tests.tar

Unpack the tar file by using the following command

tar -xf Fortran_C_tests.tar

Test 1 – Fixed Format Fortran Test

Type the following in the command prompt one after the other

gfortran TEST_1_fortran_only_fixed.f

./a.out

If the test is successful, the following message should be displayed on the screen.

SUCCESS test 1 fortran only fixed format


Test 2 – Free Format Fortran Test

Type the following in the command prompt one after the other

gfortran TEST_2_fortran_only_free.f90

./a.out

If the test is successful, the following message should be displayed on the screen.

Assume Fortran 2003: has FLUSH, ALLOCATABLE, derived type, and ISO C
Binding
SUCCESS test 2 fortran only free format

Test 3 – C Test

Type the following in the command prompt one after the other

gcc TEST_3_c_only.c

./a.out

If the test is successful, the following message should be displayed on the screen

SUCCESS test 3 c only

Test 4 – Fortran Calling a C Function Test

Type the following in the command prompt one after the other

gcc -c -m64 TEST_4_fortran+c_c.c

gfortran -c -m64 TEST_4_fortran+c_f.f90

gfortran -m64 TEST_4_fortran+c_f.o TEST_4_fortran+c_c.o

./a.out
If the test is successful, the following message should be displayed on the screen.

C function called by Fortran


Values are xx = 2.00 and ii = 1
SUCCESS test 4 fortran calling c

Installing csh, perl and sh

The perl and sh scripting languages are included by default in Ubuntu 16.04 LTS OS
but the availability can be checked using the following command.

which perl
which csh
which sh

The output should display the path of the directory they are included.

For example:
/usr/bin/perl

If any of the three languages are missing, use the following commands to download
them and install.

sudo apt-get install perl


sudo apt-get install csh
sudo apt-get install sh
Test 5 – csh Test

Type the following in the command prompt.

./TEST_csh.csh

If the test is successful, the following message should be displayed on the screen.

SUCCESS csh test

Test 6 – perl Test

Type the following in the command prompt.

./TEST_perl.pl

If the test is successful, the following message should be displayed on the screen.

SUCCESS perl test

Test 7 – sh Test

Type the following in the command prompt.

./TEST_sh.sh

If the test is successful, the following message should be displayed on the screen.

SUCCESS sh test
3. Required libraries
Please note that this chapter is only documented for the purpose of introducing the libraries
required for WRF model. The links provided can be used to search more about the libraries
and download them and does not involve any installation step. But in the next chapter (4.
Installation of libraries), every step is followed in command lines including the download
process.

a. NetCDF
This is the most important library which needs to be installed for WRF. NetCDF
(network Common Data Form) is a set of interfaces for array-oriented data access and
a freely distributed collection of data access libraries for C, Fortran, C++, Java, and
other languages. The netCDF libraries support a machine-independent format for
representing scientific data.

For more information about NetCDF -


http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#whatisit

Although many new versions of NetCDF packages are available at present, it is


recommended to use NetCDF 4.1.3 for compiling WRF v3.8. A link to download the
recommended NetCDF version is given below.

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-
4.1.3.tar.gz

b. MPICH
MPICH is a high-performance and widely portable implementation of the
MPI-3.1 standard from the Argonne National Laboratory. (MPI = Message Parsing
Interface). This application allows the user to select the number of cores should be
allocated for a WRF task. When WRF is run using mpich, (will be explained how to run
using MPICH in next chapter ) the WRF job will be allocated into each processor as
individual tasks which reduce the overall runtime of the model. If you are not interested
in running WRF in parallel or in other words, using more than one processor, this library
need not be installed.

For more information about MPICH -


https://www.mpich.org/documentation/guides/

Although many new versions of MPICH are available at present, it is recommended to


use MPICH 3.0.4 for compiling WRF v3.8. A link to download the recommended version
of MPICH is given below.

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-
3.0.4.tar.gz
c. JasPer
JasPer is a software tool kit for the handling of image data. The software
provides means for representing images, and facilitates the manipulation of image data,
as well as the import/export of such data in numerous formats. This library is vital for the
WPS copmponent of the model since it helps in ungribbing process of GRIB2 files.

For more information about JasPer -


https://www.ece.uvic.ca/~frodo/jasper/

A link to download the recommended version of JasPer for WRF is given below.
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-
1.900.1.tar.gz

d. libpng
libpng is an open source development which is created for the purpose to
maintain the reference library for use in applications that read, create and manipulate
PNG (Portable Network Graphics) raster image files. The use of this library for WRF is
that it allows the GRIB2 data manipulation for the compiling of WPS component.

For further information about libpng -


https://libpng.sourceforge.io/

A link to download the recommended version of libpng for WRF is given below.

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-
1.2.50.tar.gz

e. zlib
zlib is a lossless compression format which can be used in almost any hardware
and operating system. This library is vital for WRF since many data sets used in WRF
model are in compressed formats like GRIB2. This library is specially important in
compiling the WPS component of the model.

For more information about zlib -


https://zlib.net/

Although many new versions of zlib are available at present, it is recommended to use
zlib 1.2.7 for compiling WRF v3.8. A link to download the recommended version of zlib
is given below.

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz
4. Installation of libraries

1- It is recommended to do the installation in the home directory but a user can


choose if required to compile WRF in a different target.

2- Go to the home directory in linux by clicking on the second icon from the column
of icons in the desktop of Ubuntu 16.04 freshly installed. Once you are in the
home directory, right click and select open in terminal. This is the easiest way to
change the directories in a terminal to go to a specified location on the computer.
If you are familiar with linux command prompt, you can also choose to run the
command given below to change the directory to home in a terminal window.
(You can open the terminal window in ubuntu using the hotkey ctrl+alt+t )

cd /home/

3- Create a new folder for the installation of WRF in the home directory by simply
right click and make new folder or use the following command in the command
prompt

mkdir WRF

4- Copy all the downloaded tar files into this folder which are in the downloads
directory

NetCDF

Download the tar file using the following command

wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/netcdf-4.1.3.tar.gz

Untar the NetCDF tar file using the following commands

tar xzvf netcdf-4.1.3.tar.gz.1

If the .gz extension is not present in your downloaded file, use the command

tar netcdf-4.1.3.tar
To go inside the unzipped file, use the command

cd netcdf-4.1.3

*Important note on using linux command prompt in changing directories – It is easy to change
the path directories by typing cd followed by the folder name. But to avoid mistakes in typing
wrong and to make sure you get to the correct directory, try pressing the Tab button after
typing the first few letters of the folder name. With the tab pressed, it will auto complete the
name of the whole directory and this will give you an idea that such a folder exist and in fact
your command is correct.

Before installing NetCDF, it is very important to follow the below mentioned steps to set
the environment variables.

If you follow the given instructions as given above and use a similar operating system
(Ubuntu 16.04 LTS), you will be working on a bash (bourne-again shell) shell which is
the widely used default at present. If you are using any other shell or operating system,
check the relevant shell and change the script syntax as appropriate. In this manual, we
provide how to manipulate for bash shell and csh (C shell) and also how to find which
shell you are using.
Type the following command to check which shell you are using currently. It will display
which shell you are actively using.

echo $0

If you want to check the default shell you use whenever you login, type the following
command to display the default shell used along with its path directory in the shell
environment variable.

echo $SHELL

Once you find out which shell you are using, you can proceed with the next steps given
below.

For bash shell (which is the default)

Type the following commands on the command prompt with a terminal opened inside
the unzipped NetCDF folder which is in this case the netcdf-4.1.3 folder created by the
unzip command and the command line should display something close to this
depending on your user account names.

Example:
user@user-714-150l:~/WRF3.8/netcdf-4.1.3#

*If you are not the root user, the hash symbol would probably be replaced with a $
symbol. It is always recommended to have the root privileges in compiling WRF.

Type the following commands

export CC gcc
export CXX g++
export FC gfortran
export FCFLAGS -m64
export F77 gfortran
export FFLAGS -m64
Configure NetCDF using the following command. These commands are very important
and therefore make sure to the check disable attributes correctly before running the
configuration.

./configure --disable-dap --disable-netcdf-4 –disable-shared

After the configuration of NetCDF above, the next step is to install the library. The
‘make’ command is used followed by ‘make check’ command to check for any errors in
the compilation. Type the following commands in the given sequence. If there is any
error in the configuration of the specific library, it will be displayed on the screen while
the ‘make check’ command is executed.

make

make check

make install
MPICH

Move back to the WRF3.8 directory using the following command.

cd ..

Download the tar file using the following command

Wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/mpich-3.0.4.tar.gz

Untar the mpich-3.0.4.tar.gz file using the following command.

tar xzvf mpich-3.0.4.tar.gz


Change the working directory to inside the mpich file using the following command.

cd mpich-3.0.4

Configure MPICH using the following command.

./configure
After the configuration of MPICH, install the library using the following three commands
in sequence.

make

make check

make install
zlib

Move back to the WRF3.8 directory using the following command in the terminal
window.

cd ..

Download the tar file using the following command

Wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/zlib-1.2.7.tar.gz
Untar the zlib-1.2.7 file using the following command.

tar xzvf zlib-1.2.7.tar.gz

Move inside the zlib directory using the following command.

cd zlib-1.2.7

Configure zlib using the following command.

./configure
After the configuration of zlib, install the library using the following commands in
sequence.

make

make check

make install
libpng

Move back to the WRF directory using the following command in the terminal window.

cd ..

Download the tar file using the following command

Wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/libpng-1.2.50.tar.gz

Untar the libpng-1.2.50 file using the following command

tar xzvf libpng-1.2.50.tar.gz


Move inside the libpng directory using the following command.

cd libpng-1.2.50

Configure libpng using the following command.

./configure

After the configuration of libpng, install the library using the following commands in
sequence.

make

make check

make install
While installing the libraries, and before configuring, it is advised to see the files inside
the library using the following command to display the files inside the directory

ls

Jasper

Move back to the WRF directory using the following command in the terminal window.

cd ..

Download the tar file using the following command

Wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/jasper-1.900.1.tar.gz

Untar the jasper-1.900.1 file using the following command

tar xzvf jasper-1.900.1.tar.gz.1


Move inside the zlib directory using the following command.

cd jasper-1.900.1

Configure Jasper using the following command.

./configure
After the configuration of Jasper, install the library using the following commands in
sequence.

make

make check

make install
Installing m4

m4 is a macro processor which is either built in or user defined. It is much similar to cpp
(C-pre processor). However m4 is much advanced and powerful when compared with
the abilities of cpp and is a required component to run WRF

Go to the WRF directory and type the following command

sudo apt-get install m4


5. Library Compatibility Test

The library compatibility tests are run in order to verify that the libraries are able to work
with the compilers that are going to be used for the compilation of WRF and WPS
components. Go to the TESTS folder in the home directory and type the following in the
command prompt to download the test files required.

wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_
files/Fortran_C_NETCDF_MPI_tests.tar

Unpack the tar file using the following command line.

tar -xf Fortran_C_NETCDF_MPI_tests.tar

Test 1 - Fortran + C + NetCDF

Type the following command to copy the netcdf.inc file from the default installation
location to the current directory which is TEST.

cp /usr/local/include/netcdf.inc .

*Notice the last dot (.) placed after the filename to be copied after a space. This is very
important to mak esure the file gets copied to your current address. If the NetCDF has not
installed in the default location, use which command to find its directory and adjust the code
as necessary.

Type the following in the command prompt one after the other

gfortran -c 01_fortran+c+netcdf_f.f

gcc -c 01_fortran+c+netcdf_c.c

gfortran 01_fortran+c+netcdf_f.o 01_fortran+c+netcdf_c.o -


L${NETCDF}/lib -lnetcdff -lnetcdf

./a.out
If the test is successful, the following message should be displayed on the screen.

C function called by Fortran


Values are xx = 2.00 and ii = 1
SUCCESS test 1 fortran + c + netcdf

Test 2 – Fortran + C + NetCDF + MPI Test

Type the following command to copy the netcdf.inc file from the default installation
location to the current directory which is TEST.

cp /usr/local/include/netcdf.inc .

Type the following in the command prompt one after the other

mpif90 -c 02_fortran+c+netcdf+mpi_f.f

mpicc -c 02_fortran+c+netcdf+mpi_c.c

mpif90 02_fortran+c+netcdf+mpi_f.o 02_fortran+c+netcdf+mpi_c.o -


L${NETCDF}/lib -lnetcdff –lnetcdf

mpirun ./a.out

If the test is successful, the following message should be displayed on the screen.

C function called by Fortran


Values are xx = 2.00 and ii = 1
status = 2
SUCCESS test 2 fortran + c + netcdf + mpi
6. Installing WRF

Download the WRF3.8 files using the following command from the WRF directory

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

Untar the file using the following commands

gunzip WRFV3.8.TAR.gz
tar –xf WRFV3.8.TAR

Setting up environment variables for NetCDF to install WRF3.8

Change the directory from WRF to the WRFV3 directory using the following command

cd WRFV3/

Setting up the environment variables for netCDF to install WRF3.8

Type the following lines on the command prompt

export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export NETCDF=/usr/local
export NETCDF_LIB=/usr/local/lib
export NETCDF_INC=/usr/local/include

Then configure WRF according to your desired usage of WRF using the following
command

./configure
A list of options will be displayed from which you can choose one depending on your
compiler and mode of processing

Compilers

There are several compiler options and therefore it is vital to use the same compiler
used to install the libraries for compiling WRF. In this documentation, we recommend
and use gfortra/gcc

Mode of processing

The WRF model can be run in four modes

serial = single processor


This option is best suited if you do not possess multiple processor resources and intend
to use only one processor.

smpar = shared memory option (OpenMPI)


This options shares the memory allocated for each program where parallelism occurs
through the grant of access to each parallel thread towards all the data.

dmpar = distributed memory option (MPI)


This option is best suited and most recommended if you are planning to use multiple
processors in your computer running WRF. The general computers these days consist
of intel i3,5,7 processors with multiple cores and therefore this option is the most
commonly used option.

dm+sm = distributed memory and shared memory


This option is a combination of dmpar and smpar.

According to our system specifications and compiler used, the option recommended to
choose is 34
34. (dmpar) GNU (gfortran/gcc)

After the selection of the compiler and mode, another selection will be displayed with 4
options for nesting.

The most general two options are the basic (=1) and the vortex following (=3).

The preset (=2) was initially used for testing WRF and therefore it is recommended to
avoid this option.

For basic weather forecasting using meteorological data, it is recommended to use the
basic (=1)

For cyclone tracking applications, the vortex following (=3) option is the most suited.

If the configuration is successful, a message will be displayed with a testing for NetCDF,
C and Fortran compiler.

After this step, type the following command to compile WRF3.8

./compile

This would result in another list of options for which WRF can be compiled as given
below.

Usage:
compile [-j n] wrf compile wrf in run dir (NOTE: no real.exe,
ndown.exe, or ideal.exe generated)
or choose a test case (see README_test_cases for details) :
compile [-j n] em_b_wave
compile [-j n] em_convrad
compile [-j n] em_esmf_exp
compile [-j n] em_fire
compile [-j n] em_grav2d_x
compile [-j n] em_heldsuarez
compile [-j n] em_hill2d_x
compile [-j n] em_les
compile [-j n] em_quarter_ss
compile [-j n] em_real
compile [-j n] em_scm_xy
compile [-j n] em_seabreeze2d_x
compile [-j n] em_squall2d_x
compile [-j n] em_squall2d_y
compile [-j n] em_tropical_cyclone
compile [-j n] exp_real
compile [-j n] nmm_real
compile [-j n] nmm_tropical_cyclone
compile -j n parallel make using n tasks if
supported (default 2)
compile -h help message

The most basic and widely used capability of WRF is the em_real test case which
allows the user to forecast using real meteorological datasets.

The ideal cases can be run to simulate a climatic condition with used defined initial
boundary conditions whereas in the real cases, the initial boundary conditions are
supplied to the WRF through actual meteorological data.

Type the following command with your choice of test case. In here, the test case
compiled for is em_real.

./compile em_real >& log.compile

The log.compile command will create a log file for the compilation which will help you
troubleshoot in case of an unsuccessful attempt.

To check for the successful compilation of WRFV3.8, type the following command.

cat log.compile

If the compilation was successful, the following lines will be displayed at the bottom of
the log file.
==========================================================================
build started: Wed Nov 15 15:00:14 +07 2017
build completed: Wed Nov 15 15:06:37 +07 2017
---> Executables successfully built <---
-rwxr-xr-x 1 root root 38340768 Nov 15 15:06 main/ndown.exe
-rwxr-xr-x 1 root root 38217784 Nov 15 15:06 main/real.exe
-rwxr-xr-x 1 root root 37857816 Nov 15 15:06 main/tc.exe
-rwxr-xr-x 1 root root 42000344 Nov 15 15:06 main/wrf.exe
=========================================================================

This is the end of the first component of the WRFV3.8. The next step is to compile
WPS. The compilation is only required for real cases. If you are intending to use WRF
for ideal cases, the WPS compilation is not required.

7. Installing WPS

Go back to the WRF directory by using the following command

cd ..

Download WPSV3.8 using the following command line

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

Unzip the downloaded file using the following two command lines one after the other.

gunzip WPSV3.8.TAR.gz
tar –xf WPSV3.8.TAR

Go inside the WPS directory created by using the following command.

cd WPS/

Exporting Jasper libraries for the installation of WPS with GRIB2 support.

export JASPERLIB=/usr/local/lib
export JASPERINC=/usr/local/include/jasper
Configure WPS using the following command

./configure

If the NetCDF and Jasper libraries are configured properly, following lines will be
displayed on top.

will use NETCDF in dir: /usr/local


Found Jasper environment variables for GRIB2 support…
$JASPERLIB = usr/local/lib
$JASPERINC = /usr/local/include/jasper

Then the user should select the working platform from the list of supported platforms
given below. In here the selection is 3

Please select from among the following supported platforms.

1. Linux x86_64, gfortran (serial)


2. Linux x86_64, gfortran (serial_NO_GRIB2)
3. Linux x86_64, gfortran (dmpar)
4. Linux x86_64, gfortran (dmpar_NO_GRIB2)
5. Linux x86_64, PGI compiler (serial)
6. Linux x86_64, PGI compiler (serial_NO_GRIB2)
7. Linux x86_64, PGI compiler (dmpar)
8. Linux x86_64, PGI compiler (dmpar_NO_GRIB2)
9. Linux x86_64, PGI compiler, SGI MPT (serial)
10. Linux x86_64, PGI compiler, SGI MPT (serial_NO_GRIB2)
11. Linux x86_64, PGI compiler, SGI MPT (dmpar)
12. Linux x86_64, PGI compiler, SGI MPT (dmpar_NO_GRIB2)
13. Linux x86_64, IA64 and Opteron (serial)
14. Linux x86_64, IA64 and Opteron (serial_NO_GRIB2)
15. Linux x86_64, IA64 and Opteron (dmpar)
16. Linux x86_64, IA64 and Opteron (dmpar_NO_GRIB2)
17. Linux x86_64, Intel compiler (serial)
18. Linux x86_64, Intel compiler (serial_NO_GRIB2)
19. Linux x86_64, Intel compiler (dmpar)
20. Linux x86_64, Intel compiler (dmpar_NO_GRIB2)
21. Linux x86_64, Intel compiler, SGI MPT (serial)
22. Linux x86_64, Intel compiler, SGI MPT (serial_NO_GRIB2)
23. Linux x86_64, Intel compiler, SGI MPT (dmpar)
24. Linux x86_64, Intel compiler, SGI MPT (dmpar_NO_GRIB2)
25. Linux x86_64, Intel compiler, IBM POE (serial)
26. Linux x86_64, Intel compiler, IBM POE (serial_NO_GRIB2)
27. Linux x86_64, Intel compiler, IBM POE (dmpar)
28. Linux x86_64, Intel compiler, IBM POE (dmpar_NO_GRIB2)
29. Linux x86_64 g95 compiler (serial)
30. Linux x86_64 g95 compiler (serial_NO_GRIB2)
31. Linux x86_64 g95 compiler (dmpar)
32. Linux x86_64 g95 compiler (dmpar_NO_GRIB2)
33. Cray XE/XC CLE/Linux x86_64, Cray compiler (serial)
34. Cray XE/XC CLE/Linux x86_64, Cray compiler (serial_NO_GRIB2)
35. Cray XE/XC CLE/Linux x86_64, Cray compiler (dmpar)
36. Cray XE/XC CLE/Linux x86_64, Cray compiler (dmpar_NO_GRIB2)
37. Cray XC CLE/Linux x86_64, Intel compiler (serial)
38. Cray XC CLE/Linux x86_64, Intel compiler (serial_NO_GRIB2)
39. Cray XC CLE/Linux x86_64, Intel compiler (dmpar)
40. Cray XC CLE/Linux x86_64, Intel compiler (dmpar_NO_GRIB2)
Enter selection [1-40] : 3
----------------------------------------------------------------------

If the configuration is successful, the following message will be displayed as given


below.

--
Configuration successful. To build the WPS, type: compile
----------------------------------------------------------------------
--

Testing for NetCFD, C and Fortran compiler


This installation NetcCFD is 64-bit
C compiler is 64 bit
Fortran compiler is 64-bit

After the configuration of WPS, compile WPS using the following command line.

./compile &> compile.log

To check whether the compilation of WPS is successful, type the following command.

ls

Check whether the given three components are available and non zero file sized
a) geogrid.exe c) metgrid.exe
b) ungrib.exe

If these three .exe files are available, you can now proceed to the configuration of static
geographic data for WRF.

8. Configuration of static geographic data

Go back to the WRF directory by using the following command

cd ..

Download the geographical input dataset using the following command line. Make sure
to choose the correct and required dataset suitable for your own task since the data set
size increases as your desired resolution of the forecast increases.

For example, if you need 1km level resolution for your forecast, you can easily use the
following dataset with lowest resolution of each mandatory field for WRF.

wget
http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_minimum.tar.bz2

If you are interested in running the model with a much greater resolution, it is always
recommended to use the complete dataset which accommodates the highest resolution
with the following command.
wget
http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_complete.tar.gz

The difference between these two datasets is in their ability to cater your resolution
needs and the download file size, although the complete dataset accommodates higher
resolution, it comes with the expense of greater file size and hence even the run time for
WPS will be extended depending on your hardware resources.
Chapter 2 – Running the WRF model

There are 4 components that needs to be combined in order to run a successful WRF
real case scenario.

Static Geographical
Data

Geogrid

Metgrid WRF

Ungrib

Meteorological Data
GFS, FNL, etc

Geogrid

Geogrid component uses the static geographical data previously downloaded by the
user before and starts preparing required information to suit the specifications and
attributes listed by the user in the namelist.wps file.

It is important to make sure you have installed the required amount of Static
geographical Data to cater your resolution needs. If there is any data missing, when
running the geogrid, it will ask display an error message saying which files are missing.
These files can be thereafter downloaded from the following link and copied to your
Static Geographical data folder.

http://www2.mmm.ucar.edu/wrf/src/wps_files/

After the geogrid.exe is successfully run, the information required for the metgrid is sent
to be processed with ungrib data
Ungrib

Ungrib component extracts data recorded in meteorological data which should be


downloaded separately and feeds into the metgrid so that the data from geogrid and
ungrib can be combined.

Metgrid

Metgrid component combines the static geographical data and the meteorlogical data
and outputs files in WRF I/O API conforming format. This is the last step in WRF
preprocessing as metgrid operation produces the final input file required for running the
WRF.

*Note that the configuration of the namelist.wps, namelist.input and downloading


meteorological data will be explained in detail on the next chapter.

WRF Pre Processing

Go to the WPS directory and type the following commands in a terminal window.

sudo -i gedit /home/WRF/ WPS/namelist.wps

This will open a text file containing several parameters for different WPS configurations.
The required editing will be explained in the next chapter.

In the text file, there will be one attribute named geog_data_path which should be
configured when running the WPS for the first time. Replace this attribute with the
location address of your geog data.

geog_data_res = '10m','10m','10m',
dx = 9000,
dy = 9000,
map_proj = 'mercator',
ref_lat = 7.5,
ref_lon = 80.3,
truelat1 = 7.4,
stand_lon = 80.2,
geog_data_path = '/home/gic/WRF/geog/'

Save the file and close it.


Type the following command to run geogrid.exe

./geogrid.exe

Once the geogrid.exe is successfully run, type the following command line to link the
meteorological data. Assuming the meteorological data is already downloaded into a
directory named METDATA and the format is GFS,

./link_grib.csh /home/WRF/METDATA/gfs*

Link the variable tables according to the data format you use. (AWIP or GFS). Assuming
you are using GFS data,

ln -sf /home/WRF/WPS/ungrib/Variable_Tables/Vtable.GFS Vtable

Run the ungrib.exe

./ungrib.exe
After the ungrib process is completed successfully, you can next proceed to the
metgrid.exe using the following command.

./metgrid.exe

After the successful completion of metgrid.exe, you can proceed to the real.exe
assuming that the namelist.input is configured properly. Type the following command
line in a terminal window to change directory to em_real.

cd /home/WRF/WRFV3/test/em_real
Link the metdata to the em_real directory

ln –sf /home/WRF/WPS/met_em.d0* .

Run the real.exe

mpirun -np 1 ./real.exe

After the completion of real.exe, run the wrrf.exe

mpirun –np 4 ./wrf.exe

You might also like