Obtaining the source code & setting up the directory
This exercise is intended to give you practice building the GSI system. The GSI system requires the WRF I/O bindings, therefore it is necessary to build the WRF model before attempting to build the GSI source code.
The source code for WRFV3 has already been compiled and should be linked to for the GSI build. The GSI source code is available for this tutorial from the directory /wrfhelp/GSI/src/. You will need the tar file:
comGSI_v3.1.tar.gz

Move into your working directory.
cd /data1/${USER}/GSI

If you have not already, copy the GSI source code into your working directory.
cp /wrfhelp/GSI/src/comGSI_v3.1.tar.gz .

Unzip and untar the code in your working directory:
tar zxvf comGSI_v3.1.tar.gz

Before building, check that the NETCDF environment variable has been set. Type:
printenv | grep NETCDF
Confirm that the NETCDF environment variable is set. Typically the path will be something like /usr/local/netcdf/.
Configure and Compile the GSI code
First change into the GSI directory.
cd /data1/${USER}/GSI/comGSI_v3.1/
Since the source code comes pre-compiled, start by conducting a full clean of the directory,
./clean -a
Before running the configure script, it is necessary to set the path to the WRF build. This is done by setting the environment variable WRF_DIR to the path pointing to the WRF build.
For csh/tcsh type:
setenv WRF_DIR /wrfhelp/GSI/src/WRFV3

To configure GSI, type:
./configure

At the prompt, select the PGI compiler (option 1).
To compile GSI, type:
./compile >& compile.log
If the compilation is successful, the executable gsi.exe, will be created in the comGSI_v3.1/run/ directory. If the compilation is not successful, check the build log file compile.log for errors by searching the log file for the word "Error."
Note: Depending on the severity of optimization, this compilation can take take 20 minutes or more. On a typical modern Linux system, expect the build to take about ten minutes.
If WRF and GSI compiled correctly, return to the Practical Session Guide to set up and run the case(s) of your choice.