If you downloaded the XBeach source code, you have to compile it in order to use the XBeach model. If you downloaded a pre-compiled version of XBeach, you can skip this entire step.
XBeach is written in Fortran and can be compiled on either a 32-bit Windows system or a UNIX system. XBeach is tested with two compilers on the following platforms:
- Windows XP 32-bit with the Intel Fortran compiler
- CentOS Linux (similar to Red Hat Linux) with the Intel Fortran or GFortran compiler
Other Windows and Linux platforms may not pose any problems, but it hasn't been tested officially yet. If you experience any problems on other Windows of Linux platforms, please describe the problem in the Compiling XBeach forum in the Forum page and we will try to help you out. Other compilers may pose problems and are not supported for now.
Use the Intel Fortran compiler
If you use the Intel Fortran compiler, the easiest way is to use this compiler from either the Visual Fortran or the Visual Studio 2008 (see figure) software development suites. You can open the corresponding project files in the trunk or the trunk/VS2008 directory and compile the entire project after selecting the right build (MPI, netCDF, debug, etc.)
Use the GFortran compiler
From the UNIX command line, go to the trunk directory of the XBeach source code location.
You can now compile XBeach by issuing the following commands:
This command can be preceded by on of the following commands, to clear previously compiled parts of XBeach:
If this doesn't work you might need to specify a MPI compiler specifically by adding the MPIFC environment option (of course, the path may be different):
>> FC=gfortran44 ./configure --with-netcdf >> FC=gfortran44 PKG_CONFIG_PATH=/opt/netcdf-4.1.1/gfortran/lib/pkgconfig ./configure --with-netcdf
>> FC=gfortran44 ./configure --with-mpi --with-netcdf >> FC=gfortran44 MPIFC=/opt/mpich2-1.0.8-gcc44-x86_64/bin/mpif90 PKG_CONFIG_PATH=/opt/netcdf-4.1.1/gfortran/lib/pkgconfig ./configure --with-mpi --with-netcdf
If you use the Intel Fortran compiler on a UNIX system, you might need to initialize the compiler by the following command:
The GFortran compiler and the XBeach library
Nowadays, XBeach can be compiled as library. In fact, XBeach is always compiled as library, possibly with a wrapper binary calling this library. See the following examples on how to deal with this new program structure and the GFortran compiler.
# this will put xbeach in the /home/user/xbeach-r1234/bin directory ./configure --prefix=/home/user/xbeach-r1234 && make install # this will put xbeach shell script + .libs directory in the current directory ./configure & make # this will create an xbeach wrapper script and .libs directory for multiple versions mkdir r1234 mkdir r1235 svn up -r1234 cd r1234 ../configure make cd ../r1235 ../configure make # this will make xbeach versions in multiple directories mkdir ~/xbeachr1234 mkdir ~/xbeachr1235 svn up -r1234 ./configure --prefix=$(cd;pwd)/xbeachr1234 make install make clean svn up -r1235 ./configure --prefix=$(cd;pwd)/xbeachr1235 make install # this debugs xbeach ./libtool --mode=execute gdb ./xbeach # this shows what xbeach is linked against ./libtool --mode=execute ldd ./xbeach # otool -L in OSX # this debugs xbeach in mpi in 2 different terminals mpirun -np 2 xterm -e ./libtool --mode=execute gdb ./xbeach