After the necessary modifications are made as described in the previous section, the source code is
ready for compilation. All source code is written in Fortran 90 so you must have a
Fortran 90 compiler in order to compile SWAN. The source code cannot be compiled with a Fortran 77
compiler. If you intended to use MPI for parallel runs, you must use the command mpif90 (or mpiifort in case of the Intel compiler) instead
of the original compiler command.
The SWAN source code complies with the ANSI Fortran 90 standard, except for a few cases, where
the limit of 19 continuation lines is violated. We are currently not aware of any compiler that cannot
deal with this violation of the ANSI standard.
When compiling SWAN you should check that the compiler allocates the same amount of memory
for all INTEGERS, REAL and LOGICALS. Usually, for these
variables 4 bytes are allocated, on supercomputers (vector or parallel), however, this sometimes
is 8 bytes. When a compiler allocates 8 bytes for a REAL and 4 bytes for an
INTEGER, for example, SWAN will not run correctly.
Furthermore, SWAN can generate binary MATLAB files on request, which are unformatted. Some compilers,
e.g. Intel Fortran, measured record length in 4-byte or longword units and
as a consequence, these unformatted files cannot be loaded in MATLAB. Hence, in such as case a
compiler option is needed to request 1-byte units, e.g. for Intel Fortran this is
/assume:byterecl (Windows) or -assume byterecl (Linux/UNIX).
The modules must be compiled first.
Several subroutines use these modules. These subroutines need the compiled versions of the modules before they can be compiled.
You can find here below the complete list of modules in the proper order.
mpif90 <list of modules> ocp*.f swan*.f Swan*.f90 -o swan.exe
The SWAN team 2024-09-09