next up previous
Next: Compiling and linking SWASH Up: Manual installation Previous: Manual installation

Modifications in the source code

To compile SWASH on your computer system properly, some subroutines should be adapted first depending on the operating system, use of compilers and the wish to use MPI for parallel runs. This can be done by removing the switches started with '!' followed by an indentifiable prefix in the first 3 or 4 columns of the subroutine. A Perl script called is provided in the material that enables the user to quickly select the switches to be removed. This script can be used as follows:

perl [-dos] [-unix] [-f95] [-mpi] [-cray] [-sgi]
               [-cvis] [-timg] [-matl4] [-impi] *.ftn[90]
where the options are all optionally. The meaning of these options are as follows.
-dos, -unix
Depending on the operating system, both the TAB and directory separator character must have a proper value (see also Chapter 4). This can be done by removing the switch !DOS or !UNIX, for Windows and UNIX/Linux platforms, respectively, in the subroutines OCPINI (in ocpids.ftn) and TXPBLA (in swanser.ftn). For other operating system (e.g., Macintosh), you should change the values of the following variables manually: DIRCH1, DIRCH2 (in OCPINI), TABC (in OCPINI) and ITABVL (in TXPBLA).
If you have a Fortran 95 compiler or a Fortran 90 compiler that supports Fortran 95 features, it might be useful to activate the CPU_TIME statement in the subroutines SWTSTA and SWTSTO (in swanser.ftn) by removing the switch !F95 meant for the detailed timings of several parts of the SWASH calculation. Note that this can be obtained with the command TEST by setting itest=1 in your command file.
For the proper use of MPI, you must remove the switch !MPI at several places in the files swanparll.ftn, Swash*2DHflow.ftn90 and m_parall.ftn.
-cray, -sgi
If you use a Cray or SGI Fortran 90 compiler, the subroutines OCPINI (in ocpids.ftn) and FOR (in ocpmix.ftn) should be adapted by removing the switch !/Cray or !/SGI since, these compilers cannot read/write lines longer than 256 characters by default. By means of the option RECL in the OPEN statement sufficiently long lines can be read/write by these compilers.
The same subroutines OCPINI and FOR need also to be adapted when the Compaq Visual Fortran compiler is used in case of a parallel MPI run. Windows systems have a well-known problem of the inability of opening a file by multiple SWASH executables. This can be remedied by using the option SHARED in the OPEN statement for shared access. For this, just remove the switch !CVIS.
If the user want to print the timings (both wall-clock and CPU times in seconds) of different processes within SWASH then remove the switch !TIMG. Otherwise, no timings will be keeped up and subsequently printed in the PRINT file.
By default, the created binary Matlab files are of Level 5 MAT-File format and are thus compatible with MATLAB version 5 and up. In this case the switch !MatL5 must be removed. However, some machines do not support a 1-byte unit for the record length (e.g. IBM Power6). At those computers, the binary Matlab files must be formatted of Level 4. In this case the switch !MatL4 must be removed while the switch !MatL5 should not be removed. Level 4 MAT-files are compatible with MATLAB versions 4 and earlier. However, they can be read with the later versions of MATLAB.
Some Fortran compilers do not support USE MPI statement and therefore, the module MPI in m_parall.ftn must be included by removing the switch !/impi.

For example, you work on a Linux cluster where MPI has been installed and use the Intel Fortran compiler (that can handle Fortran 95 statements), then type the following:

perl -unix -f95 -mpi *.ftn *.ftn90
Note that due to the option -unix the extension ftn is automatically changed into f and ftn90 into f90.

next up previous
Next: Compiling and linking SWASH Up: Manual installation Previous: Manual installation
The SWASH team 2017-04-06