This page contains directions on how to compile the code, so you'll be ready to try it yourself when you get home. We don't recommend using code you've compiled yourself for the classroom exercises; use pre-compiled code instead. |
Compiling WRFDA for 3DVAR
Reference: Download the tutorial presentation
Create a new directory for practicing compilation, then get the WRFDA zipped tar file from /kumquat/wrfhelp/SOURCE_CODE
mkdir -p /kumquat/users/${USER}/DA/compile
cd /kumquat/users/${USER}/DA/compile
cp /kumquat/wrfhelp/SOURCE_CODE/WRFDA_V3.8.tar.gz .
Unzip and untar the file:
tar -zxf WRFDA_V3.8.tar.gz
Using ls, you should now see the directory WRFDA, which contains the WRFDA source code. Enter that directory
cd WRFDA
To reduce compilation time you can compile in parallel (this is a separate process from deciding to run WRFDA in serial or parallel mode). You can do this by setting the environment variable J="-j #", where "#" is the number of processors.
setenv J "-j 6"
Only one radiative transfer model is necessary, but WRFDA can be compiled with both, so set the CRTM and/or RTTOV environment variables:
setenv CRTM 1
setenv RTTOV /kumquat/wrfhelp/external/rttov11
To compile WRFDA with HDF5 support (necessary for reading AMSR2 observations), set the HDF5 envirnment variable appropriately:
setenv HDF5 /usr/local/hdf5-1.8.15-patch1-gcc/
Configure and compile
./configure wrfda
Choose 34 for GNU (gfortran/gcc), dmpar
./compile all_wrfvar >& compile_3dvar.log &
The ">& compile_3dvar.log" part of the command instructs the terminal to direct all output and error messages from the compile script to the file compile_3dvar.log. The "&" at the end will cause the script to run in the background. You can use the UNIX "tail" command to follow the progress of the script by seeing what's written to the log file (use Ctrl-C to quit tail).
tail -f compile_3dvar.log
Compilation should take about 5 minutes on the classroom computers. When compilation is completed, at the end of the log file you will see "build started:" and "build completed:" indicating the start and finish time for the script. However, this does not mean that compilation was successful! You need to check that all the necessary files were created; use the following command:
ls var/build/*exe var/obsproc/src/obsproc.exe
You should see 44 executables: 43 in the var/build/ directory, plus var/obsproc/src/obsproc.exe. You can count them using the wc command:
ls var/build/*exe var/obsproc/src/obsproc.exe | wc -l
The most important of these executables is var/build/da_wrfvar.exe; this is the main WRFDA executable.
Compiling WRFPLUS
WRFPLUS contains both the non-linear and the tangent-linear/adjoint WRF code. It is needed for 4DVAR and Forecast Sensitivity to Observations (FSO).
Get the WRFPLUS zipped tar file from /kumquat/wrfhelp/SOURCE_CODE
cd /kumquat/users/$USER/DA/compile
cp /kumquat/wrfhelp/SOURCE_CODE/WRFPLUS_V3.8.tar.gz .
Set "J" to compile in parallel
setenv J "-j 6"
Unzip and untar the file, then enter the directory
tar -zxf WRFPLUS_V3.8.tar.gz
cd WRFPLUSV3
Configure and compile the WRFPLUS code. WRFPLUS does not need to be built with any external libraries except for netCDF, which should already be set in the classroom environment under the environment variable $NETCDF
./configure wrfplus
Choose 18 for GNU (gfortran/gcc), dmpar
./compile wrf >& compile_wrfplus.log &
Compilation should take 5-10 minutes on the classroom computers. You can use the UNIX "tail" command to follow the progress of the script by seeing what's written to the log file.
tail -f compile_wrfplus.log
When compilation is completed, check to ensure wrf.exe was created in the WRFPLUSV3/main/ directory.
Compiling WRFDA for 4DVAR
To compile WRFDA for 4DVAR, you should have already compiled WRFPLUS (see above).
Get the WRFDA zipped tar file from /kumquat/wrfhelp/SOURCE_CODE
cd /kumquat/users/$USER/DA/compile
cp /kumquat/wrfhelp/SOURCE_CODE/WRFDA_V3.8.tar.gz .
If you have already built WRFDA in this directory for 3DVAR, be sure to rename that directory first.
mv WRFDA WRFDA_3DVAR
Unzip and untar the file, then enter the WRFDA directory
tar -zxf WRFDA_V3.8.tar.gz
cd WRFDA
As with 3DVAR and WRFPLUS, to reduce compilation time you can compile in parallel.
setenv J "-j 6"
Only one radiative transfer model is necessary, but WRFDA can be compiled with both, so set the CRTM and/or RTTOV environment variables:
setenv CRTM 1
setenv RTTOV /kumquat/wrfhelp/external/rttov11
To compile WRFDA with HDF5 support (necessary for reading AMSR2 observations), set the HDF5 envirnment variable appropriately:
setenv HDF5 /usr/local/hdf5-1.8.15-patch1-gcc/
Finally, to compile WRFDA for 4DVAR, you'll have to specify the location of the WRFPLUS code. Set the environment variable WRFPLUS_DIR to point to the WRFPLUS build you just installed.
setenv WRFPLUS_DIR /kumquat/users/$USER/DA/compile/WRFPLUSV3
Configure and Compile for 4DVAR (note the different "configure" command):
./configure 4dvar
Choose 18 for GNU (gfortran/gcc), dmpar
./compile all_wrfvar >& compile_4dvar.log &
Compilation should take about 5 minutes on the classroom computers. You can use the UNIX "tail" command to follow the progress of the script by seeing what's written to the log file.
tail -f compile_4dvar.log
When compilation is completed, at the end of the log file you will see "build started:" and "build completed:" indicating the start and finish time for the script. However, this does not mean that compilation was successful! You need to check that all the necessary files were created; use the following command:
ls var/build/*exe var/obsproc/src/obsproc.exe
You should see 44 executables: 43 in the var/build/ directory, plus var/obsproc/src/obsproc.exe. The most important of these is var/build/da_wrfvar.exe; this is the main WRFDA executable.
Cloudy radiance code
The code for the cloudy radiance exercise is not yet available in the latest release version of WRFDA (version 3.8, which is used for most classroom exercises). However, we currently have a separate beta release of the code with the cloudy radiance capabilities included. This section will instruct you on how to download and install that code
Get the zipped tar file from /kumquat/wrfhelp/SOURCE_CODE, or download it from the WRFDA Users' website.
cd /kumquat/users/$USER/DA
cp /kumquat/wrfhelp/SOURCE_CODE/WRFDA_V38_cloudy_radiance_beta.tar.gz .
tar -zxf WRFDA_V38_cloudy_radiance_beta.tar.gz
cd WRFDA_CR
Configure and compile the code the same way you did above, and check for successful compilation before using the code.
The CLOUD_CV option
For some newer WRFDA features, you will need additional control variables to properly handle moisture variables. While this is not required for any of the classroom exercises, you can try compiling the code with this option below. You can find more information in the relevant section of the user's guide.
Get the WRFDA zipped tar file from /kumquat/wrfhelp/SOURCE_CODE if you haven't already
cd /kumquat/users/${USER}/DA
cp /kumquat/wrfhelp/SOURCE_CODE/WRFDA_V3.8.tar.gz .
Since a directory named WRFDA already exists, create a new one and extract the WRFDA tarball there
mkdir -p WRFDA_CLOUDCV
tar -zxf WRFDA_V3.8.tar.gz -C WRFDA_CLOUDCV --strip-components=1
cd WRFDA_CLOUDCV
Follow all the steps above prior to running the configure script. Then set the CLOUD_CV environment variable:
setenv CLOUD_CV 1
This will make the code compile with the extra moisture control variable options enabled. Note that this will result in slower code even if you are not using the CLOUD_CV control variable options, so it is recommended that you only use this code for experiments that are using the CLOUD_CV moisture control variables!
Configure and compile the code the same way you did above, and check for successful compilation before using the code.
|