Académique Documents
Professionnel Documents
Culture Documents
Learn more
Features Business Explore Marketplace Pricing This repository Search Sign in or Sign up
Dismiss
Join GitHub today
GitHub is home to over 20 million developers working together to host and
review code, manage projects, and build software together.
Sign up
Walkthrough and notes taken while configuring WRF v3.8 on Ubuntu Server 16.04 LTS at Laboratório de Modelagem Climática
(LMC/INPA).
README.md
These are some installation notes taken in the process of installing WRF version 3.8 on a computer with Ubuntu Server 16.04
LTS.
$ which gfortran
/user/bin/gfortran
$ which cpp
/user/bin/cpp
$ which gcc
/user/bin/gcc
converted by W eb2PDFConvert.com
$ gcc --version
gcc (Ubuntu 5.3.1−14ubuntu2.1) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE.
Create a new, clean directory called Build_WRF , and another one called TESTS .
There are a few simple tests that can be run to verify that the fortran compiler is built properly, and that it is compatible with the
C compiler. Download the tar file that contains the tests into the TESTS directory and unpack the tar file.
$ cd {path_to_dir}/TESTS
$ wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar
$ tar -xvf Fortran_C_tests.tar
There are 7 tests available, so start at the top and run through them, one at a time.
Test 1: Fixed Format Fortran Test.
$ gfortran TEST_1_fortran_only_fixed.f
$ ./a.out
SUCCESS test 1 fortran only fixed format
$ gfortran TEST_2_fortran_only_free.f90
$ ./a.out
Assume Fortran 2003: has FLUSH, ALLOCATABLE, derived type, and ISO C Binding
SUCCESS test 2 fortran only free format
Test 3: C.
$ gcc TEST_3_c_only.c
$ ./a.out
SUCCESS test 3 c only
Test 4: Fortran Calling a C Function (our gcc and gfortran have different defaults, so we force both to always use 64 bit [-
m64] when combining them).
In addition to the compilers required to manufacture the WRF executables, the WRF build system has scripts as the top level for
the user interface. The WRF scripting system uses, and therefore is necessary having csh, perl and sh. To test whether these
scripting languages are working properly on the system, there are 3 tests to run. These tests were included in the "Fortran and C
Tests Tar File".
Test 5: csh.
$ csh ./TEST_csh.csh
SUCCESS csh test
Test 6: perl.
converted by W eb2PDFConvert.com
$ ./TEST_perl.pl
SUCCESS perl test
Test 7: sh.
$ ./TEST_sh.sh
SUCCESS sh test
Building libraries
A video of this part is available here.
Before getting started, you need to make another directory. Go inside your Build_WRF directory and then make a directory
called LIBRARIES .
$ cd {path_to_dir}/Build_WRF
$ mkdir LIBRARIES
Depending on the type of run you wish to make, there are various libraries that should be installed. Go inside your LIBRARIES
directory and then download all 5 tar files.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz http://www2.mmm.ucar.edu
It is important to note that these libraries must all be installed with the same compilers as will be used to install
WRFV3 and WPS.
Configuring NetCDF library: This library is always necessary! Modify the .bashrc file in the home directory of current user to
set the environment variables.
At the bottom of the file add these lines so that they will be set for future logins.
(...)
export DIR=/{path_to_dir}/Build_WRF/LIBRARIES
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64
Then source the file to make these settings active for current session.
$ source ~/.bashrc
Go into the netcdf-4.1.3 directory and run the configure script with the parameters presented below, make and make install.
converted by W eb2PDFConvert.com
$ cd {path_to_dir}/Build_WRF/LIBRARIES/netcdf-4.1.3
$ ./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared
$ make
$ make install
Modify again the .bashrc file and set two new environment variables at the bottom. Then source the file to make these settings
active for current session and leave the directory.
(...)
export PATH=$DIR/netcdf/bin:$PATH
export NETCDF=$DIR/netcdf
$ source ~/.bashrc
$ cd ..
Configuring MPICH library: This library is necessary if you are planning to build WRF in parallel. If your machine does not have
more than 1 processor, or if you have no need to run WRF with multiple processors, you can skip installing MPICH.
In principle, any implementation of the MPI-2 standard should work with WRF; however, we have the most experience with
MPICH, and therefore, that is what will be described here.
Assuming all the export commands were already issued while setting up NetCDF, you can continue on to install MPICH, issuing
each of the following commands.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ tar -zxvf mpich-3.0.4.tar.gz
$ cd {path_to_dir}/Build_WRF/LIBRARIES/mpich-3.0.4
$ ./configure --prefix=$DIR/mpich
$ make
$ make install
$ sudo nano ~/.bashrc
(...)
export PATH=$DIR/mpich/bin:$PATH
$ source ~/.bashrc
$ cd ..
Configuring zlib: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability. Assuming
all the export commands from the NetCDF install are already set, you can move on to the commands to install zlib.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ sudo nano ~/.bashrc
(...)
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
$ source ~/.bashrc
$ tar -zxvf zlib-1.2.7.tar.gz
$ cd {path_to_dir}/Build_WRF/LIBRARIES/zlib-1.2.7
$ ./configure --prefix=$DIR/grib2
$ make
$ make install
$ cd ..
Configuring libpng: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability.
Assuming all the export commands from the NetCDF install are already set, you can move on to the commands to install libpng.
converted by W eb2PDFConvert.com
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ tar -zxvf libpng-1.2.50.tar.gz
$ cd {path_to_dir}/Build_WRF/LIBRARIES/libpng-1.2.50
$ ./configure --prefix=$DIR/grib2
$ make
$ make install
$ cd ..
Configuring JasPer: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability.
Assuming all the export commands from the NetCDF install are already set, you can move on to the commands to install jasper.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ tar -zxvf jasper-1.900.1.tar.gz
$ cd {path_to_dir}/Build_WRF/LIBRARIES/jasper-1.900.1
$ ./configure --prefix=$DIR/grib2
$ make
$ make install
$ cd ..
$ cd {path_to_dir}/TESTS
$ wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
$ tar -xvf Fortran_C_NETCDF_MPI_tests.tar
$ cp ${NETCDF}/include/netcdf.inc .
$ 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
converted by W eb2PDFConvert.com
$ cp ${NETCDF}/include/netcdf.inc .
$ 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
Building WRFV3
A video of this part is available here.
After ensuring that all libraries are compatible with the compilers, you can now prepare to build WRFV3. If you do not already
have a WRFV3 tar file, move to your Build_WRF directory, download that file and unpack it. Then go into the WRFV3 directory
and create a configuration file for your computer and compiler.
$ cd {path_to_dir}/Build_WRF
$ wget http://www2.mmm.ucar.edu/wrf/src/WRFV3.8.TAR.gz
$ tar -zxvf WRFV3.8.TAR.gz
$ cd {path_to_dir}/Build_WRF/WRFV3
$ ./configure
You will see various options. Choose the option that lists the compiler you are using and the way you wish to build WRFV3 (i.e.,
serially or in parallel). Although there are 3 different types of parallel (smpar, dmpar, and dm+sm), it is recommend choosing
dmpar option.
converted by W eb2PDFConvert.com
checking for perl5... no
checking for perl... found /usr/bin/perl (perl)
Will use NETCDF in dir: /usr
HDF5 not set in environment. Will configure WRF for use without.
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information
$JASPERLIB or $JASPERINC not found in environment, configuring to build without grib2 I/O...
-----------------------------------------------------------------------------------------------
Please select from among the following Linux x86_64 options:
Configuration successful!
-----------------------------------------------------------------------------------------------
testing for MPI_Comm_f2c and MPI_Comm_c2f
MPI_Comm_f2c and MPI_Comm_c2f are supported
testing for fseeko and fseeko64
fseeko64 is supported
-----------------------------------------------------------------------------------------------
(...)
Once your configuration is complete, you should have a configure.wrf file, and you are ready to compile. To compile WRFV3,
you will need to decide which type of case you wish to compile. The options are listed below.
For this purpose we are going to compile WRF for real cases. Compilation should take about 20-30 minutes. The ongoing
compilation can be checked.
converted by W eb2PDFConvert.com
Once the compilation completes, to check whether it was successful, you need to look for executables in the WRFV3/main
directory.
$ ls -las main/*.exe
ndown.exe (one-way nesting)
real.exe (real data initialization)
tc.exe (for tc bogusing--serial only)
wrf.exe (model executable)
These executables are linked to 2 different directories. You can choose to run WRF from either directory.
WRFV3/run
WRFV3/test/em_real
Building WPS
A video of this part is available here.
After the WRF model is built, the next step is building the WPS program (if you plan to run real cases, as opposed to idealized
cases). The WRF model MUST be properly built prior to trying to build the WPS programs. If you do not already have the WPS
source code, move to your Build_WRF directory, download that file and unpack it. Then go into the WPS directory and make
sure the WPS directory is clean.
$ cd {path_to_dir}/Build_WRF
$ wget http://www2.mmm.ucar.edu/wrf/src/WPSV3.8.TAR.gz
$ tar -zxvf WPSV3.8.TAR.gz
$ cd {path_to_dir}/Build_WRF/WPS
$ ./clean
The next step is to configure WPS, however, you first need to set some paths for the ungrib libraries and then you can configure.
(...)
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
$ source ~/.bashrc
$ ./configure
You should be given a list of various options for compiler types, whether to compile in serial or parallel, and whether to compile
ungrib with GRIB2 capability. Unless you plan to create extremely large domains, it is recommended to compile WPS in serial
mode, regardless of whether you compiled WRFV3 in parallel. It is also recommended that you choose a GRIB2 option (make
sure you do not choose one that states "NO_GRIB2"). You may choose a non-grib2 option, but most data is now in grib2 format,
so it is best to choose this option. You can still run grib1 data when you have built with grib2.
Choose the option that lists a compiler to match what you used to compile WRFV3, serial, and grib2. Note: The option number
will likely be different than the number you chose to compile WRFV3.
converted by W eb2PDFConvert.com
Will use NETCDF in dir: /home/modelagem/Build_WRF/LIBRARIES/netcdf
Found Jasper environment variables for GRIB2 support...
$JASPERLIB = /home/modelagem/Build_WRF/LIBRARIES/grib2/lib
$JASPERINC = /home/modelagem/Build_WRF/LIBRARIES/grib2/include
-----------------------------------------------------------------------------------------------
Please select from among the following supported platforms:
The metgrid.exe and geogrid.exe programs rely on the WRF model's I/O libraries. There is a line in the configure.wps file
that directs the WPS build system to the location of the I/O libraries from the WRF model.
(...)
WRF_DIR = ../WRFV3
(...)
Above is the default setting. As long as the name of the WRF model's top-level directory is "WRFV3" and the WPS and WRFV3
directories are at the same level (which they should be if you have followed exactly as instructed on this page so far), then the
existing default setting is correct and there is no need to change it. If it is not correct, you must modify the configure file and then
save the changes before compiling.
You can now compile WPS. Compilation should take a few minutes. The ongoing compilation can be checked.
converted by W eb2PDFConvert.com
$ ./compile >& compile.log &
$ tail -f compile.log
Once the compilation completes, to check whether it was successful, you need to look for 3 main executables in the WPS top-
level directory. Then verify that they are not zero-sized.
$ ls -ls *.exe
geogrid.exe
metgrid.exe
ungrib.exe
$ cd {path_to_dir}/Build_WRF
$ wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_complete.tar.bz2
$ tar -xvf geog_complete.tar.bz2
$ mv geog WPS_GEOG
The directory infomation is given to the geogrid program in the namelist.wps file in the &geogrid section. The data expands
to approximately 10 GB. This data allows a user to run the geogrid.exe program.
$ cd WPS
$ nano namelist.wps
(...)
geog_data_path = '{path_to_dir}/Build_WRF/WPS_GEOG'
(...)
Post processing
ARWpost is a Fortran program that reads WRF-ARW input and output files, then generates GrADS output files.
Once the output files have been generated, GrADS can be used to produce horizontal or vertical cross-section plots of scalar
fields (contours) or vector fields (barbs or arrows), vertical profiles and soundings.
Is recommend the use of ARWpost Version 3 or higher. This code is not dependent on the successful compilation of the WRFV3
code, and can therefore be installed anywhere, even if WRFV3 is not installed on this computer.
Move to your Build_WRF directory, download the file and unpack it.
$ cd {path_to_dir}/Build_WRF
$ wget http://www2.mmm.ucar.edu/wrf/src/ARWpost_V3.tar.gz
$ tar -zxvf ARWpost_V3.tar.gz
Once unpacked, move to ARWpost directory and look for the following files.
converted by W eb2PDFConvert.com
$ cd {path_to_dir}/Build_WRF/ARWpost
$ ls -las
arch # A directory containing configure and
# compilation control
clean # Script to clean compiled code
compile # Script to compile the code
configure # Script to configure the compilation for
# your system
namelist.ARWpost # Namelist to control the running of the code
README # A text file containing basic information
# on running ARWpost
src # Directory containing all source code
script # Directory containing some grads sample
# scripts
util # Directory containing some utilities
Assuming that the NETCDF variable is set, it is possible to configure the ARWpost.
$ ./configure
You will see a list of options for your computer. Make sure the netCDF path is correct and pick the compile option for your
machine.
Edit the Makefile file into the src directory and modify the -L$(NETCDF) line into the ARWpost.exe environment to look
like:
$ cd {path_to_dir}/ARWpost/src
$ nano Makefile
(...)
-L$(NETCDF)/lib -lnetcdf -lnetcdff -I$(NETCDF)/include -lnetcdf
(...)
Move to the ARWpost directory and modify the CFLAGS and CPP lines into configure.arwp file.
$ cd {path_to_dir}/ARWpost
$ nano configure.arwp
(...)
CFLAGS = -fPIC -m64
CPP = /lib/cpp -P -traditional
(...)
Then compile the ARWpost. If successful, the executable ARWpost.exe will be created.
$ ./compile
$ ls -ls *.exe
ARWpost.exe
converted by W eb2PDFConvert.com
Extra steps
Install grads, nco and nedit:
Configuring cdo library: Download de cdo tar file and unpack it. Once unpacked, go inside the unpacked cdo folder and run the
configure script, make and make install. Then add the cdo environment into the .bashrc file and source it.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ wget https://code.zmaw.de/attachments/download/12760/cdo-1.7.2.tar.gz
$ tar -xvf cdo-1.7.2.tar.gz
$ cd cdo-1.7.2
$ ./configure --prefix=$DIR/cdo --with-netcdf=$DIR/netcdf --with-grib2=$DIR/grib2
$ make
$ make install
$ sudo nano ~/.bashrc
export PATH=$DIR/cdo/bin:$PATH
$ source ~/.bashrc
Configuring ncl library: Create a folder named ncl into the LIBRARY folder, download the ncl tar file and unpack it. Once
unpacked add the ncl environment variables into the .bashrc file and source it. If you get missing librtmp.so.0 library
message while running the ncl, try to locate the missing library into your system and make a symbolic link.
$ cd {path_to_dir}/Build_WRF/LIBRARIES
$ mkdir ncl
$ cd ncl
$ wget https://www.earthsystemgrid.org/download/fileDownload.html?logicalFileId=e087c7da-cd9a-11e4-bb80-00c0f03d5b7c
$ tar -zxvf ncl_ncarg-6.3.0.Linux_Debian7.8_x86_64_gcc472.tar.gz
$ sudo nano ~/.bashrc
export NCARG_ROOT=$DIR/ncl
export PATH=$NCARG_ROOT/bin:$PATH
export DISPLAY=:0.0
$ source ~/.bashrc
$ locate librtmp # if you get error message while loading shared libraries
/usr/lib/x86_64-linux-gnu/librtmp.so.1
$ cd /usr/lib/
$ sudo ln -s /usr/lib/x86_64-linux-gnu/librtmp.so.1 librtmp.so.0
$ ng4ex gsun01n -clean # execute this in super user mode if you get permission error
© 2017 GitHub, Inc. Terms Privacy Security Status Help Contact GitHub API Training Shop Blog About
converted by W eb2PDFConvert.com