Shyfem Finite Element Model For Coastal Seas User Manual
Shyfem Finite Element Model For Coastal Seas User Manual
User Manual
Version 6.1.74
May 5, 2014
Contents
Disclaimer iii
1 Overview 1
1.1 What is it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Installing SHYFEM 2
2.1 Downloading and unpacking . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Needed software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.5 Compatibility problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4 Running SHYFEM 15
4.1 How to run: the Parameter Input File (STR) . . . . . . . . . . . . . . . . . 15
4.1.1 The General Structure of the Parameter Input File . . . . . . . . . . 15
4.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2.1 Minimal simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.2 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3 Advanced usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.1 Variable time step . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.2 3D computations . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3.3 Baroclinic terms . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.3.4 Turbulence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
i
B File formats 29
B.1 GRD file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
C Parameter list 31
C.1 Parameter list for the SHYFEM model . . . . . . . . . . . . . . . . . . . . 31
C.1.1 Section $title . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
C.1.2 Section $para . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
C.1.3 Section $name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
C.1.4 Section $bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
C.1.5 Section $wind . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
C.1.6 Section $extra . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
C.1.7 Section $flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
C.2 Parameter list for the post processing routines . . . . . . . . . . . . . . . . 43
C.2.1 Section $title . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
C.2.2 Section $para . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
C.2.3 Section $color . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
C.2.4 Section $arrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
C.2.5 Section $legend . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
C.2.6 Section $legvar . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
C.2.7 Section $name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Bibliography 50
ii
Disclaimer
Georg Umgiesser
Oceanography, ISMAR-CNR
Arsenale Tesa 104, Castello 2737/F
30122 Venezia
Italy
Tel. : ++39-041-2407943
Fax : ++39-041-2407940
E-Mail : [email protected]
iii
Chapter 1
Overview
1.1 What is it
The finite element program SHYFEM is a program package that can be used to resolve the hy-
drodynamic equations in lagoons, coastal seas, estuaries and lakes. The program uses finite
elements for the resolution of the hydrodynamic equations. These finite elements, together
with an effective semi-implicit time resolution algorithm, makes this program especially
suitable for application to a complicated geometry and bathymetry.
This version of the program SHYFEM resolves the depth integrated shallow water equations.
It is therefore recommended for the application of very shallow basins or well mixed estu-
aries. Storm surge phenomena can be investigated also. This two-dimensional version of
the program is not suited for the application to baroclinic driven flows or large scale flows
where the the Coriolis acceleration is important.
Finite elements are superior to finite differences when dealing with complex bathymetric
situations and geometries. Finite differences are limited to a regular outlay of their grids.
This will be a problem if only parts of a basin need high resolution. The finite element
method has an advantage in this case allowing more flexibility with its subdivision of the
system in triangles varying in form and size.
This model is especially adapted to run in very shallow basins. It is possible to simulate
shallow water flats, i.e., tidal marshes that in a tidal cycle may be covered with water during
high tide and then fall dry during ebb tide. This phenomenon is handled by the model in a
mass conserving way.
Finite element methods have been introduced into hydrodynamics since 1973 and have
been extensively applied to shallow water equations by numerous authors [3, 9, 5, 4, 6].
The model presented here [10, 11] uses the mathematical formulation of the semi-implicit
algorithm that decouples the solution of the water levels and velocity components from
each other leading to smaller systems to solve. Models of this type have been presented
from 1971 on by many authors [7, 2, 1].
1
Chapter 2
Installing SHYFEM
cd /home/model
tar -xzvf shyfem-6 1 74.tar.gz
At this point a new folder named /home/model/shyfem-6 1 74 has been created. This
directory is the root of the SHYFEM model. All other commands given in this chapter
assume that you are in this directory. Therefore, before reading on, please move into this
directory:
cd /home/model/shyfem-6 1 74
2
Please note that you might already have everything available in your Linux distribution,
with the exception maybe of the Fortran compiler.
To find out what software is installed on your computer and what you still have to install
you can run the following command:
make check_software
If you get something like bash: make: command not found, then you do not have make
installed. Please first install the make command and then run the command again.
The output of the command will show you what software you will still have to install. The
software is divided into different sections. The first section is needed software, which you
will not be able to do without. The next section is recommended software, which you really
should install, but for compilation and running you will not necessarily need it. The last
section is software which is optional, but which makes life easier.
You can always run make check_software again to check if the software had been suc-
cessfully installed. When you are satisfied with the output you can go to the next section.
Please note that you have to carry out the steps in this section only the first time you install
the model. If you install a new version of SHYFEM software you can skip these steps.
2.3 Installation
Before compiling it is advisable to install some files for a simpler usage of the model. As
long as you only want to tun a simulation, this step is not strictly necessary. But if you
will run some scripts of the distribution, these scripts will not work properly if you do not
install the model.
In order to install the model, you should run
make install
• It hardcodes the installation directory in all scripts of the model so only programs of
the installed version will be executed.
• It inserts a symbolic link syhfem from the home directory to the root of the SHYFEM
installation.
• It inserts a small snippet of code into the initialization files .bashrc .bash profile
.profile that are in your home directory. This will adjust your path to point to the
SHYFEM directory and gives you access to some administrative commands.
After this command you will find the original files that have been changed in your home
directory saved with a trailing number (e.g., .profile.35624 or similar). If you encounter
problems, just substitute back these files.
In order that your new settings will take effect you will have to log out and log in again. Al-
ternatively, you will have to execute one of the files .bashrc .bash profile .profile
that have actually changed. If .bashrc has been changed, then run . ˜/.bashrc.
If you do not want to run the installation routine, you should at least manually insert a
symbolic link to the root of the SHYFEM model. Otherwise some of the commands and
shell scripts will not work properly. This can be done with the command
cd
ln -s /home/model/shyfem-6 1 74 shyfem
3
from your home directory. If there is already such a link existing you will first have to
delete it (rm shyfem).
You should also think about the possibility to add the fembin path to your default paths to
have the main utility commands always available. To do this open your .bashrc file in the
home directory and add the following lines at the end of the file:
SHYFEMDIR=$HOME/fem
PATH=$PATH:$SHYFEMDIR/fembin
export SHYFEMDIR PATH
However, the same effect can be achieved more easily by using the abovementioned com-
mand make install.
If you ever want to uninstall the model, you can do it with the command make uninstall.
This will delete the symbolic link, cancel the hard links in the model scripts and restore the
systemfiles .bashrc .bash profile .profile to their original content.
Please note that you will still have to delete manually the model directory. This can be
done with the command rm -rf /home/model/shyfem-6 1 74). In this way, however,
changes to the code you have made will be lost.
2.4 Compilation
In order to compile the model you will first have to adjust some settings in the Rules.make
file. Assuming that you are already in the SHYFEM root directory (in our case it would
be /home/model/shyfem-6 1 74), open the file Rules.make with a text editor. In this file
the following options can be set:
• Parameters. In this section you have to set the maximum number of nodes (NKNDIM)
and elements (NELDIM) used by your grids. You might also have to set also the maxi-
mum number of elements attached to a node (NGRDIM) and the maximum bandwidth
(MBWDIM) of the z-level matrix. You can find these numbers when you create the
basin file with vpgrd. Finally you have to specify the maximum number of vertical
levels (NLVDIM). It is advisable to set this value close to the desired number of ver-
tical levels, since it affects the model speed performance. So, if you want to run the
model in 2D mode, please set NLVDIM to 1. For all other possible parameter settings
please have a look at param.h. However, you should never directly change this file.
Always make changes to the parameters in the Rules.make file.
• Compiler. Set the compiler you want to use. Please see also the section on needed
software and the one on compatibility problems to learn more about this choice.
• Parallel compilation. Some parts of the code are parallelized with OpenMP
statements. Here you can set if you want to use it or not. All supported compilers
(except g77) accept OpenMP statements.
• Solver for matrix solution. There are three different solvers implemented.
The GAUSS solver is the most robust and best tested solver, but it is quite slow. The
PARDISO solver needs an external library available at the Intel web-site2 , that can be
freely downloaded for non-commercial use. The Pardiso solver is parallelized, but
it seems to be a little slower than the SPARSKIT solver. The SPARSKIT solver is the
recommended solver, since it seems to be the fastest one. However, if you are ever
in doubt about your results you might want to revert back to the GAUSS solver and
check the results.
2 http://software.intel.com/en-us/articles/code-downloads/
4
• NetCDF library. If you want output files in NetCDF format you need the NetCDF
library.
• GOTM library. The GOTM turbulence model is already included in the code. How-
ever, a newer and better tested version is available as an external module. In order to
use it please set this variable to true. This is the recommended choice. You will need
a Fortran 90 compiler to enable this choice.
• Ecological module. This option allows for the inclusion of an ecological mod-
ule into the code. Choices are between EUTRO, ERSEM and AQUABC. Please refer to
information given somewhere else on how to run these programs.
• Compiler options. Here several sections are present, one for each supported com-
piler. Normally it should not be necessary to change anything beyond this point.
Once you have set all these options you can start compilation with
make clean
make fem
This should compile everything. In case of a compilation error you will find some messages
during compilation and also at the bottom of the output, where a check is run to see, if the
main routines have been compiled.
Please remember that you will always have to run the commands above when you change
settings in the Rules.make file. If you only change something in the code, or if you only
change dimension parameters, it might be enough to run only make fem, which only com-
piles the necessary files. However, if you are in doubt, it is always a good idea to run
make clean or make cleanall before compiling, in order to start from a clean state.
• g77 This the old GNU compiler. It is Fortran 77 only. It is also a little outdated and
is not supported anymore by the major distributions. If you do not need software that
relies on Fortran 90 it is still possible to use it. However, GOTM and some ecological
modules are relying on Fortran 90 and cannot be used with the g77 compiler.
• gfortran This is the actual GNU compiler. It also supports Fortran 90. This is the
compiler that you will find in recent distributions.
• ifort This is the INTEL compiler. You will have to download and install it on your
own. It is very efficient and normally faster than the GNU compiler.
• pgf90 This is the Portland group compiler. It is a commercial compiler. It creates
very efficient code.
Whatever compiler you choose to use, you have to set your choice in the Rules.make
file. Even if not desirable, different compilers can give you slightly different results in the
computations. This is due to the different optimizations enabled and maybe a different
treatment of accuracy and round off. Other compatibility issues are the following.
5
• With g77 and ifort it is possible to open the same file in read only mode more
than once. This is useful, e.g., if you have two open boundaries, but you want to
prescribe the same value on these two boundaries. With gfortran or pgf90 you
cannot do this. A file, even in read only mode, can be opened only once. In the
above example you therefore have to copy the input file to a new name (duplicate it)
and then prescribe the two different files as boundary conditions.
• With gfortran it is very difficult to decide if a file is formatted or unformatted.
Some modules allow the use of either formatted or unformatted input files, where
the check on the file type is made via software. In case of gfortran this may not
work reliably. The only solution to this problem is to specify the file type directly in
the code.
• Objects generated during compilation and libraries used in linking are normally not
compatible between compilers. What this means is that, when you switch compiler,
you will have to recompile everything with make cleanall; make fem. Otherwise
you will encounter errors during the linkage process.
• Unformatted files are normally not portable between different compilers. You nor-
mally cannot use a basin file created with programs compiled with one compiler
together with a program compiled with another compiler. The same is true for unfor-
matted data files (initial conditions, wind and meteo forcing, etc.).
If you have problems reading a basin file, try basinf. If this is not working chances
are high that you have the problem described above. In case of unformatted data files
the diagnosis is not so easy. In any case, you can solve the problem recompiling all
programs with the commands make cleantotal; make fem and then re-creating
all unformatted files with the newly compiled programs. In case of the basin file,
you will have to run the pre-processor on the grid again.
If you have obtained unformatted data files from others, then there is really no easy
solution to this problem. Exchanging unformatted files between different computers
and compilers is never a good idea.
• A similar problem exists if you switch files between different architectures (32 bit
and 64 bits), even if created with the same compiler. These files are normally not
portable.
• Nan values (Not a Number) are treated differently between different compilers. Nan
values are created if a not well defined operation is executed (divide by 0 or square
root of a negative number). All compilers above (except pgf90) treat Nans to be not
comparable to any number. This means that a logical expression a.eq.a is always
false if a is a Nan. However the pgf90 compiler treats Nans to be comparable to
any other number. So, an expression like a.ne.a will evaluate to true. SHYFEM
includes code to handle these problems gracefully, but incompatibilities might still
show up.
• In parallel execution you might get a segmentation fault during execution. This
is normally due to limited stack size. You can change the behavior by increasing
the stack size (ulimit -s unlimited) on the console before running the program.
Compilers may behave differently. Please see also the section on parallel execution
in the file Rules.make.
2.6 Summary
In summary, the following steps have to be carried out before you will be able to run the
model:
6
• Get the distribution and unpack it in a place of your choice.
• Move to the root of the distribution (e.g., cd /home/model/shyfem-6 1 74).
• Check if all software is available (make check_software). This step has to be done
only the first time you install SHYFEM on a computer.
• Install the model (make install). This has to be done every time you get and install
a new version of the model.
• Adjust options in Rules.make. This has to be done every time you change options
(compiler, parallel execution, etc.). After this you have to run also make cleanall.
• Adjust dimension parameters in Rules.make. This has to be done the first time and
every time you change application (basin, etc.) to adapt the dimensions to the new
problem. You might also run make cleanall after this step, but it is not required.
• Compile the programs with make fem and have a look at the error messages.
Finally, if you have installed the model with make install, the following utility com-
mands are available
7
Chapter 3
3.1 Overview
Before you can start using the model you have to create a numerical grid. Ths step is more
difficult for models that work on unstructured grids (like finite element models) than for
finite difference models, where often it is enough to have a regular gridded bathymetry to
start running simulations.
This chapter describes the steps that you have to take in order to be able to create a numer-
ical grid for SHYFEM. If you are in the happy position to already have a numerical finite
element grid, then you can jump ahead to the section on how to transform to/from other
grid formats. You might still have to interpolate a bathymetry onto the numerical grid, so
you will have to refer to the section on interpolating bathymetry. In any case, at the end
you will have to create a (unformatted) basin file, so that SHYFEM is able to read in the
information.
The steps that have to be carried out to create a numerical grid are
7. create the basin file (the finite element version of the grid file)
As mentioned above, some of the steps can be skipped if you already have a finite element
grid. If you already have a grid with bathymetry information you can jump to point 7.
However, you will have to convert your grid into the GRD format used by SHYFEM. The
GRD format is documented in the appendix. For some of the most common unstructured
grid formats routines are available to convert between these formats and the GRD format. In
any case, the GRD format is quite easy to parse and write, so you might be able to write a
transformation routine yourself.
In the following a description is given what you have to do if you start from scratch. Please
refer to the section on other programs to create a grid for conversion routines.
8
3.2 Converting to GRD format
Data files with boundary line and bathymetry should be given. These files have to be
transformed into GRD files, that can be read and manipolated with the programs mesh and
grid. Examples of how to do so can be found in coast.pl and ldb.pl for the coastline and
bathy.pl for the bathymetry points.
Please note that the coordinates for the GRD files should be always in meters. Therefore,
if you have your coordinates in other units, you have to adjust the conversion routines in
order to create the new coordinates in meters.
Please note that UTM coordinates are in meters, so UTM coordinates are fine. However,
since UTM coordinates are normally huge numbers, there might be an accuracy problem
when you try to create the grid. If this happens, you should first shift your UTM coordinates
so that the origin of your new coordinate system coincides with the central point of your
grid. This translation can be done using the program grd_transl.pl.
Other transformation routines are:
• dxf2grd.pl Transforms a grid from DXF (Autocad) to GRD format. This is still ex-
perimental.
• kml2grd.pl Transforms a grid from the Google Earth format KML to GRD format.
• xyz2grd.pl Transforms a simple list of nodes to GRD format. Every line contains 3
values (x, y, z) or two values (x, y), when the information on depth is missing.
Please note that for SHYFEM depth values have to be positive. If your files have depth
values as negative numbers, you will have to invert them. You can use the command
9
Here sigma specifies the langth scall for the smoothing operator and reduct is the length
scale below which points may be deleted. Both values have to be given in the same units of
the coordinates of the file coast.grd, so normally meters. The smoothed file can be found
in smooth.grd and the subsequently reduced file in reduct.grd.
If there are some points in the boundary line that should not be smoothed they can be given
a depth value of -1. This is a flag that indicates that the position of these points will not be
touched.
Where a background grid exists the model uses the depth values at the
element vertices (nodes) to compute a new value for this resolution.
The depth value acts like a factor that multiplies the constant
overall resolution to obtain a local resolution. So, for example,
constructing a background grid and setting all depth values to 1
would not change the resolution at all from a situation without
background grid. A factor higher than 1 increases the resolution
and one smaller than 1 decreses it. Therefore, in areas where
resolution should be higher than average you can set it to
2 or higher, and in other areas, where you want lower resolution,
you can set it to 0.5 or lower. All nodes of the background grid
need to have a depth (resolution) value. Inside each background
element the resolution is interpolated between the three nodes
(vertices).
10
Please extract the background grid from the grid file you just
have constructed by running exgrd: "exgrd -LS coast-new.grd".
The file "new.grd" contains only the background grid. Rename it to
something more useful (mv new.grd bck1.grd). You are then
ready to start the meshing algorithm.
The meshing algorithm is called mesh. Please see "mesh -h" for
help of the command line options. The most important are:
Please note that you can specify more than one file for the coast line,
so you could keep the domain line and the island lines in seperate files.
You can also have different background grid for different areas in
different files. So a call like this is also possible:
"mesh -I2000 -g99 coast island1 island2 bck1 bck2 bck3".
After the creation of the mesh, the grid is still not good enough
for usage in a finite element model. This is due to the fact that
the grid is too irregular. Therefore a program has to be applied
that regularizes the grid.
The program is called regularize. It must be given the input grid file
11
(irregular) and creates a new one with much more regular characteristics.
The program has to be called as:
"regularize mesh1.grd mesh2.grd".
In this case the new regular grid is in mesh2.grd.
Interpolate bathymetry
======================
where bathy.grd is the grd file with the bathymetry values and
mesh2 is the basin for which to interpolate the bathymetry.
Different types of interpolation can be used. Please run
"basbathy -h" for more options.
vpgrd mesh3
12
follow the online instructions.
The routine vp reads a file of type GRD. This type of file can be generated and manipulated
by the program grid which is not described here. In short, the file GRD consists of nodes
and elements that describe the geometrical layout of the basin. Moreover, the elements
have a type and a depth.
The depth is needed by the main program hp to run the model. The type of the element is
used by hp to determine the friction parameter on the bottom, since this parameter may be
assigned differently, depending on the various situations of the bottom roughness.
This file GRD is read by vp and transformed into an unformatted file BAS. It is this file that
is then read by the main routine hp. Therefore, if the name of the basin is lagoon, then the
file GRD is called lagoon.grd and the output of the pre-processing routine vp is called
lagoon.bas.
The program vp normally uses the depths assigned to the elements in the file GRD to
determine the depth of the finite elements to use in the program hp. In the case that these
depth values are not complete, and that all nodes have depths assigned in the GRD file, the
nodal values of the depths are used and interpolated onto the elements. However, if also
these nodal depth values are incomplete or are missing altogether, the program terminates
with an error.
13
perform the bandwidth optimization at all (GRD file has already optimized node number-
ing), perform it automatically or perform it manually. It is suggested to always perform
automatic optimization of the bandwidth. This choice will lead to a nearly optimum num-
bering of the nodes and will be by all means good results.
If, however, you decide to do a manual optimization, please follow the online instructions
in the program.
14
Chapter 4
Running SHYFEM
In the following an overview is given on running the model SHYFEM. The model needs a
parameter input file that is read on standard input. Moreover, it needs some external files
that are specified in this parameter input file. The model produces several external files
with the results of the simulation. Again, the name of this files can be influenced by the
parameter input file
15
$title
benchmark test for test lagoon
bench
venlag
$end
$para
itanf = 0 itend = 86400 idt = 300
ireib = 5 czdef = 2.5E-3
dragco = 2.5E-3
$end
$bound1
kbound = 73 74 76
boundn = ’levels1.dat’
$end
$bound2
kbound = 150 157 97 101
boundn = ’levels1.dat’
$end
$name
wind=’win18sep.win’
$end
sequence in which the sections appear is of no importance. However, the first section must
always be section \$title, the section that determines the name of simulation and the
basin file to use and gives a one line description of the simulation.
Lines outside of the sections are ignored. This gives the possibility to comment the param-
eter input file.
Figure 4.1 shows an example of a typical input parameter file and the use of the sections
and definition of parameters.
16
$title
benchmark test for test lagoon
bench
venlag
$end
$para
itanf = 0 itend = 86400 idt = 300
$end
numerical grid, which must be prepared beforehand and then must be compiled in a form
that the model can use. How this is been done has already been described in the chapter
dealing with preprocessing.
The second thing that is needed is a description of the simulation and the forcings that have
to be applied. This is done through a parameter input file. Here we call it STR file, because
historically these files always ended with an extension of .str. However, any extension
can be used.
1. A description of the run. This can be any text that fits on one line.
2. The name of the simulation. This name is used for all files that the simulation
produces. These files differ from each other only by their extension.
3. The name of the basin. This is the basin file without the extension .bas.
• A section $para that contains all necessary parameters for the simulation to be run.
The only compulsory parameters are the ones that specify the start of the simulation
itanf, its end itend and its time step idt.
In order to be more helpful, some more information must be added to the STR file. As an
example let’s have a look on 4.1. Here we have added two parameters that deal with the
type of friction to be used. ireib specifies the bottom friction formulation, here through
a simple quadratic bulk formula. (For the exact meaning of the parameters, please refer to
the appendix where all parameters are listed.) The parameter czdef specifies the value to
use for the bottom drag coefficient.
17
$bound1, $bound2 etc. Inside every section you can then specify the various parameters
that characterize your boundary.
Basically there two types of open boundary conditions. Either the water level or the dis-
charges (fluxes) can be specified. The parameter that decides the type of boundary is ibtyp.
A value of one indicates water levels, instead a value of 2 or 3 indicates fluxes. If you
specify discharges entering at the border of the domain, ibtyp = 2 should be specified.
Otherwise, if there are internal sources in the basin then ibtyp = 3 must be used. If you do
not define this parameter, a value of 1 will be used and water levels will be specified.
The only compulsary parameter in this section is the list of boundary nodes. You do this
with the parameter kbound. In the case of ibtype 1 or 2 at least two nodes must be
specified, in order to give an extension of the boundary. The numeration of the boundary
nodes must be consecutive and with the basin on its left side when going along the boundary
nodes. In the case of ibtyp = 3 even a single point can be given.
The boundary values you want to give are normally specified through a a file with a time
series. You give the name of the file that contains the time series with the parameter boundn.
An example with two boundaries can again be found in Fig. 4.1. Here water levels are
prescribed and the values for the water levels are read from a file levels1.dat.
If the values on the boundary you want to impose can be described through a simple sinus
function, you can also give the bounadry values specifying the parameters for the sinus
function. An example of a water level boundary with a tide of ±70cm and a period of 12
hours (semi-diurnal) is given in Fig. 4.3. Note thet zref gives the average water level of
the boundary. If you specify ampli=0 you get a constant boundary value of zref.
$bound1
ibtyp = 1 kbound = 23 25 28
ampli = 0.70 period = 43200 phase = 10800 zref = 0.
$end
Figure 4.3: Example of a boundary with regular sinusoidal water levels. The pahse of
10800 (3 hours) makes sure that the simulation starts at slack tide when the basin is com-
pletely full.
18
To keep the Courant Number under the limit it is necessary to adapt the time step at every
computation. The variable timestep is computed introducing in the STR file in the $para
section the parameters itsplt, coumax and idtsyn.
coumax gives the limit of the Courant number. This is normally 1, but since no exact stabil-
ity limit can be derived for the non-linear advective terms, another value can be specified.
If instabilities arise, a slightly lower value than 1 (0.9) can be tried.
itsplt decides about the time step splitting. If this value is 0, the time step will be kept
constant at its initial value. A value of 1 devides the initial time step into (possibly) equal
parts, but makes sure that at the end of the micro time steps one complete macro time step
has been executed. The last mode itsplt = 2 does not care about the macro time step,
but always uses the biggest time step possible. In this case it is not assured that after some
micro time steps a macro time step will be recovered. Please note that the initial macro
time step idt will never be exceeded.
Finally, the parameter idtsyn is only used in case of itsplt = 2. This parameter makes
sure that after a time of idtsyn the time step will be syncronized to this time. Therefore,
setting idtsyn = 3600 means that there will be a time stamp every hour, even if the model
has to take one very small time step in order to reach that time.
An example of how to set the variable time stepping scheme is shown in Fig. 4.4. Here
the Courant number is lowered to 0.9 and the variable time step is syncronized every 3600
seconds (1 hour).
$para
coumax = 0.9 itsplt = 2 idtsyn = 3600
$end
Figure 4.4: Example of variable time step settings. The time step is syncronized at every
hour, and the Courant number is lowered to 0.9.
4.3.2 3D computations
The basic way to run the model is in 2D, computing for each element of the grid one value
for the whole water column. All the variables are computed in the center of the layer,
halfway down the total depth. Deeper basins or highly variable bathymetry can require
for the correct reproduction of the velocities, temperature and salinity the need for 3D
computation.
The 3D computation is performed on the basis of z layers. In this representation each layer
horizontally has constant depth over the whole basin, but vertically the layer thickness
may vary between different layers. However, the first layer (surface layer) is of varying
thickness because of the water level variation, and the last layer of an element might be
only partially present due to the bathymetry.
Layers are counted from the the surface layer (layer 1) down to the maximum layer, de-
pending again on the local depth. Therefore, elements (and nodes) normally have a different
total number of layers from one to each other. This is opposed to sigma layers where the
number of total layers is constant all over the basin, but the thickness of each layer varies
between different elements.
In order to use layers for 3D computations a new section $layers has to be introduced
into the STR file, where the sequence of depth values of the bottom of the layers has to
be declared. Please, make sure that in the file Rules.make, the number of allowed levels
nlvdim is greater or equal than the ones actually used in the STR file. Layer depths must be
declared in increasing order. An example of a $layer section is given in figure 4.5. Please
note that the maximum depth of the basin in the example must not exceed 20 m.
A specific treatment for the bottom layer has to be carried out. In fact, if the model runs on
basins with variable bathymetry, for each element there will be a different total number of
19
$layers
2 4 6 8 10 13 16 20
$end
Figure 4.5: Example of section $layers. The maximum depth of the basin is 20 meters.
The first 5 layers have constant thickness of 2 m, while the last three vary between 3 and 4
m.
layers. The bathymetric value normally does not coincide with one of the layer depths, and
therefore the last layer must be treated seperately.
To declare how to treat the last layer two parameters have to be inserted in the $para
section. The first is hlvmin, the minimum depth, expressed as a percentage with respect to
the full layer depth, ranging between 0 and 1, This is the fraction that the last layer must
have in order to be maintained as a seperate layer. The second parameter is ilytyp and
it defines the kind of adjustment done on the last layer. If it is set to 0 no adjustment is
done, if it is set to 1 the depth of the last layer is adjusted to the one declared in the STR
file (full layer change). If it is 2 the adjustment to the previous layer is done only if the
fraction of the last layer is smaller than hlvmin (change of depth). If it is 3 (default) the
bathymetric depth is kept and added to the last but one layer. Therefore with a value of 0 or
3 the total depth will never be changed, whereas with the other levels the total depth might
be adjusted.
As an example, take the layer definition of Fig. 4.5. Let hlvmin be set to 0.5, and let an
element have a depth of 6.5 m. The total number of layers is 4, where the first 3 have each a
thickness of 2 m and the last layer of this element (layer 4) is 0.5 m. However, the nominal
thickness of layer 4 is 2 m and therefore its relative thickness is 0.25 which is smaller than
hlvmin. With ilytyp=0 no adjustment will be done and the total number of layers in this
element will be 4 and the last layer will have a thickness of 0.5 m. With ilytyp=1 the
total number of layers will be changed to 3 (all of them with 2 m thickness) and the total
depth will be adjusted to 6 m. The same will happen with ilytyp=2, because the relative
thickness in layer 4 is smaller than hlvmin. Finally, with ilytyp=3 the total number of
layers will be changed to 3 but the remaining depth of 0.5 m will be added to layer 3 that
will become 2.5 m.
In the case the element has a depth of 7.5 m, the relative thickness is now 0.75 and greater
than hlvmin. In this case, with ilytyp=0, 2 and 3 no adjustment will be done and the total
number of layers in this element will be 4 and the last layer will have a thickness of 1.5
m. With ilytyp=1 the total number of layers will be kept as 4 but the total depth will be
adjusted to 8 m. This will make all layers equal to 2 m thickness.
The introduction of layers requires also to define the values of vertical eddy viscosity and
eddy diffusivity. In any case a value of these two parameters has to be set if the 3D run is
performed. This could be done by setting a constant value of the parameters vistur (ver-
tical viscosity) and diftur (vertical diffusivity). In this case possible values are between
1·10−2 and 1·10−5 , depending on the stability of the water column. Higher values (1·10−2 )
indicate higher stability and a stronger barotropic behavior.
The other possibility is to compute the vertical eddy coeficients through a turbulence clo-
sure scheme. This usage will be described in the scetion on turbulence.
20
Setting ibarcl to a value different from 0 will simulate the transport and diffusion of
temperature and salinity in the basin. A value of 1 will compute the full baroclinic pressure
terms. A value of 2 will do diagnostic simulations. This means that baroclinic pressure
terms are still included in the hydrodynamic equations, but temperature and salinity will not
be computed but will be read from a file. Finally for ibarcl=3 temperature and salinity will
be computed but no baroclinic pressure term will be used. In this case the hydrodynamic
equations and the equations for temperature and salinity are decoupled and there is no feed
back from the density field to the currents.
In any case, if temperature and salinity are computed, first they must be initialized either
with constant values or with variable 3D matrices. In the first case the reference values
have to be imposed in temref and salref. An example of this type of simulation is given
in Fig. 4.6.
If the temperature and salinity are given as 3D matrices files, they must be provided in
the $name section, giving the file names in tempin and saltin. In case of diagnostic
simulations the matrices of temperature and salinity have to be provided in the files named
tempd and saltd and data must be available for the whole period of simulation.
$para
ibarcl = 1 temref = 18. salref = 35.
$end
Figure 4.6: Example of baroclinic simulation. The initial values for temperature and salin-
ity are set to 18 C and 35.
4.3.4 Turbulence
In the Reynolds equations turbulent eddy diffusivities and viscosities are introduced into
the equations that must be parameterized and given some value. Moreover SHYFEM as-
sumes the hydrostatic approximation. Therefore, there is the need to parameterize the
non-hydrostatic effects. These are considered sub-scale processes which are mainly of
convective nature.
Vertical eddy viscosities and diffusivities have to be defined if there is the intent to model
the turbulence effects. These vertical eddy viscosities and diffusivities can be set to constant
values, defining vistur and diftur in the $para section. There is also the opportunity to
compute, at each timestep, variable values of them, using the turbulence closure module.
The parameter that has to be set in order too choose the turbulence scheme is iturb in the
$para section.. If iturb=0 the vertical eddy viscosity and eddy diffusivity are set constant
(default 0) and must be defined in vistur and diftur.
If iturb=1 the turbulence closure scheme applied is the k − ε model. If iturb=2 the
GOTM turbulence closure module is used. In this case the file gotmturb.nml must be
provided that sets all necessary parameters. This file must be declared in the section $name
for the item gotmpa.
A default gotmturb.nml file is provided and it allows the computation of the vertical eddy
viscosity and eddy diffusivity by means of the GOTM k − ε model. More information on
the GOTM turbulence closure module can be found in the GOTM Manual 1 .
If the turbulence module should be used, a value of iturb=2 is recommended. An example
of the settings for the turbulence closure scheme is given in Fig. 4.7.
1 http://www.gotm.net/index.php?go=documentation
21
$para
iturb = 2
$end
$name
gotmpa = ’gotmturb.nml’
$end
Figure 4.7: Example of turbulence settings. The GOTM module for the turbulence closure
is used. The parameters are contained in file gotmturb.nml.
22
Appendix A
∂U ∂ζ
+ gH + RU + X = 0 (A.1)
∂t ∂x
∂V ∂ζ
+ gH + RV +Y = 0 (A.2)
∂t ∂y
∂ζ ∂U ∂V
+ + =0 (A.3)
∂t ∂x ∂y
where ζ is the water level, u, v the velocities in x and y direction, U,V the vertical integrated
velocities (total or barotropic transports)
Z ζ Z ζ
U= u dz V= v dz
−h −h
g the gravitational acceleration, H = h + ζ the total water depth, h the undisturbed water
depth, t the time and R the friction coefficient. The terms X,Y contain all other terms that
may be added to the equations like the wind stress or the nonlinear terms and that need not
be treated implicitly in the time discretization. following treatment.
The friction coefficient has been expressed as
√
g u2 + v2
R= (A.4)
C2 H
with C the Chezy coefficient. The Chezy term is itself not retained constant but varies with
the water depth as
C = ks H 1/6 (A.5)
where ks is the Strickler coefficient.
In this version of the model the Coriolis term, the turbulent friction term and the nonlinear
advective terms have not been implemented.
At open boundaries the water levels are prescribed. At closed boundaries the normal ve-
locity component is set to zero whereas the tangential velocity is a free parameter. This
corresponds to a full slip condition.
23
A.2 The Model
The model uses the semi-implicit time discretization to accomplish the time integration.
In the space the finite element method has been used, not in its standard formulation, but
using staggered finite elements. In the following a description of the method is given.
where ∆x is the minimum distance between the nodes in an element. With the discretization
described below in most parts of the lagoon we have ∆x ≈ 500m and H ≈ 1m, so ∆t ≈ 200
sec. But the limitation of the time step is determined by the worst case. For example, for
∆x = 100 m and H = 40 m the time step criterion would be ∆t < 5 sec, a prohibitive small
value.
The equations (1)-(3) are discretized as follows
U n+1 −U n ∂(ζn+1 + ζn )
+ gH 12 + RU n+1 + X = 0 (A.7)
∆t ∂x
V n+1 −V n ∂(ζn+1 + ζn )
+ gH 12 + RV n+1 +Y = 0 (A.8)
∆t ∂y
With this time discretization the friction term has been formulated fully implicit, X,Y fully
explicit and all the other terms have been centered in time. The reason for the implicit
treatment of the friction term is to avoid a sign inversion in the term when the friction
parameter gets too high. An example of this behavior is given in Backhaus [1].
If the two momentum equations are solved for the unknowns U n+1 and V n+1 we have
n+1 + ζn )
n+1 1 n 1 ∂(ζ
U = U − ∆tgH 2 − ∆tX (A.9)
1 + ∆tR ∂x
n+1 + ζn )
n+1 1 n 1 ∂(ζ
V = V − ∆tgH 2 − ∆tY (A.10)
1 + ∆tR ∂y
If ζn+1 were known, the solution for U n+1 and V n+1 could directly be given. To find ζn+1
we insert (A.9) and (A.10) in (A.6). After some transformations (A.6) reads
n+1 2 g ∂ ∂ζn+1 ∂ ∂ζn+1
ζ − (∆t/2) (H ) + (H )
1 + ∆tR ∂x ∂x ∂y ∂y
24
g ∂ ∂ζn ∂ ∂ζn
= ζn + (∆t/2)2 (H ) + (H ) (A.11)
1 + ∆tR ∂x ∂x ∂y ∂y
n n
2 + ∆tR ∂U ∂V
− (∆t/2) +
1 + ∆tR ∂x ∂y
2
∆t ∂X ∂Y
+ +
2(1 + ∆tR) ∂x ∂y
The terms on the left hand side contain the unknown ζn+1 , the right hand contains only
known values of the old time level. If the spatial derivatives are now expressed by the finite
element method a linear system with the unknown ζn+1 is obtained and can be solved by
standard methods. Once the solution for ζn+1 is obtained it can be substituted into (A.9)
and (A.10) and these two equations can be solved explicitly. In this way all unknowns of
the new time step have been found.
Note that the variable H also contains the water level through H = h + ζ. In order to avoid
the equations to become nonlinear ζ is evaluated at the old time level so H = h + ζn and H
is a known quantity.
Formalism
Let u be an approximate solution of a linear differential equation L. We expand u with the
help of basis functions φm as
u = φm um m = 1, K (A.12)
where um is the coefficient of the function φm and K is the order of the approximation. In
case of linear finite elements it will just be the number of nodes of the grid used to discretize
the domain.
To find the values um we try to minimize the residual that arises when u is introduced into L
multiplying the equation L by some weighting functions Ψn and integrating over the whole
domain leading to
Z Z Z
ψn L(u) dΩ = ψn L(φm um ) dΩ = um ψn L(φm ) dΩ (A.13)
Ω Ω Ω
If the integral is identified with the elements of a matrix anm we can write (A.13) also as a
linear system
anm um = 0 n = 1, K m = 1, K (A.14)
Once the basis and weighting functions have been specified the system may be set up and
(A.14) may be solved for the unknowns um .
25
f f
a a
H L aa H L aa
AC HH L aa
C HH L aa
CA Hf L
C Hft L
f
C@
PP E QQ L f
PP C j
Q L
PCt PCf
tP QLt
Q
φi
PE @
i C E P@ Pf @
QL
C P Pf i
t
@
CE
J @ C
J @
f
CE
J S @ f C
J @
f t S f
t Jt
XX X
A XXCE
J A XXXC
A
A S S A
A S
A
A S S A
A S
A
XXXA n S XXXA
A
S
At
X St A
X S
ψn
26
algorithm, the one actually used in this paper, introducing constant form functions for the
velocities. He showed the excellent propagation and geostrophic adjustment properties of
this scheme.
27
The variables and unknowns may now be expanded with their basis functions and the com-
plete system may be set up.
28
Appendix B
File formats
=============================================================
legend :
=============================================================
comment:
0 [anything]
node:
1 n t x y [d]
element:
line:
=============================================================
comment :
29
lines may be split at any point, except befor optional argument
d must not be on seperate line
if line is split, the continuation line(s) must start with a blank
blank lines can be inserted as needed
if d is not specified -999. will be used (flag)
use t=0 if you do not know what to use
n must be unique for every item type
item numbers need not be consecutive
the sequence of items is not important, nodes can be mixed with elements/lines
the minimum number of nodes for element items is 3
the minimum number of nodes for line items is 2
element items should have all nodes unique
line items with the same first and last node are considered closed
=============================================================
example 1 :
1 11 0 10. 10.
1 12 0 20. 20.
3 7 0 2 11 12
#----------------
example 2 :
1 11 0 10. 10.
1 12 0 20. 20.
1 15 0 10. 20.
2 7 0 3
11 12 15
=============================================================
30
Appendix C
Parameter list
$title
free one line description of simulation
name_of_simulation
name_of_basin
$end
The first line of this section is a free one line description of the simulation that is to be
carried out. The next line contains the name of the simulation. All created files will use
this name in the main part of the file name with different extensions. Therefore the hydro-
dynamic output file (extension out) will be named name_of_simulation.out. The last
line gives the name of the basin file to be used. This is the pre-processed file of the basin
with extension bas. In our example the basin file name_of_basin.bas is used.
The directory where this files are read from or written to depends on the settings in section
$name. Using the default the program will read from and write to the current directory.
Compulsory time parameters This parameters are compulsory parameters that define
the period of the simulation. They must be present in all cases.
itanf Start of simulation. (Default 0)
31
idt Time step of integration.
Output parameters The following parameters deal with the output frequency and start
time to external files. The content of the various output files should be looked up in the
appropriate section.
The default for the time step of output of the files is 0 which means that no output file is
written. If the time step of the output files is equal to the time step of the simulation then at
every time step the output file is written. The default start time of the output is 0.
idtout Time step and start time for writing to file OUT, the file containing the
itmout general hydrodynamic results.
idtext Time step and start time for writing to file EXT, the file containing hy-
itmext drodynamic data of extra points. The extra points for which the data is
written to this file are given in section extra of the parameter file.
idtrst Time step and start time for writing the restart file (extension RST). No
itmrst restart file is written with idtrst equal to 0. A negative value is also
possible for the time step. In this case the used time step is -idtrst,
but the file is overwritten every time. It therefore contains always only
the last written restart record. (Default 0)
itrst Time to use for the restart. If a restart is performed, then the file name
containing the restart data has to be specified in restrt and the time
record corresponding to itrst is used in this file. A value of -1 is
also possible. In this case the last record in the restart file is used for
the restart and the simulation starts from this time. Be aware that this
option changes the parameter itanf to the time of the last record found
in restrt.
ityrst Type of restart. If 0 and the restart file is not found the program will
exit with an error. Otherwise the program will simply continue with a
cold start. If ityrst is 1 and the given time record is not found in the
file it will exit with error. If it is 2 it will initialize all values from the
first time record after itrst. Therefore, the value of 2 will guarantee
that the program will not abort and continue running, but it might be not
doing what you want. (Default 0)
idtres Time step and start time for writing to file RES, the file containing resid-
itmres ual hydrodynamic data.
idtrms Time step and start time for writing to file RMS, the file containing
itmrms hydrodynamic data of root mean square velocities.
idtflx Time step and start time for writing to file FLX, the file containing dis-
itmflx charge data through defined sections. The transects for which the dis-
charges are computed are given in section flux of the parameter file.
idtvol Time step and start time for writing to file VOL, the file containing
itmvol volume information of areas defined by transects. The transects that
are used to compute the volumes are given in section volume of the
parameter file.
32
General time and date parameters A time and date can be assigned to the simulation.
These values refer to the time 0 of the FEM model. The format for the date is YYYYM-
MDD and for the time HHMMSS. You can also give a time zone if your time is not referring
to GMT but to another time zone such as MET.
date The real date corresponding to time 0. (Default 0) time The real time corresponding
to time 0. (Default 0) tz The time zone you are in. This is 0 for GMT, 1 for MET and 2 for
MEST (MET summer time). (Default 0)
Model parameters The next parameters define the inclusion or exclusion of certain terms
of the primitive equations.
ilin Linearization of the momentum equations. If ilin is different from 0
the advective terms are not included in the computation. (Default 1)
itlin This parameter decides how the advective (non-linear) terms are com-
puted. The value of 0 (default) uses the usual finite element discretiza-
tion over a single element. The value of 1 choses a semi-lagrangian
approach that is theoretically stable also for Courant numbers higher
than 1. It is however recommended that the time step is limited using
itsplt and coumax described below. (Default 0)
coumax Normally the time step is computed in order to not exceed the Courant
number of 1. However, in some cases the non-linear terms are sta-
ble even for a value higher than 1 or there is a need to achieve a
lower Courant number. Setting coumax to the desired Courant number
achieves exactly this effect. (Default 1)
idtsyn In case of itsplt = 2 this parameter makes sure that after a time of
idtsyn the time step will be syncronized to this time. Therefore, setting
idtsyn = 3600 means that there will be a time stamp every hour, even
if the model has to take one very small time step in order to reach that
time. This parameter is useful only for itsplt = 2 and its default value
of 0 does not make any syncronization.
33
idtmin This variable defines the smallest time step possible when time step
splitting is enabled. Normally the smallest time step is 1 second. But
when dealing with a lot of wet and drying in areas then sometimes it
is useful to take out elements that limit the time step too much. In the
case that idtmin is set to a value greater than 1 the program will switch
off temporarily elements that are responsible for such a small time step.
(Default 0)
These parameters define the weighting of time level in the semi-implicit algorithm. With
these parameters the damping of gravity or Rossby waves can be controlled. Only modify
them if you know what you are doing.
azpar Weighting of the new time level of the transport terms in the continuity
equation. (Default 0.5)
ampar Weighting of the new time level of the pressure term in the momentum
equations. (Default 0.5)
afpar Weighting of the new time level of the Coriolis term in the momentum
equations. (Default 0.5)
avpar Weighting of the new time level of the non-linear advective terms in the
momentum equations. (Default 0.0)
The next parameters define the weighting of time level for the vertical stress and advection
terms. They guarantee the stability of the vertical system. For this reason they are normally
set to 1 which corresponds to a fully implicit discretization. Only modify them if you know
what you are doing.
atpar Weighting of the new time level of the vertical viscosity in the momen-
tum equation. (Default 1.0)
adpar Weighting of the new time level of the vertical diffusion in the scalar
equations. (Default 1.0)
aapar Weighting of the new time level of the vertical advection in the scalar
equations. (Default 1.0)
Coriolis parameters The next parameters define the parameters to be used with the Cori-
olis terms.
icor If this parameter is 0, the Coriolis terms are not included in the com-
putation. A value of 1 uses a beta-plane approximation with a variable
Coriolis parameter f , whereas a value of 2 uses an f-plane approxi-
mation where the Coriolis parameter f is kept constant over the whole
domain. (Default 0)
dlat Average latitude of the basin. This is used to compute the Coriolis pa-
rameter f . If not given the latitude in the basin file is used. If given
the value of dlat in the input parameter file effectively substitues the
value given in the basin file. This parameter is not used if spherical
coordinates are used (isphe=1). (Default 0)
34
isphe If 0 a cartesian coordinate system is used, if 1 the coordinates are in the
spherical system (lat/lon). Please note that in case of spherical coordi-
nates the Coriolis term is always included in the computation, even with
icor = 0. If you really do not want to use the Coriolis term, then please
set icor = -1. The default is -1, which means that the type of coordinate
system will be determined automatically.
Depth parameters The next parameters deal with handling depth values of the basin.
href Reference depth. If the depth values of the basin and the water levels
are referred to mean sea level, href should be 0 (default value). Else
this value is subtracted from the given depth values. For example, if
href = 0.20 then a depth value in the basin of 1 meter will be reduced
to 80 centimeters.
hzmin Minimum total water depth that will remain in a node if the element
becomes dry. (Default 0.01 m)
hzoff Total water depth at which an element will be taken out of the compu-
tation because it becomes dry. (Default 0.05 m)
hzon Total water depth at which a dry element will be re-inserted into the
computation. (Default 0.10 m)
hmin Minimum water depth (most shallow) for the whole basin. All depth
values of the basin will be adjusted so that no water depth is shallower
than hmin. (Default is no adjustment)
hmax Maximum water depth (deepest) for the whole basin. All depth values
of the basin will be adjusted so that no water depth is deeper than hmax.
(Default is no adjustment)
Bottom friction The friction term in the momentum equations can be written as Ru and
Rv where R is the variable friction coefficient and u, v are the velocities in x, y direction
respectively. The form of R can be specified in various ways. The value of ireib is
choosing between the formulations. In the parameter input file a value λ is specified that is
used in the formulas below.
ireib Type of friction used (default 0):
0 No friction used
1 R = λ is constant
5 R = λ |u|
H
35
czdef The default value for the friction parameter λ. Depending on the value
of ireib the coefficient λ is describing linear friction, constant drag
coefficient or a Chezy or Strickler form of friction (default 0).
iczv Normally R is evaluated at every time step (iczv = 1). If for some
reason this behavior is not desirable, iczv = 0 evaluates the value of
R only before the first time step, keeping it constant for the rest of the
simulation. (default 1)
The value of λ may be specified for the whole basin through the value of czdef. For more
control over the friction parameter it can be also specified in section area where the friction
parameter depending on the type of the element may be varied. Please see the paragraph
on section area for more information.
Physical parameters The next parameters describe physical values that can be adjusted
if needed.
rowass Average density of sea water. (Default 1025 kg m−3 )
Wind parameters The next two parameters deal with the wind stress to be prescribed at
the surface of the basin.
The wind data can either be specified in an external file (ASCII or binary) or directly in the
parameter file in section wind. The ASCII file or the wind section contain three columns,
the first giving the time in seconds, and the others the components of the wind speed. Please
see below how the last two columns are interpreted depending on the value of iwtype. For
the format of the binary file please see the relative section. If both a wind file and section
wind are given, data from the file is used.
The wind stress is normally computed with the following formula
where ρa , ρ0 is the density of air and water respectively, u the modulus of wind speed and
ux , uy the components of wind speed in x, y direction. In this formulation cD is a dimen-
sionless drag coefficient that varies between 1.5 ·10−3 and 3.2 ·10−3 . The wind speed is
normally the wind speed measured at a height of 10 m.
iwtype The type of wind data given (default 1):
0 No wind data is processed
1 The components of the wind is given in [m/s]
2 The stress (τx , τy ) is directly specified
itdrag Formula to compute the drag coefficient. A value of 0 uses the constant
value given in dragco. With 1 the Smith and Banke formula is used.
36
dragco Drag coefficient used in the above formula. The default value is 0 so it
must be specified. Please note also that in case of iwtype = 2 this value
is of no interest, since the stress is specified directly.
wsmax Maximum wind speed allowed in [m/s]. This is in order to avoid errors
if the wind data is given in a different format from the one spwecified
by iwtype. (Default 50)
Parameters for 3d The next parameters deal with the layer structure in 3D.
dzreg Normally the bottom of the various layers are given in section $levels.
If only a regular vertical grid is desired then the parameter dzreg can be
used. It specifies the spacing of the vertical layers in meters. (Default is
0, which means that the layers are specified explicitly in $levels.
The last layer (bottom layer) is treated in a special way. Depending on the parameter
ilytyp there are various cases to be considered. A value of 0 leaves the last layer as it is,
even if the thickness is very small. A value of 1 will always eliminate the last layer, if it has
not full layer thickness. A value of 2 will do the same, but only if the last layer is smaller
than hlvmin (in units of fraction). Finally, a value of 3 will add the last layer to the layer
above, if its layer thickness is smaller than hlvmin.
ilytyp Treatment of last (bottom) layer. 0 means no adjustment, 1 deletes the
last layer, if it is not a full layer, 2 only deletes it if the layer thickness is
less than hlvmin, and 3 adds the layer thickness to the layer above if it
is smaller than hlvmin. Therefore, 1 and 2 might change the total depth
and layer structure, while 3 only might change the layer structure. The
value of 1 will always give you full layers at the bottom.
hlvmin Minimum layer thickness for last (bottom) layer used when ilytyp is
2 or 3. The unit is fractions of the nominal layer thickness. Therefore,
a value of 0.5 indicates that the last layer should be at least half of the
full layer.
The next parameters deal with vertical diffusivity and viscosity.
diftur Vertical turbulent diffusion parameter for the tracer. (Default 0)
difmol Vertical molecular diffusion parameter for the tracer. (Default 1.0e-06)
37
itvdv Type of the vertical advection scheme used for the transport and dif-
fusion equation. Normally an upwind scheme is used (0), but setting
the parameter itvd to 1 choses a TVD scheme. This feature is still
experimental, so use with care. (Default 0)
rstol Normally the internal time step for scalar advection is automatically
adjusted to produce a Courant number of 1 (marginal stability). You
can set rstol to a smaller value if you think there are stability problems.
(Default 1)
Temperature and salinity The next parameters deal with the transport and diffusion of
temperature and salinity. Please note that in order to compute T/S the parameter ibarcl
must be different from 0. In this case T/S advection is computed, but may be selectively
turned off setting one of the two parameters itemp or isalt explicitly to 0.
itemp Flag if the computation on the temperature is done. A value different
from 0 computes the transport and diffusion of the temperature. (De-
fault 1)
isalt Flag if the computation on the salinity is done. A value different from
0 computes the transport and diffusion of the salinity. (Default 1)
The next parameters set the initial conditions for temperature and salinity. Both the average
value and and a stratification can be specified.
temref Reference (initial) temperature of the water in centigrade. (Default 0)
salref Reference (initial) salinity of the water in psu (practical salinity units)
or ppt. (Default 0)
Concentrations The next parameters deal with the transport and diffusion of a conserva-
tive substance. The substance is dissolved in the water and acts like a tracer.
iconz Flag if the computation on the tracer is done. A value different from 0
computes the transport and diffusion of the substance. If greater than 1
iconz concentrations are simulated. (Default 0)
chpar Horizontal diffusion parameter for the tracer. This value overwrites the
general parameter for horizontal diffusion dhpar. (Default 0)
38
Output for scalars The next parameters define the output frequency of the computed
scalars (temperature, salinity, generic concentration) to file.
idtcon Time step and start time for writing to file CON (concentration) and
itmcon NOS (temperature and salinity).
Directory specification This parameters define directories for various input and output
files.
basdir Directory where basin file BAS resides. (Default .)
File names The following strings enable the specification of files that account for initial
conditions or forcing.
zinit File with initial water level distribution.
wind File with wind data. The file may be either formatted or unformatted.
For the format of the unformatted file please see the section where the
WIN file is discussed. The format of formatted ASCII file is in standard
time-series format, with the first column containing the time in seconds
and the next two columns containing the wind data. The meaning of the
two values depend on the value of the parameter iwtype in the para
section.
rain File with rain data. This file is a standard time series with the time
in seconds and the rain values in mm/day. The values may include
also evaporation. Therefore, also negative values (for evaporation) are
permitted.
qflux File with heat flux data. This file must be in a special format to account
for the various parameters that are needed by the heat flux module to
run. Please refer to the information on the file qflux.
restrt Name of the file if a restart is to be performed. The file has to be pro-
duced by a previous run with the parameter idtrst different from 0.
The data record to be used in the file for the restart must be given by
time itrst.
gotmpa Name of file containing the parameters for the GOTM turbulence model
(iturb = 1).
39
conzin Name of file containing initial conditions for concentration
iqual If the boundary conditions for this open boundary are equal to the ones
of boundary i, then setting iqual = i copies all the values of boundary
i to the actual boundary. Note that the value of iqual must be smaller
than the number of the actual boundary, i.e., boundary i must have been
defined before.
The next parameters give a possibility to specify the file name of the various input files
that are to be read by the model. Values for the boundary condition can be given at any
time step. The model interpolates in between given time steps if needed. The grade of
interpolation can be given by intpol.
All files are in ASCII and share a common format. The file must contain two columns, the
first giving the time of simulation in seconds that refers to the value given in the second
column. The value in the second column must be in the unit of the variable that is given.
The time values must be in increasing order. There must be values for the whole simulation,
i.e., the time value of the first line must be smaller or equal than the start of the simulation,
40
and the time value of the last line must be greater or equal than the end of the simulation.
boundn File name that contains values for the boundary condition. The value
of the variable given in the second column must be in the unit deter-
mined by ibtyp, i.e., in meters for a level boundary, in m3 s−1 for a flux
boundary and in m4 s−2 for a momentum input.
zfact Factor with which the values from boundn are multiplied to form the
final value of the boundary condition. E.g., this value can be used to
set up a quick sensitivity run by multiplying all discharges by a factor
without generating a new file. (Default 1)
levmin A point discharge normally distributes its discharge over the whole wa-
levmax ter column. If it is important that in a 3D simulation the water mass dis-
charge is concentrated only in some levels, the parameters levmin and
levmax can be used. They indicate the lowest and deepest level over
which the discharge is distributed. Default values are 0, which indicate
that the discharge is distributed over the whole water column. Setting
only levmax distributes from the surface to this level, and setting only
levmin distributes from the bottom to this level.
conzn File name that contains values for the respective boundary condition,
tempn i.e., for concentration, temperature and salinity. The format is the same
saltn as for file boundn. The unit of the values given in the second column
must the ones of the variable, i.e., arbitrary unit for concentration, centi-
grade for temperature and psu (per mille) for salinity.
The next variables specify the name of the boundary value file for different modules. Please
refer to the documentation of the single modules for the units of the variables.
bio2dn File name that contains values for the ecological module (EUTRO-
WASP).
sed2dn File name that contains values for the sediment transport module
mud2dn File name that contains values for the fluid mud module
lam2dn File name that contains values for the fluid mud module (boundary con-
dition for the structural parameter, to be implemented)
dmf2dn File name that contains values for the fluid mud module (boundary con-
ditions for the advection of flocsizes, to be implemented)
tox3dn File name that contains values for the toxicological module.
intpol Order of interpolation for the boundary values read through files. Use
for 1 for stepwise (no) interpolation, 2 for linear and 4 for cubic in-
terpolation. The default is linear interpolation, except for water level
boundaries (ibtyp=1) where cubic interpolation is used.
The next parameters can be used to impose a sinusoidal water level (tide) or flux at the open
boundary. These values are used if no boundary file boundn has been given. The values
must be in the unit of the intended variable determined by ibtyp.
ampli Amplitude of the sinus function imposed. (Default 0)
41
phase Phase shift of the sinus function imposed. A positive value of one quar-
ter of the period reproduces a cosine function. (Default 0)
zref Reference level of the sinus function imposed. If only zref is specified
(ampli = 0) a constant value of zref is imposed on the open boundary.
With the next parameters a constant value can be imposed for the variables of concentration,
temperature and salinity. In this case no file with boundary values has to be supplied. The
default for all values is 0, i.e., if no file with boundary values is supplied and no constant is
set the value of 0 is imposed on the open boundary. A special value of -999 is also allwoed.
In this case the value imposed is the ambient value of the parameter close to the boundary.
conz Constant boundary values for concentration, temperature and salinity
temp respectively. If these values are set no boundary file has to be supplied.
salt (Default 0)
The next two values are used for constant momentum input. This feature can be used to
describe local acceleration of the water column. The values give the input of momentum
in x and y direction. The unit is force / density (m4 s−2 ). In other words it is the rate of
volume (m3 s−1 ) times the velocity (m/s) to which the water is accelerated.
These values are used if boundary condition ibtyp = 4 has been chosen and no boundary
input file has been given. If the momentum input is varying then it may be specified with
the file boundn. In this case the file boundn must contain three columns, the first for the
time, and the other two for the momentum input in x, y direction.
umom Constant values for momentum input. (Default 0)
vmom
42
The nodes of the transects are specified in free format. Between two transects one or more
0’s must be inserted. An example is given in figure C.2.
$flux
1001 1002 1004 0
35 37 46 0 0 56 57 58 0
407
301
435 0 89 87
$end
The example shows the definition of 5 transects. As can be seen, the nodes of the transects
can be given on one line alone (first transect), two transects on one line (transect 2 and 3),
spread over more lines (transect 4) and a last transect.
43
x1leg Upper right corner of the area. where the legend (north and scale) is
y1leg plotted.
dxygrd Grid size if the results are interpolated on a regular grid. A value of
0 does not use a regular grid but the original finite element grid for
plotting. (Default 0)
typls Typical length scale to be used when scaling velocity or transport ar-
rows. If dxygrd is given this length is used and typls is not used. If
not given it is computed from the basin parameters. (Default 0)
typlsf Additional factor to be used with typls to determine the length of the
maximum or reference vector. This is the easiest way to scale the ve-
locitiy arrows with an overall factor. (Default 1)
velref Reference value to be used when scaling arrows. If given, a vector with
this value will have a length of typls*typlsf on the map, or, in case
dxygrd is given, dxygrd*typlsf. If not set the maximum value of the
velocity/transport will be used as velref. (Default 0)
velmin Minimum value for which an arrow will be plotted. With this value you
can eliminate small arrows in low dynamic areas. (Default 0)
reggrd If different from 0 it plots a regular grid over the plot for geographical
reference. The value of reggrd gives the spacing of the regular grid
lines. The units must be according to the units used for the coordinates.
With value of -1 the regular grid is determined automatically. (Default
-1)
regdst This value gives the number of intervals that are used to sub-divide the
grid given by reggrd with a black and white scale around the plot. If 0
it tries to determine automatically the sub-intervals (2 or 4). A value of
-1 does not plot the subgrid scale. (Default 0)
reggry If plotting the regular overlay grid this gives the grey value used for the
grid. 0 is black, and 1 is white. A value of 1 does not plot the overlay
grid, but still writes the labels. (Default 0.5)
bndlin Name of file that gives the boundary line that is not part of the finite
element domain. The file must be in BND format. You can use the
program grd2bnd.pl to create the file from a GRD file. (Default is no
file)
ioverl Create overlay of velocity vectors on scalar value. With the value of
0 no overlay is created, 1 creates an overlay with the velocity speed.
The value of 2 overlays vertical velocities 3 water levels and 4 overlays
bathymetry.(Default 0)
44
inorm Normally the horizontal velocities are plotted in scale. The value of
inorm can change this behavior. A value of 1 normalizes velocity vec-
tors (all vectors are the same length), whereas 2 scales from a given
minimum velocity velmin. Finally, the value of 3 uses a logarithmic
scale. (Default 0)
isoval Array that defines the values for the isolines and colors that are to be
plotted. Values given must be in the unit of the variable that will be
plotted, i.e., meters for water levels etc.
color Array that gives the color indices for the plotting color to be used.
Ranges are from 0 to 1. The type of the color depends on the vari-
able icolor. For the gray scale table 0 represents black and 1 white.
Values in between correspond to tones of gray. For the HSB color table
going from 0 to 1 gives the color of the rainbow. There must be one
more value in color than in isoval. The first color in color refers
to values less than isoval(1), the second color in color to values be-
tween isoval(1) and isoval(2). The last color in color refers to
values greater than the last value in isoval.
x0col Lower left corner of the area where the color bar is plotted.
y0col
x1col Upper right corner of the area where the color bar is plotted.
y1col
faccol Factor for the values that are written to the color bar legend. This en-
ables you, e.g., to give water level results in mm (faccol = 1000).
(Default 1)
ndccol Decimals after the decimal point for the values written to the color bar
legend. Use the value -1 to not write the decimal point. A value of 0
automatically computes the number of decimals needed. (Default 0)
legcol Text for the description of the color bar. This text is written above the
color bar.
It is not necessary to give all values for isolines and colors above. A faster way is to give
only the minimum and maximum values and fix the number of isovalues to be used.
niso Total number of isolines to use. (Default is nisodf)
colmin Minimum and maximum color index used. Defaults are 0.1 and 0.9
colmax respectively. The value of colmax can be smaller than colmin which
inverts the color index used.
45
valmin Minimum and maximum value for isovalues to be used. There is no
valmax default.
dval Difference of values between isolines. If this value is greater then 0
the values for isolines and the total number of isolines are computed
automatically using also valmin and valmax. (Default 0)
Since there is a great choice of combinations between the parameters, we give here the
following rules how the values for colors and isolines are determined.
If colors are given in array color, they are used, else colmin and colmax or their respective
defaults are used to determine the color bar. If isoval is given it is used, else valmin and
valmax are used. If valmin and valmax are not given they are computed every time for
each plot and the minimum and maximum value in the basin are used. In any case, if
isoval is specified the total number of isovalues is known and niso is ignored. However,
if isoval is not given then first dval is used to decide how many isovalues to plot, and if
dval is 0 then the niso and finally nisodf is used.
Other parameters that can be changed are the following.
nisomx Maximum for niso allowed. This is especially useful when the value
for niso is determined automatically. It avoids you to plot 1000 isolines
due to wrong settings of dval. However, if you want to use 50 isovalues
then just set niso and nisomx to 50. (Default 20)
nctick Number of values to be written in color bar. If niso is high the labels
on the color bar become unreadable. Therefore you can use nctick to
write only some of the values to the color bar. For example, if valmin
is 0 and valmax is 5 and you use many isolines, then setting nctick
to 6 would give you labels at values 0,1,2,3,4,5. If nctick is 0 then all
lables are written. (Default 0)
isolin Normally the isolines are not drawn on the plot, just the colors are used
to show the value in the different parts of the plot. A value different
from 0 plots also the isolines. In this case isolin gives the number of
isolines to be plotted. A good choice is to make this equal to nctick,
so that the isolines correspond to the values written on the colorbar. For
compatibility, a value of 1 plots all isolines. (Default 0)
bgray Gray value used for the finite element grid when plotting the bathyme-
try. (Default 0.8)
bsgray Gray value used to plot the finite element grid over a scalar or velocity
plot. This is basically useful for debugging reasons. The default is to
not plot the grid (Default -1.0)
46
x1arr Upper right corner of the area where the reference arrow is plotted.
y1arr
facvel Factor for the value that is written to the arrow legend for the velocity.
This enables you, e.g., to give velocities in mm/s (facvel = 1000).
(Default 1)
ndcvel Decimals after the decimal point for the values written to the arrow
legend. Use the value -1 to not write the decimal point. (Default 2)
legvel Text for the description of the arrow legend. This text is written above
the arrow.
arrvel Length of arrow in legend (in velocity units). If not given the arrow
length will be computed automatically. (Default 0)
sclvel Additional factor to be used for the arrow in the legend. When the
arrow length will be computed automatically, this parameter gives the
possibility to change the length of the reference vector. This is an easy
way to scale the velocitiy arrow with an overall factor. Not used if
arrvel is given. (Default 1)
$legend
text 30500 11800 15 ’Chioggia’ #text, 15pt
line 30500 11800 35000 15000 #line
vect 30500 11800 35000 15000 0.1 #arrow, tipsize 0.1
rect 30500 11800 35000 15000 0.1 #rectangle, fill color 0.1
rect 30500 11800 35000 15000 -1 #rectangle (outline, no fill)
circ 30500 11800 5000 -1 #circle (outline, no fill)
wid 5 #set line width to 5
col 0.5 #set color to 0.5
$end
There is also an old way to specify the legend that does not use keywords. However, this
way is deprecated and unsupported and is therefore not described anymore in this manual.
47
C.2.6 Section $legvar
In this section variable fields like the date and wind vectors may be inserted into the plot.
A time and date can be assigned to the simulation results. These values refer to the time 0
of the FEM model. The format for the date is YYYYMMDD and for the time HHMMSS.
You can also give a time zone if your time is not referring to GMT but to another time zone
such as MET. Please note that you have to give this information only if the simulation does
not contain it already. Normally, this information is already assigned during the simulation
runs.
date The real date corresponding to time 0. (Default 0)
tz The time zone you are in. This is 0 for GMT, 1 for MET and 2 for
MEST (MET summer time). (Default 0)
tzshow The time zone you want to show your results. If your time zone is GMT
(0) and you want to show the results referred to MET (+1) set this to +1.
Please note that you have to set this variable only if you want to show
results in a different time zone than the one given in tz. (Default 0)
The information of date and time may be written to the plot. This is done with the following
parameters.
xdate Starting point for the date text (lower left corner).
ydate
idate Output mode. If 0 no date is written to the plot, else the date and time
is written. (Default 0)
Wind data can be used to insert a wind vector into the figure. This is useful because in the
case of variable wind the direction and speed of the wind that was blowing in the moment
of the plot is shown.
Since only one wind vector can be plotted, the wind data must consist of one value for each
time. The same ASCII file that is used in the STR file can be used.
xwind Starting point where the wind arrow is plotted.
ywind
iwtype Type of wind data. The same as the one in the STR file. If this parameter
is 0 then no wind vector is plotted. (Default 0)
scwind Scaling parameter of the wind vector. This depends on the size of your
plot. If your wind is 10 m/s and you want the vector to strech over a
distance of 5 km on the plot then you have to choose the value of 500
(10*500=5000) for scwind. (Default 1)
wfile Name of the file containing the wind data. This may be the same file
than the one used in the STR file to run the program.
The wind vector is also given a text legend with the speed of the wind written out. The next
parameters decide where and how this information is put.
xtwind Starting point for the legend text (lower left corner).
ytwind
48
stwind Point size of the text. (Default 18)
49
Bibliography
[1] Jan O. Backhaus. A semi-implicit scheme for the shallow water equations for aplica-
tion to shelf sea modelling. Continental Shelf Research, 2(4):243–254, 1983.
[2] Kurt C. Duwe and Regina R. Hewer. Ein semi-implizites gezeitenmodell für wattge-
biete. Deutsche Hydrographische Zeitschrift, 35(6):223–238, 1982.
[3] G. Grotkop. Finite element analysis of long-period water waves. Computer Methods
in Applied Mechanics and Engineering, 2(2):147–157, 1973.
[4] B. Herrling. Computation of shallow water waves with hybrid finite elements. Ad-
vances in Water Resources, 1:313–320, 1978.
[5] Bruno Herrling. Ein finite-element-modell zur berechnung von Tideströmungen in
ästuarien mit Wattflächen. Die Küste, 31:102–113, 1977.
[6] K.-P. Holz and G. Nitsche. Tidal wave analysis for estuaries with intertidal flats.
Advances in Water Resources, 5:142–148, 1982.
[7] Michael Kwizak and André J. Robert. A semi-implicit scheme for grid point atmo-
spheric models of the primitive equations. Monthly Weather Review, 99(1):32–36,
1971.
[8] A. Schoenstadt. A transfer function analysis of numerical schemes used to simulate
geostrophic adjustment. Monthly Weather Review, 108:1248, 1980.
[9] C. Taylor and J. Davis. Tidal and long wave propagation—a finite element approach.
Computers & Fluids, 3:125–148, 1975.
[10] Georg Umgiesser. A model for the Venice Lagoon. Master’s thesis, University of
Hamburg, 1986.
[11] Georg Umgiesser and Andrea Bergamasco. A staggered grid finite element model of
the Venice Lagoon. In J. Periaux K. Morgan, E. Ofiate and O.C. Zienkiewicz, editors,
Finite Elements in Fluids. Pineridge Press, 1993.
[12] R. T. Williams. On the formulation of finite-element prediction models. Monthly
Weather Review, 109:463, 1981.
[13] R. T. Williams and O. C. Zienkiewicz. Improved finite element forms for the shallow-
water wave equations. International Journal for Numerical Methods in Fluids, 1:81,
1981.
50