Skip to content

Introduction to SWAN Model

What is SWAN?

SWAN is a third-generation wave model for obtaining realistic estimates of wave parameters in coastal areas, lakes and estuaries from given wind, bottom and current conditions. However, SWAN can be used on any scale relevant for wind-generated surface gravity waves. The model is based on the wave action balance equation with sources and sinks.

Frequency/Period of Wave and its Energy Distribution
Figure 1. Frequency and period of wave energy in the Munk (1950) model. SWAN simulates wind-generated waves which have 1-30 s of period (Holthuijsen, 2007).

Basic Theory

Governing Equation

The SWAN model solves the spectral action density balance equation which in Cartesian coordinates can be written as:

Governing Equation
Figure 2. Governing Equation of SWAN in Cartesian coordinates.

N represents the action density spectrum, which is a function of geographic coordinates (x,y), time (t), frequency (σ), and direction (θ).

The left-hand side of the equation describes the local rate (t) of change of action density and its propagation in geographic (in x and y axis), direction (θ) and frequency (σ). The right-hand side represents the source and sink terms that account for various physical processes affecting wave growth and dissipation, such as wind input, whitecapping, bottom friction, depth-induced breaking, and nonlinear wave-wave interactions. SWAN wave model based on implicit numerical schemes to solve the action balance equation, which are always stable and allow for larger time steps compared to explicit schemes. But, users can not choose an arbitrarily large time step, because accuracy may be compromised. In order to maintain accuracy, users need to know the characteristics of the phenomena to be simulated and select an appropriate time step accordingly.

Based on SWAN User Manual (Version 41.45, 2023), the recommended settings are as follows:

  1. Direction resolution for wind sea (Δθ) : 15°-10°
  2. Direction resolution for wind sea (Δθ) : 5°-2°
  3. Frequency range (Δf/f) : 0.04 < f < 1
  4. Spatial resolution (Δx, Δy) : 10 m - 1000 m
  5. Time step (Δt) : 10 minutes, if larger time step is chosen, action density limiter becomes probably a part of the physics.

Discretization

Input Data

  1. Wind fields. This data should cover the entire model domain, or bigger, and be provided at regular intervals to capture temporal variations. Data provided in u and v component (zonal and meridional).

  2. Bathymetry. Information about the bathymetry (sea floor topography) of the area being modeled. This data should cover the entire model domain, or bigger.

  3. Boundary conditions data. This data is optional, but highly recommended to reduce potential error near the boundary. Data provided along the open boundaries of the model domain. The data can be in the form of wave spectra at the open boundaries of the model domain, or wave parameters such as significant wave height (Hs), peak period (Tp), mean wave direction (Dm) and directional spread (Dspr).

  4. Initial conditions data. This data is optional, but highly recommended to reduce the spin-up time of the model. Data provided at the start of the simulation period. Alternatively, users can run a spin-up simulation to generate initial conditions, which usually takes a week or two, prior the desired simulation period.

  5. Current data. This data is optional, but can improve the accuracy of the simulation, especially in areas with strong currents. Data provided as u and v components (zonal and meridional) covering the entire model domain, or bigger.

Typically, users only need wind fields and bathymetry data as mandatory inputs to run the SWAN model. However, including boundary conditions, initial conditions, and current data can enhance the accuracy of the simulation results.

For further reading regarding this matter, please refer to the SWAN User Manual and Waves in Oceanic and Coastal Waters by Holthuijsen (2007), especially in Chapter 9.

Supporting Tools

For pre-processing and post-processing SWAN model data, several supporting tools can be utilized to facilitate these tasks:

  1. Python or Matlab : This tool will be useful for data preparation (wind fields, boundary conditions, initial conditions, current data) and visualization of SWAN output data.

  2. Grid Generator : Tools like SMS (Surface Water Modeling System) can be used to create unstructured triangular grids for SWAN simulations. Other grid generators include Oceanmesh-2D (Matlab-based), Triangle, etc could be used. As long as the generator's output is compatible with SWAN format (fort.14).

Installation Mode

SWAN can be installed on various modes, including:

  1. Serial mode : Suitable for small-scale simulations or testing purposes. In this mode, SWAN runs on a single processor core. This mode usually the default for Windows platform.

  2. Parallel mode : Recommended for large-scale simulations or when high-resolution output is required. In this mode, SWAN can utilize multiple processor cores to speed up the computation. Parallel mode can be implemented using OpenMP (for shared memory systems) or MPI (for distributed memory systems).

A little bit explanation regarding OpenMP and MPI:

  1. OpenMP (Open Multi-Processing) is an API designed for shared-memory systems, allowing multiple threads to access a single pool of RAM simultaneously. It uses "directives" added to code (like C++ or Fortran) to easily distribute tasks across the different cores of a single CPU or computer. In the case of SWAN, OpenMP enables parallel processing by using multiple threads/cores within the same nodes/computers/machines.

  2. MPI (Message Passing Interface) is a standardized library for distributed-memory systems, where multiple independent computers (nodes) communicate over a network. Since these computers don't share RAM, MPI works by explicitly "sending" and "receiving" messages to synchronize data across the entire cluster. In the case of SWAN, MPI enables parallel processing by using multiple nodes within the same cluster.

OpenMP_MPI
Figure 3. Mixed Parallel Programming using MPI and OpenMP. (Figure by MIT OpenCourseWare.).