Tips and Tricks
This page serves as a catch-all covering methods to achieve common goals or overcome common issues.
Pre-Processing Tips and Tricks
ADCIRC-Only Tips and Tricks
ADCIRC+SWAN Tips and Tricks
Writing Alternative SWAN Output
Have you ever wanted to write different SWAN parameters to output in a coupled ADCIRC+SWAN simulation? If so, these tips and tricks are for you! The current implementations of the dynamically coupled version of ADCIRC+SWAN only write a few SWAN parameters to global time-series output files. Those output parameters and files include:
- spectrally significant wave height (filename: swan_HS.63)
- "smoothed" peak wave period (filename: swan_TPS.63)
- mean absolute wave period (filename: swan_TMM10.63)
- mean wave direction (filename: swan_DIR.63)
The SWAN model has many other potentially useful output parameters and, in some cases, they may be more appropriate for your needs than these default outputs. For example, what if you preferred seeing the peak wave direction instead of the mean wave direction? Or maybe you need the swell wave height instead of, or in addition to, the significant wave height? The two methods below will allow you to accomplish just this. Granted, this does require that you modify some files within the SWAN and ADCIRC source codes, and that you recompile the source code into your desired executables. We hope the instructions below make the task of modifying the source code a little less daunting. There is one major caveat to the two methods outlined below: it will not allow you to 'define' your desired SWAN output in either the fort.26 file OR in namelist form at the bottom of fort.15. In other words, you will receive whatever outputs you hardwire into your source code and you cannot easily turn them on or off without again modifying the source code.
Method 1 - Easy but Limited
This is by far the simplest method for modifying SWAN output in a coupled ADCIRC+SWAN simulation. By following the instructions below, you will be able to write any SWAN output you desire… but only to the existing SWAN output files. Existing SWAN output files include swan_HS.63, swan_TPS.63, swan_TMM10.63, swan_DIR.63, etc. This method will not produce NEW or ADDITIONAL SWAN output files. Rather, it will simply write the user-specified output to these existing filenames.
Go to the ~/swan/ folder in your adcirc source code directory tree and open the file swanout1.f
You are looking for a variable assignment named IVTYPE in the subroutine named SWOEXA. The IVTYPE value is linked to SWAN output variables. For example, this is what the first IVTYPE definition looks like in my version of SWAN…
! significant wave height
IVTYPE = 10
Keep searching and note the IVTYPE values corresponding to your desired SWAN output variable(s). I have included a few below for reference.
IVTYPE value / variable name
10 / significant wave height
44 / swell wave height
12 / peak wave period
14 / peak wave direction
13 / mean wave direction
16 / directional spread
15 / energy transport direction
17 / average wave length
18 / steepness
With the IVTYPE value(s) noted, proceed to the ~/src/ directory and open the file couple2swan.F
Search for the variable IVTYPE. Reassign the IVTYPE values using the values of your desired output. For example, if you want to write the peak wave direction to the “swan_DIR.63” file instead of the mean wave direction, you’d want to change IVTYPE = 13 to IVTYPE = 14. Note that you’ll need to make this change in at least three places within the couple2swan.F file. You would of course want to make these IVTYPE reassignments for any and all existing SWAN output that you'd like to modify. Keep in mind that you only have four existing files to work with here, so that is ultimately your limit on output parameters as well. IF you need more than four output parameters and also want to change the filenames, see Method 2 below.
Method 2 - Moderately Difficult but Limitless
This method is more complex but will allow you to name and create as many original SWAN output files that you want. For example, say I wanted to keep the existing default SWAN output files (referenced above in Method 1) but also write the peak wave direction output to a brand new file named swan_PDIR.63. You can do that if you follow the steps below.