next up previous
Next: Installation of MPICH2 on Up: Manual installation Previous: Modifications in the source

Compiling and linking SWASH source code

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 SWASH. The source code cannot be compiled with a Fortran 77 compiler. If you intended to use MPI for parallel runs, you may use the command mpif90 instead of the original compiler command.

The SWASH 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 SWASH 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, SWASH will not run correctly.

Furthermore, SWASH can generate binary MATLAB files on request, which are unformatted. Some compilers, e.g. Intel Fortran version 11.x, 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 for Windows this is /assume:byterecl and for Linux this is -assume byterecl.

The modules must be compiled first. Several subroutines use the modules. These subroutines need the compiled versions of the modules before they can be compiled. Linking should be done without any options nor using shared libraries (e.g. math or NAG). It is recommended to rename the executable to swash.exe after linking.

Referring to the previous example, compilation and linking may be done as follows:

mpif90 SwashModule?.f90 m_parall.f ocpmod.f SwashFlowdata.f90
       SwashSolvedata.f90 SwanGriddata.f90 SwanGridobjects.f90
       SwanCompdata.f90 ocp*.f swanser.f Swash*.f90 Swan*.f90
       -o swash.exe

next up previous
Next: Installation of MPICH2 on Up: Manual installation Previous: Modifications in the source
The SWASH team 2017-04-06