running Swan with the GUI

Running SWAN

SWAN is not an interactive computer program like most programs running under Windows. The procedure for a batch program as SWAN is as follows: the user prepares one or more input files; he then starts the program and waits until the program is completed. After the program is completed he can look at the results. If the results are not satisfying he modifies the input and starts the program again.
On Windows the user has to start a so-called DOS box. This is done by clicking on: Start -> All Programs -> Accessories -> Command Prompt.
A box with a black background appears in which commands can be typed, not commands for SWAN itself but commands to start programs, copy files etc. To start SWAN you can type e.g.:
runswan.bat controlfile

The control file contains the commands for SWAN. These commands are described in the user manual of SWAN. An example of a control file is:

$> Generated by Swan Professional.
$> 20080307 2120
PROJECT 'mm' 'hv8'
SET  NAUTICAL
MODE TWODIMENSIONAL
CGRID -1042.2 2190.8 20.4 20217 23263.1 35 46 CIRCLE 36 0.05 1 30
INPGRID BOTTOM 0 0 30 87 116 250 250
READINP BOTTOM 1 'HARINGV2.BOT' 2 3
WIND 12 240
BOUNDPAR1 SHAPESPEC JONSWAP PEAK
BOUNDPAR2 SIDE S CONSTANT PAR 2 8 260 2
BOUNDPAR2 SIDE W CONSTANT PAR 2 8 260 2
CURVE 'SWANPRO1' -4005.4 14167.3 30 13527.2 17377.5
POINTS 'SWANPRO2' -4005.4 14167.3 &
 -2252.14 14488.32 &
 -498.88 14809.34 &
 1254.38 15130.36 &
 3007.64 15451.38 &
 4760.9 15772.4 &
 6514.16 16093.42 &
 8267.42 16414.44 &
 10020.68 16735.46 &
 11773.94 17056.48 &
 13527.2 17377.5
SPECOUT 'SWANPRO2' SPEC1D RELATIVE 'hv8.SPE'
SPECOUT 'SWANPRO2' SPEC2D RELATIVE 'hv8.SPC'
PLOT 'SWANPRO2' FILE 'hv8.SPL' SPEC
TABLE 'SWANPRO1' HEAD 'hv8.TBL' Distance DEP HS TM01 DIR DSPR  &
           XP YP RTP PER PDIR
PLOT 'COMPGRID' FILE 'hv8.PLT' ISO HS VEC DIR
BLOCK 'COMPGRID' FILE 'hv8.BLK' XP YP DEP HS TM01 DIR DSPR
TRIAD
SITES 'goeree' 10875 14500 0 REGION
COMPUTE
STOP
Exercise: Analyse this control file using the user manual; find the function of each of the commands.

The control file is a simple ASCII file. It can be written using e.g. Notepad or Wordpad.

output file(s)

After SWAN has completed the computation a number of output files result. There should be at least one output file; it is called the print file although nowadays it is usually not printed. The name of the print file is equal to the name of the control file; only the extension is changed from .swn to .prt; this file resides in the same directory as the corresponding control file. Note: in the above command line to start SWAN you do not see the extension .swn; this is correct: you prepare a control file called e.g. cfile.swn, you start the computation with runswan.bat cfile, and you obtain a print file called cfile.prt. The print file and also most other output files of SWAN are simple ASCII, so they can be read using an ASCII editor (e.g. Notepad).
The print file contains a copy of the control file and a number of messages, such as error messages and warnings. If you are using the DHH-SWAN (with graphics extension) you will see a message in this file if your license has expired or will expire shortly.
If the computation was completed successfully there usually will be more output files, among them files containing numbers computed by SWAN. If you use the version of SWAN by Digital Hydraulics there will be files with graphical information. The graphs can be viewed using graphical post-processing software.
If you do not get the expected output or if the you mistrust the results always have a look at the print file. If you are uncertain whether you gave the numbers in the control file in the correct order, or if you are uncertain about the default values that Swan assumed, put the command TEST or TEST 30 at the beginning of your control file and TEST 0 right before the COMPUTE command. See an example of the output that you get.

go to top

Graphical User Interface

Digital Hydraulics also distributes a Graphical User Interface (GUI for short) to help inexperienced users in making the control file and running SWAN. The GUI has sub-menus for various tasks: choice of the bathymetry, wind and incident waves, choice of the computational grid. After all necessary data are gathered the GUI generates a control file (the example above is made by the GUI), and the SWAN computation can be started; after the computation the GUI presents the results in graphical form.
The GUI does not have all the options of the stand-alone SWAN. Some of the limitations are:

  • only stationary computations
  • no currents
  • only constant wind velocity
  • no nesting
The GUI can be helpful even if one of the limitations does not allow you to run SWAN with the GUI. With help of the GUI you can prepare a control file (the GUI will generate one, see the example above) and then you can modify or add commands using an ASCII editor.

go to top

© 2012: Nico Booij