Tutorial SWASH
Tutorial SWASH
SWASH (an acronym of Simulating WAves till SHore) is a non-hydrostatic wave-flow model and is
intended to be used for predicting transformation of dispersive surface waves from offshore to the
beach for studying the surf zone and swash zone dynamics, wave propagation and agitation in ports
and harbours, rapidly varied shallow water flows typically found in coastal flooding resulting from e.g.
dike breaks, tsunamis and flood waves, density driven flows in coastal waters, and large-scale ocean
circulation, tides and storm surges.
SWASH is an open-source model and can be freely downloaded from http://swash.sf.net. No need to
download and install it for this tutorial, as the executable is already provided with this tutorial.
The basic philosophy of the SWASH code is to provide an efficient and robust model that allows a wide
range of time and space scales of surface waves and shallow water flows in complex environments to
be applied. The governing equations are the nonlinear shallow water equations including non-
hydrostatic pressure.
SWASH may either be run in depth-averaged mode or multi-layered mode in which the computational
domain is divided into a fixed number of vertical terrain-following layers. SWASH improves its
frequency dispersion by increasing this number of layers.
This tutorial serves as a first introduction to SWASH. You will get acquainted with the model, how to
run it, and what choices you need to make.
Exercise
We will start with a simple introduction, in order to learn how to set up a relatively simple model.
SWASH is one single computer program. The user should provide SWASH with a number of input
files with the following information:
• a file containing the instructions of the user to SWASH (the command file),
• file(s) containing grid, bottom, vegetation (if relevant)
The command files are to be recognized by the extension .sws. For this exercise, a not-complete
command file is available. The question marks need to be replaced by proper values later. Have a
look at this file carefully before starting the exercise.
During the simulation, SWASH always creates a print file. The name of this file is identical to the
name of the command file with the extension .sws replaced with .prt. The print file contains an echo
of the command file and possibly warning and/or error messages. These messages are usually self-
explanatory. Always check the print file after the simulation!
In this exercise, we are interesting in the waves as they propagate towards the beach. Waves are
generated at the wavemaker (to the left), and will propagate over the variable bathymetry towards
the beach on the right, where they will break and dissipate most of their energy (see Figure 1). At
the wavemaker, we will generate a realistic wave field with a significant wave height of 1 m and a
peak period of 10 s.
Figure 1, bathymetry of the test case.
Model set-up
First, we need to define a computational grid. Moreover, we may also need to specify input grids for
the bathymetry. A typical grid with its dimensions (location, size, resolution and orientation) is
depicted in the Figure 2 below. The origin of the grid and the direction of the positive x-axis of this
grid can be chosen arbitrarily by the user. The size of the domain in x- and y-direction is indicated by
xlenc and ylenc, respectively. The number of grid cells in x-direction equals mxc and so this number
is one less than the number of grid points in the same direction. The same holds for y-direction.
In this exercise, we assume a one-dimensional (1D) domain along x-direction. Therefore, we set
ylenc = 0 and consequently, myc = 0. The input file that we will be looking at is Boers1C_2V.sws.
Figure 2. Coordinates of the origin xpc and ypc, the orientation alpc and the grid points numbering of the computational
grid.
1. Computational grid
a. What is the length of the computational domain in x-direction and y-direction?
b. What is a typical wave length of the waves?
Use the following formula for the wave length 𝐿 as a rough guess:
𝐿 = 𝑇√𝑔ℎ,
where 𝑇 is the wave period, 𝑔 ≈ 10m/s2, and ℎ is the water depth (take the water
depth at the wavemaker).
c. Based on accuracy reasons, how many horizontal grid points do you think we need
to resolve the waves? For the simulation, specify the number of grid points mxc to
discretise the grid in the input file (replace ??? by your value)
hint 1: we want to use 100 points per wave length
hint 2: the grid resolution Δ𝑥 = 𝑥𝑙𝑒𝑛𝑐/𝑚𝑥𝑐.
d. How many vertical layers are we using?
e. After answering the above questions, have a read in the SWASH manual p91-95.
2. Bottom grid
a. What is the length of the bottom grid
3. Boundary condition
a. Verify the boundary condition used to generate waves, are the wave height and
peak period correct? (refer to p40-47 of the user manual)
4. What is the time step of the simulation, and how long does the simulation take?
hint: the format of the time is [hr min sec. msec] (known as ISO notation)
Now that everything is specified in the input file. Run the simulation by double clicking on
RunSWASH.bat.
Make sure that the simulation is running and finishes. If errors occur, the simulation will crash and
warnings or errors are printed in the .prt file.
Model results
If the simulation has finished properly, let’s have a look at the results! First, we will look at a movie
of the results. For this we can use the matlab script called SWASH_Movie.m. Run the script, and if
everything worked out you should see a nice animation of the waves.
Now that is nice, but to gain more insight in the wave dynamics we often want to plot what we call
bulk wave parameters like the wave height. Although movies of the waves are very informative, such
bulk wave parameters give more insight in the wave dynamics. To have a look at how the wave
height and setup varies in the domain, run SWASH_ResultsBulk.m.
1. What is the wave height at the boundary, and how does this compare to the target wave
height which we specified in the file?
2. Where do the waves roughly start to break?
3. What happens to the mean water level, also known as setup?
Influence vegetation
Now let’s have a look at how vegetation might influence the results. Similar as before, adapt
Boers1C_2V-veg.sws with the missing variables.
1. Have a look at the input file, what extra commands are present and what do they do (refer
to the SWASH user manual for this, p29-32 and p55)
2. Run the simulation, and compare the results. How does the vegetation affect the results?