-
Notifications
You must be signed in to change notification settings - Fork 7
7.5. WRF
Hua Xu edited this page Sep 17, 2023
·
47 revisions
create a Test folder
mkdir TESTS
cd TESTS
Download the test cases and start tests, the output of tests should include SUCCESS
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar
tar -xf Fortran_C_tests.tar
gfortran TEST_1_fortran_only_fixed.f
./a.out
gfortran TEST_2_fortran_only_free.f90
./a.out
gcc TEST_3_c_only.c
./a.out
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
./TEST_csh.csh
./TEST_perl.pl
./TEST_sh.sh
mkdir Build_WRF
cd Build_WRF
mkdir LIBRARIES
cd LIBRARIES
download and unzip the required libraries.
- nedcdf-c-4.9.2
wget -c https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz
tar xzvf netcdf-c-4.9.2.tar.gz
- hdf5(you can also install the newest version)
wget -c https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz
tar xzvf hdf5-1.12.2.tar.gz
- zlib(1.2.11)
wget -c 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
- NETCDF-Fortran(4.6.1)
wget https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.1/netcdf-fortran-4.6.1.tar.gz
tar xzvf netcdf-fortran-4.6.1.tar.gz
- PnetCDF(1.12.3)
wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz
tar xzvf pnetcdf-1.12.3.tar.gz
- LibPNG
wget -c https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
tar xzvf libpng-1.2.50.tar.gz
- MPICH
module load mpich
set the environment variables
export DIR=/PATH/TO/Build_WRF/LIBRARIES
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
module load libxml2
- install the zlib
cd zlib-1.2.11/
./configure --prefix=$DIR
make
make install
- install the hdf5
cd hdf5-1.12.2/
./configure --prefix=$DIR --with-zlib=$DIR --enable-hl --enable-fortran
make check
make install
export HDF5=$DIR
export LD_LIBRARY_PATH=$DIR/lib:$LD_LIBRARY_PATH
- Build NETCDF-C
cd netcdf-c-4.9.2
export CPPFLAGS=-I$DIR/include
export LDFLAGS=-L$DIR/lib
./configure --prefix=$DIR --disable-dap
make check
make install
export PATH=$DIR/bin:$PATH
export NETCDF=$DIR
- build NetCDF fortran library links with NETCDF-C, after successful installation, netcdf.inc will be ${NETCDF}/include file. For sometimes, it will show C compiler stop working, Please check the environment variable in LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz", make sure netcdf and hdf5 path in the environment variables.
export LD_LIBRARY_PATH=$DIR/lib:$LD_LIBRARY_PATH
export CPPFLAGS="-I${DIR}/include -I/usr/include"
export LDFLAGS="-L${DIR}/lib -L/usr/lib"
export LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz"
./configure --prefix=$DIR --disable-shared
make check
make install
- Install the WRF
cd ..
wget https://github.com/wrf-model/WRF/releases/download/v4.5.1/v4.5.1.tar.gz
tar xvzf 4.5.1.tar.gz
cd WRFV4.5.1
module load adios2
export ADIOS2="/mnt/repo/software/spack/spack/opt/spack/linux-ubuntu22.04-skylake_avx512/gcc-11.3.0/adios2-2.9.0-mmkelnu4f4f4hpejrpdwofyrnguat27y
export HDF5=$DIR
export NETCDF=$DIR
./configure
Please select from among the following Linux x86_64 options: Choose 34(dmpar), Compile for nesting? choose 1. If configure is done, you can see a configure.wrf file in the folder.
./compile em_real
#./compile em_real >& log.compile
export WRF_DIR=PATH/to/WRF4.5.1
You can see the following information shows the installation is successful.
---> Executables successfully built <--- -rwxrwxr-x 1 hxu40 hxu40 51667784 Sep 15 12:21 main/ndown.exe -rwxrwxr-x 1 hxu40 hxu40 51794800 Sep 15 12:21 main/real.exe -rwxrwxr-x 1 hxu40 hxu40 50930720 Sep 15 12:21 main/tc.exe -rwxrwxr-x 1 hxu40 hxu40 59885752 Sep 15 12:21 main/wrf.exe ==========================================================================
To check check whether it was successful
ls -ls main/*.exe
If you compiled a real case, you should see:
wrf.exe (model executable)
real.exe (real data initialization)
ndown.exe (one-way nesting)
tc.exe (for tc bogusing--serial only)