:orphan: ==================================== Complete Installation of WRF and WPS ==================================== | Before beginning the steps below, the following must be available on the system: * gfortran - *Even if using a different compiler to build WRF* * cpp * gcc *(version 9+)* * csh * perl * sh | Issue the following commands to check if they exist. If a path is returned, the package is installed. .. code-block:: which gfortran which cpp which gcc which csh which perl which sh | The following command checks the gcc version: .. code-block:: gcc --version | Additionally, the following UNIX commands are required: .. csv-table:: :width: 30% ar, awk, cat cd, cp, cut expr, file, grep gzip, head, hostname ln, ls, m4 make, mkdir, mv nm, printf, rm sed, sleep, sort tar, touch, tr uname, wc, which | | .. seealso:: For additional computing environment tests, see `System Environment Testing for WRF/WPS Installation `_ | | | Environment Settings ==================== *.bashrc* is a computing environment configuration file for the Bash shell - the assumed shell for this example. If using a different shell, modify the commands in the shell's environment script to the required syntax for the shell. | Open a terminal window (Linux/Unix environment). Before setting up the configuration script, create a directory (*wrf_dependencies*) in which you will build the required libraries, and which is used in the below set paths: .. code-block:: mkdir wrf_dependencies | Open the *.bashrc* file from the $HOME directory (``ls -a`` to see all files). Make the following modifications, depending on whether you are installing WRF/WPS with a GNU/gfortran or Intel compiler. * :ref:`Environment Settings for a GNU/gfortran Installation` * :ref:`Environment Settings for an Intel Installation` | | .. _Environment Settings for a GNU/gfortran Installation: Environment Settings for a GNU/gfortran Installation ---------------------------------------------------- .. note:: * Modify paths to YOUR specific environment. | .. code-block:: export dir=/absolute-path-to-wrf_dependencies-directory/wrf_dependencies export NETCDF=${dir}/netcdf export LD_LIBRARY_PATH=${NETCDF}/lib:${dir}/grib2/lib:${dir}/lib:${LD_LIBRARY_PATH} export PATH=${NETCDF}/bin:${dir}/mpich/bin:${dir}/bin:${PATH} export JASPERLIB=${dir}/grib2/lib export JASPERINC=${dir}/grib2/include | | Save, then source the *.bashrc* file to apply the settings. These settings are then automatically set with each newly-opened terminal window. .. code-block:: source .bashrc | | Set the following additional environment variables ONLY prior to building these dependencies. These SHOULD NOT be set when building WRF or WPS. Set these in the command line, one at a time: .. code-block:: export CC=gcc export CXX=g++ export FC=gfortran export FCFLAGS="-m64 -fallow-argument-mismatch" export F77=gfortran export FFLAGS="-m64 -fallow-argument-mismatch" export LDFLAGS="-L${NETCDF}/lib -L${dir}/grib2/lib" export CPPFLAGS="-I${NETCDF}/include -I${dir}/grib2/include -fcommon" | Ater installing the dependencies, these variables can be individually unset, or if a new terminal window is open, it will not retain the settings not saved to the *.bashrc* file. | | | .. _Environment Settings for an Intel Installation: Environment Settings for an Intel Installation ---------------------------------------------- .. note:: * Modify paths to YOUR specific environment. | .. code-block:: export dir=/absolute-path-to-wrf_dependencies-directory/wrf_dependencies export NETCDF=${dir}/netcdf export LD_LIBRARY_PATH=${NETCDF}/lib:${dir}/grib2/lib:${dir}/lib:${LD_LIBRARY_PATH} export PATH=${NETCDF}/bin:${dir}/mpich/bin:${dir}/bin:${PATH} export JASPERLIB=${dir}/grib2/lib export JASPERINC=${dir}/grib2/include export CC=icc export CXX=icpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=ifort export FC=ifort export F90=ifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' export LDFLAGS="-L/${dir}/lib -L/${dir}/netcdf/lib" export CPPFLAGS="-I/${dir}/include -I/${dir}/netcdf/include" | | Save, then source the *.bashrc* file to apply the settings. These settings are then automatically set with each newly-opened terminal window. .. code-block:: source .bashrc | | | | Install Libraries ================= Move to the *wrf_dependencies* directory: .. code-block:: cd $dir | | Issue the following commands to install the libraries: | | zlib ---- .. code-block:: wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.11.tar.gz tar xzvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure --prefix=$dir/grib2 make -j 4 make install cd .. rm -rf zlib* | | HDF5 ---- .. note:: HDF5 is not a mandatory library. It is only needed for use of HDF5 features, such as compression. | .. code-block:: wget https://github.com/HDFGroup/hdf5/archive/hdf5-1_10_5.tar.gz tar xzvf hdf5-1.10.5.tar.bz2 cd hdf5-1.10.5 ./configure --prefix=$dir --with-zlib=$dir/grib2 --enable-fortran --enable-shared make -j 4 make install cd .. rm -rf hdf5* | | netCDF-c -------- .. note:: To install with HDF5, modify the following line in the list of commands as: .. code-block:: ./configure --prefix=$dir/netcdf --disable-dap --enable-netcdf4 --enable-shared | .. code-block:: wget https://github.com/Unidata/netcdf-c/archive/v4.7.2.tar.gz tar xzvf v4.7.2.tar.gz cd netcdf-c-4.7.2 ./configure --prefix=$dir/netcdf --disable-dap --enable-netcdf4 --disable-hdf5 --enable-shared make -j 4 make install cd .. rm -rf v4.7.2.tar.gz netcdf-c* | | netCDF-fortran -------------- .. note:: To install with HDF5, modify the following lines in the list of commands as: .. code-block:: export LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz" ./configure --enable-shared --prefix=$dir/netcdf | .. code-block:: export LIBS="-lnetcdf -lz" wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.2.tar.gz tar xzvf v4.5.2.tar.gz cd netcdf-fortran-4.5.2 ./configure --prefix=$dir/netcdf --disable-hdf5 --enable-shared make -j 4 make install cd .. rm -rf netcdf-fortran* v4.5.2.tar.gz | | mpich ----- .. code-block:: wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz tar xzvf mpich-3.0.4.tar.gz cd mpich-3.0.4 ./configure --prefix=$dir/mpich make 2>&1 make install cd .. rm -rf mpich* | | | | Compile WRF =========== Move out of the *wrf_dependencies* directory to install WRF. .. note:: Depending on the compiler used to install the above dependencies, after typing ``./configure`` in the below set of commands, choose a **dmpar** option for either an Intel/ifort or GNU compiler. | .. code-block:: git clone --recurse-submodule https://github.com/wrf-model/WRF.git cd WRF ./configure ./compile em_real -j 4 >& log.compile | | | | Compile WPS =========== Move to the directory that contains the *WRF* directory. Following the below installation, you should have *WRF* and *WPS* directories in the same folder. .. note:: Depending on the compiler used to install the above dependencies, after typing ``./configure`` in the below set of commands, choose a **serial** option for either an Intel/ifort or GNU compiler. | .. code-block:: git clone https://github.com/wrf-model/WPS.git cd WPS export WRF_DIR=path-to-WRF-top-level-directory/WRF ./configure --build-grib2-libs ./compile >& log.compile | | | | |