Compiling WRFV3, WPS, UPP, and GSI

Compiling WRFV3, WPS, UPP, and GSI cindyhg Tue, 10/15/2019 - 11:31

Compilation: Building the WRF, WPS, GSI, and UPP componements

Creating a working directory and extracting the sourcesThis exercise is intended to give you practice building the components WRF-NMM, WPS, and UPP, and GSI.

The source code is available in the tar files used previously, and is located on Cheyenne in the /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/ directory. The tar files you will need are:

HWRF_v3.9a_hwrfrun.tar.gz
HWRF_v3.9a_WRFV3.tar.gz
HWRF_v3.9a_WRFV3_Idealized.tar.gz
HWRF_v3.9a_WPSV3.tar.gz
HWRF_v3.9a_GSI.tar.gz
HWRF_v3.9a_UPP.tar.gz

Create and move into a working directory.

mkdir -p ${SCRATCH}/HWRF_building && cd ${SCRATCH}/HWRF_building

Untar the code under your working directory.

tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_hwrfrun.tar.gz
cd ${SCRATCH}/HWRF_building/hwrfrun/sorc
tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_WRFV3.tar.gz
tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_WRFV3_Idealized.tar.gz
tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_WPSV3.tar.gz
tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_GSI.tar.gz
tar -zxf /glade/p/ral/jnt/HWRF/HWRF_v3.9a_tut_codes/HWRF_v3.9a_UPP.tar.gz

Compile WRFV3

Compile WRFV3 cindyhg Tue, 10/15/2019 - 11:34

Compilation: 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.

Compile WPS

Compile WPS cindyhg Tue, 10/15/2019 - 11:35

Compile WPS

Configure WPS

Change to the WPS directory (cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WPSV3), clean (remove pre-compile) and issue the configure command:

 

./clean -a

 

./configure

 

For Cheyenne, choose option 19 for dmpar with GRIB 2 support.  

 

Note: To compile WPS with GRIB2 support, the JasPerzlib and PNG libraries are needed.

Compile WPS

Issue the compile command:

 

./compile |& tee compile_wps.log

 

Note: If the compilation does not succeed in producing the executables, it will be necessary to conduct a clean on the WPSV3 directory. A complete clean is strongly recommended if the compilation failed or if the configuration file is changed.

 

To conduct a partial clean that retains the configuration file, and just removes the object files, type:

 

./clean

 

To conduct a complete clean which removes all built files in all directories, as well as the configure.wps, type:

 

./clean -a

 

After issuing the compile command, a listing of the current working directory should reveal symbolic links to executables for each of the three WPS programs:

geogrid.exe
ungrib.exe
metgrid.exe

Several symbolic links should also be in the util/ directory:

avg_tsfc.exe
calc_ecmwf_p.exe
g1print.exe
g2print.exe
height_ukmo.exe
int2nc.exe
mod_levs.exe   (used for idealized runs)
rd_intermediate.exe

 

If any of these links do not exist, check the compilation output in the compile_wps.log file to see what went wrong.

Note: This compilation only takes a few minutes.

Compile GSI

Compile GSI cindyhg Tue, 10/15/2019 - 11:37

Compile GSI

Set Environment Variables

To set up the environment for GSI, there are a couple environment variables not set in ~/.cshrc. These can be set by typing:

setenv HWRF 1

setenv WRF_DIR /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WRFV3/

setenv LAPACK_PATH ${MKL}

 

Configure GSI

To build GSI for HWRF, change into the GSI/dtc directory (cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/GSI/dtc), clean (remove pre-compile) and issue the configure command.

 

./clean -a

 

./configure

Choose option 6 for Intel compiler with dmpar.

 

Compile GSI

After selecting the proper option, run the compile script:

 

./compile |& tee compile_gsi.log

 

Following the compile command, the GSI executable gsi.exe can be found in the dtc/run/ directory.

If the compilation does not succeed in producing the executable (GSI/dtc/run/gsi.exe), check your environment settings and examine the compile_gsi.log file created. It will be necessary to conduct a clean on the GSI/dtc directory. A complete clean (./clean -a) is strongly recommended if the compilation failed or if the configuration file is changed.

For your reference, a full description of the build process is availabe in chapter 2 of the HWRF Users' Guide.

 

Note: This compilation can take 15 minutes or more.

Compile UPP

Compile UPP cindyhg Tue, 10/15/2019 - 11:38

Compile UPP

Set Environment Variables

Before compiling UPP, check that the HWRF environment variable is set:

echo $HWRF
If it is not set to 1, set it by typing the following: setenv HWRF 1

 

Next, set WRF_DIR to its absolute path:
setenv WRF_DIR /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/WRFV3/

 

Configure UPP

To build UPP for HWRF, change into the UPP directory (cd /glade/scratch/${USER}/HWRF_building/hwrfrun/sorc/UPP), clean (remove pre-compile) and issue the configure command.

 

./clean -a

To configure the UPP for compilation, type:

 

./configure

 

to generate the UPP configure file. 

 

You will then be given a list of configuration choices tailored to your computer. Choose option 4.

 

Compile UPP

To compile UPP, enter the command:

 

./compile |& tee compile_upp.log

 

This command should create 13 UPP libraries in lib/ :

  • libbacio.a
  • libCRTM.a
  • libg2.a
  • libg2tmpl.a
  • libgfsio.a
  • libip.a
  • libnemsio.a
  • libsfcio.a
  • libsigio.a
  • libsp.a
  • libw3emc.a
  • libw3nco.a
  • libxmlparse.a

and four UPP executables in bin/ :

  • unipost.exe
  • ndate.exe
  • copygb.exe
  • cnvgrib.exe

 

To remove all built files, as well as the configure.upp, type:

 

./clean -a

When the compilation is complete, a listing of the bin directory should reveal executables for each of the four UPP programs. If any of these executables do not exist, check the compilation output in the compile_upp.log file to see what went wrong.