page header
 
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

Create a new directory for practicing compilation, then clone WRF code github

mkdir -p /home/ec2-user/compile

cd /home/ec2-user/compile

git clone --branch release-v4.1.2 https://github.com/wrf-model/WRF WRFDA-3DVAR

Using ls, you should now see the directory WRFDA-3DVAR, which contains the WRFDA source code. Enter that directory

cd WRFDA-3DVAR

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"

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).

cd /home/ec2-user/compile

Set "J" to compile in parallel

setenv J "-j 6"

git clone --branch release-v4.1.2 https://github.com/wrf-model/WRF WRFPLUS

cd WRFPLUS

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 wrfplus >& 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).

cd /home/ec2-user/compile

git clone --branch release-v4.1.2 https://github.com/wrf-model/WRF WRFDA-4DVAR

cd WRFDA-4DVAR

As with 3DVAR and WRFPLUS, to reduce compilation time you can compile in parallel.

setenv J "-j 6"

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 /home/ec2-user/compile/WRFPLUS

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.

 


back to top
 
practice_page_header