Compile WRFV3
Compile WRFV3 cindyhg Tue, 10/15/2019 - 11:34Compilation: Compile WRFV3
Compile WRFV3 for real casesThe following exercise is intended to give you practice building the WRF-NMM. Compilation for both the real and idealized cases are provided below.
Set Environment Variables and Load Modules
Before building the WRF code, you must have a compiler and NetCDF modules loaded. Your environment has already been configured by editing your ~/.cshrc file. To check the loaded modules, type:
module list
Compilation of WRF is necessary prior to the compilation of WPS, UPP, and GSI.
Before getting started, create a directory and expand the code tarballs in it.
mkdir -p /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/
cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc
tar -xzvf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_WRFV3.tar.gz
tar -xzvf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_WPSV3.tar.gz
tar -xzvf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_UPP.tar.gz
tar -xzvf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_GSI.tar.gz
To build WRF, start by moving into the WRF source code directory,
cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WRFV3/
Since this component comes pre-compiled, start by conducting a full clean of the directory,
./clean -a
Before configuring, set the environmental variables:
setenv HWRF 1
setenv WRF_NMM_CORE 1
setenv WRF_NMM_NEST 1
setenv JASPERLIB
setenv PNETCDF_QUILT 1
setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
Configure WRF-NMM for HWRF
To configure WRF-NMM, go to the top of the WRF directory
cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WRFV3
and type:
./configure
You will be presented with a list of build choices for your computer. For Cheyenne, choose option 15 for Intel with distributed memory (dmpar).
Compile WRF-NMM for HWRF
To build the WRF-NMM component, enter the command
./compile nmm_real |& tee compile_nmm.log
It takes about 30 minutes for the WRF-NMM compilation to complete.
Note: If the compilation is sucessful, the two executables, real_nmm.exe and wrf.exe, will be created in the WRFV3/main/ directory. If the compilation is not successful, check your environment settings and examine the compile_nmm.log file created.
To start over, clean the directories and return to the ./configure step described above. A complete clean is strongly recommended if the compilation failed, if the Registry has been changed, or if the configuration file is changed. For your reference, a full description of the WRF-NMM build process is availabe in chapter 2 of the HWRF Users' Guide.
To conduct a partial clean that retains the configuration file, and just removes the object files (except those in external/), type:
./clean
To conduct a complete clean which removes all built files in all directories, as well as the configure.wrf, type:
./clean -a
A successful compilation produces two executables in the directory main/:
real_nmm.exe
wrf.exe
Compile Idealized Tropical Cyclone WRF-NMM
The HWRF idealized tropical cyclone WRF-NMM component requires different executables than for the real case. The following section will describe how to build the executables for the idealized case.
Start by creating copying the WRF code into a directory for the WRF-Idealized compilation.
cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc
cp -r WRFV3 WRFV3-Idealized
cd WRFV3-Idealized
Building the idealized component requires a slightly different configuration than for the standard WRF build. Therefore, the idealized build is in a seperate directory. Beause this componenet is pre-compiled, a complete clean of the previous build must be performed:
./clean -a
This removes ALL build files, including the executables, libraries, and the configure.hwrf.
Set Environment Variables
Correct configuration of WRF-NMM for the HWRF idealized tropical cyclone simulation requires setting the additional environment variable IDEAL_NMM_TC. Be sure you have also loaded the compiler modules described previously for the WRF compile. Several other variables must also be set:
setenv WRF_NMM_CORE 1
setenv WRF_NMM_NEST 1
setenv HWRF 1
setenv IDEAL_NMM_TC 1
setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
Configure WRF-NMM for Idealized Tropical Cyclone
At the top of the WRF directory (/glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WRFV3-Idealized/WRFV3), issue following the command:
./configure
You will be presented with a list of build choices for your computer. For Cheyenne, choose option 15.
Compiling WRF-NMM for Idealized Tropical Cyclone
Once the configure step is complete, the code is compiled by including the target nmm_tropical_cyclone to the compile command:
./compile nmm_tropical_cyclone
A successful compilation produces two executables in the directory main/:
ideal.exe WRF initialization
wrf.exe WRF model integration
Note: The only compilation requirements for the idealized capability are WPS and WRF. If wanted, UPP may also be used. The components MPIPOM-TC and coupler, GSI, GFDL vortex tracker, and hwrf-utilities are not used in HWRF idealized tropical cyclone simulations.