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 /classroom/wrfhelp/SOURCE_CODE
mkdir -p /classroom/users/${USER}/DA/compile
cd /classroom/users/${USER}/DA/compile
cp /classroom/wrfhelp/SOURCE_CODE/WRFDA_V3.9.tar.gz .
Unzip and untar the file:
tar -zxf WRFDA_V3.9.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"
Set the RTTOV environment variable for compiling with RTTOV support. This is optional, but RTTOV may be used for the upcoming radiance assimilation exercise.
setenv RTTOV /classroom/wrfhelp/external/rttov11
To compile WRFDA with HDF5 support (necessary for reading AMSR2 observations), set the HDF5 environment 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 /classroom/wrfhelp/SOURCE_CODE
cd /classroom/users/$USER/DA/compile
cp /classroom/wrfhelp/SOURCE_CODE/WRFPLUS_V3.9.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.9.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 /classroom/wrfhelp/SOURCE_CODE
cd /classroom/users/$USER/DA/compile
cp /classroom/wrfhelp/SOURCE_CODE/WRFDA_V3.9.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.9.tar.gz
cd WRFDA
As with 3DVAR and WRFPLUS, to reduce compilation time you can compile in parallel.
setenv J "-j 6"
Set the RTTOV environment variable for compiling with RTTOV support:
setenv RTTOV /classroom/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 /classroom/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.
|