WW3 Tutorial: Basic Setup and Compilation Purpose
In this tutorial exercise, we will walk through the steps of installing and compiling version 7.14 of the WAVEWATCH III® code on your Linux machine. This is a simplified guide, so for a more detailed explanation, please refer to Chapter 5 of the manual. After compilation, we'll test the code with a simple regression test case to ensure a successful setup.
System Requirements
Before proceeding, ensure you meet the following system requirements:
A UNIX/Linux environment. Basic proficiency in operating systems like Linux. The following programs installed on your system: Fortran 90 compiler (e.g., gnu, mpt, intel, pgi compiler). NetCDF library (version >4.1.1). 1. Installation 1.1 Downloading the Distribution Code Clone the WW3 code from the GitHub repository. Open a terminal and run:
bash, use the scp node to run git clone command Copy code git clone https://github.com/umr-lops/WW3.git In an interactive node cd WW3 ./model/bin/ww3_from_ftp.sh This script will download data for regression tests from NOAA-EMC ftp.
Define the WW3 main directory as an environment variable in your Linux environment configuration file (~/.cshrc or ~/.bashrc):
bash Copy code echo 'export WW3=$PWD' » ~/.bashrc source ~/.bashrc 1.2 Defining the Environment Depending on your available compilers, you can compile WW3 with Intel, MPT, GNU, or PGI compilers. The compiler must provide a Fortran and C executable. We recommend using an MPI library for realistic runs. Ensure you have the NetCDF4 library installed with the required configurations:
bash Copy code echo $NetCDF_ROOT 1.3 Setting the Model Parameterization The wave model's numerical parameterization is done through CPP keys, listed in a switch file. Templates like switch_Ifremer1 and switch_Ifremer2 are provided by institutions.
1.4 Compilation Compilation of WW3 is done using CMake, which requires CMake 3.19+. Follow these steps:
Create a separate build directory and navigate to it:
bash Copy code cd $HOME/WW3 rm -rf build mkdir build cd build Run CMake with the appropriate switch file. Replace Ifremer2 with your chosen switch file:
bash Copy code cmake .. -DSWITCH=Ifremer2 Build WW3. Adjust the -j value according to the number of CPU cores available:
bash Copy code make -j8 If needed, recompile individual programs:
bash Copy code cmake –build . –target ww3_shel make ww3_shel To compile with debug options, use:
bash Copy code cmake .. -DCMAKE_BUILD_TYPE=Debug -DSWITCH=Ifremer2 make ww3_shel To clean up your installation, simply remove the build directory:
bash Copy code rm -rf $HOME/WW3/build 2. Running a Simple Regression Test It's a good practice to test your installation with regression tests. We will run the ww3_tp2.2 regression test as an example.
Navigate to the regression test directory:
bash Copy code cd $HOME/WW3/regtests/ww3_tp2.2 Create a work directory and copy input files and WW3 executables:
bash Copy code mkdir work2 cd work2 cp ../input/* . cp ../work/build/bin/ww3* . Perform the following steps sequentially:
Step 1: Run the grid preprocessor ww3_grid:
bash Copy code ./ww3_grid | tee ww3_grid.out Step 2: Run the initial conditions preprocessor ww3_strt:
bash Copy code ./ww3_strt | tee ww3_strt.out Step 3: Run the main model subprogram ww3_shel:
bash Copy code ./ww3_shel | tee ww3_shel.out Step 4: Run the field post-processing program ww3_ounf:
bash Copy code ./ww3_ounf | tee ww3_ounf.out If everything runs successfully, you should have the expected output files.
Conclusion You have now installed, compiled, and validated the WW3 code. The WW3 program executables are located in the directory $WW3/build/bin/. If you need further information or have questions, you can contact Mickael Accensi (Mickael.accensi-at-ifremer.fr).
Appendix A - Local Installation of CMake Make sure you have CMake version 3.18 or higher installed. If not, you can install it locally:
bash Copy code export CXX=g++ export CXXFLAGS=-fPIC cd $HOME mkdir CMAKE-3.22.1 cd CMAKE-3.22.1 wget -mnH –cut-dirs=5 https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1.tar.gz tar xzf cmake-3.22.1.tar.gz cd cmake-3.22.1 ./bootstrap –prefix=$HOME/CMAKE-3.22.1 –parallel=8 >& Configure.out make >& Compile.out make install >& Install.out Appendix B - Local Installation of MPI Environment Ensure you have the necessary dependencies installed, such as gfortran, gcc, build-essential, and mpich. Follow the official instructions for your system to install MPI and related libraries.
Remember to grant execute permissions to directories and sub-directories during installation.