Preparation of various installation packages
Official website tutorial: https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php
The installation packages required according to the official website tutorial are as follows
support library | purpose |
---|---|
zlib-1.2.7 | zlib is a function library for data compression and a necessary library for WPS (which will be mentioned later). |
netcdf-4.1.3 | To read nc files. |
mpich-3.0.4 | The tool for parallel operation is for parallel processing WRF, which means that if the computer is single core, it can not be installed, ha ha. |
libpng-1.2.50 | libpng is a cross platform library for reading and writing PNG files written in C language, which needs zlib support. The compression library necessary to compile WPS with GRIB2 function (especially ungrib). |
Jasper-1.900.1 | It is also a picture library and a compression library necessary for compiling WPS with GRIB2 function (especially ungrib). |
Support Library Download
- Download using Linux commands.
- Enter the website to download directly. https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/
- Download from the link to the official tutorial.
- Leave an email and the author will send it to you.
Here, the author demonstrates the first download method. Please put the compressed packages obtained from the last three methods in build_ Under WRF folder
*Prompt two actions*
cd.. Return to the previous file directory cd Return to top level
Step 1: enter Build_WRF file directory
Input:
cd Build_WRF
Step 2: create LIBRARIES folder
This is just in build_ Create the LIBRARIES folder under the WRF file directory, but do not enter it.
Input:
mkdir LIBRARIES
Step 3: download the third-party library
In build_ Under the WRF file directory, enter the following five commands in sequence:
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
So, in build_ There are five compressed packages under the WRF file.
Support library installation
Please be sure to install in the following order. Of course, zlib seems to have some impact. Try your best, ha ha.
Step 1: install zlib
Input in sequence
tar xzvf zlib-1.2.7.tar.gz Unzip file cd zlib-1.2.7 Enter this folder make make install cd .. Return to the previous folder
The screenshot is just a pile of English. Pay attention to returning it to build at last_ WRF directory
Step 2: install mpich
Input in sequence
tar xzvf mpich-3.0.4.tar.gz Unzip file cd mpich-3.0.4 Enter this folder ./configure --prefix=$DIR/mpich make make install cd .. Return to the previous folder
The screenshot is just a pile of English. Pay attention to returning it to build at last_ WRF directory
Step 3: install libpng
Input in sequence
tar xzvf libpng-1.2.50.tar.gz Unzip file cd libpng-1.2.50 Enter this folder ./configure --prefix=$DIR/grib2 make make install cd .. Return to the previous folder
The screenshot is just a pile of English. Pay attention to returning it to build at last_ WRF directory
Step 4: install jasper
Input in sequence
tar xzvf jasper-1.900.1.tar.gz Unzip file cd jasper-1.900.1 Enter this folder ./configure --prefix=$DIR/grib2 make make install cd .. Return to the previous folder
The screenshot is just a pile of English. Pay attention to returning it to build at last_ WRF directory
Step 5: install netcdf
Input in sequence
tar xzvf netcdf-4.1.3.tar.gz //Unzip file cd netcdf-4.1.3 //Enter this folder ./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared make make install cd .. //Return to the previous folder
A message appears if the installation is successful
Note that build should be returned at last_ WRF directory
After the successful installation of netcdf, you need to modify the environment variables, but all variables have been modified in the previous post, so you don't need to modify them here. The following statements are for you to understand
environment variable export PATH=$DIR/netcdf/bin:$PATH export NETCDF=$DIR/netcdf
Optional hdf5 Library (not necessary)
The official tutorial does not provide the installation of this library. It should be an unnecessary support library to process hdf5 data.
We also simply install the following
Step 1: Download
Also in Build_WRF directory
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.22/src/hdf5-1.8.22.tar.gz
Step 2: unzip and install
tar -xvf hdf5-1.8.22.tar.gz cd hdf5-1.8.22 ./configure --prefix=$DIR/hdf5 make make install cd .. //Return to the previous folder
It doesn't matter whether you succeed or not.
test
This is also required by the official tutorial to check the installation of the support library
Step 1: download the test package
Start with Build_WRF directory to TESTS directory
cd cd TESTS
There are four ways to download
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
Step 2: unzip the test package
tar -xf Fortran_C_NETCDF_MPI_tests.tar
No response, it doesn't matter. Just keep going
Step 3: Test
Step 1: Fortran + C + NetCDF
Input in sequence: (don't forget the points in the first line)
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
The results shown in the figure represent success
Step 2: Fortran + C + NetCDF + MPI
Input in sequence: (don't forget the points in the first line)
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
The results shown in the figure represent success
At this point, all previous preparations required for WRF are completed