SWAN GIS Running Simulations
This page shows you how to run SWAN using two differing methods as follows:
Either methods are suitable, however the batch file method is typically more flexible and powerful and therefore recommended for this tutorial.
Running Simulations from the Command Line
Once installed, add SWAN to the Windows PATH environment variable by following the below steps (Note: If running from a batch file these steps are not mandatory). This allows the swanrun program to be called from the command line regardless of what directory you are in.
- In the windows search bar, type 'path'
- Open the 'system environment variables' editor
- Press the 'Environment Variables' button
- Select the 'Path' variable
- Press the 'edit' button
- Add the path of the SWAN folder
Run the first SWAN model by entering 'swanrun REGIONAL_20180901_20181001'. Make sure you exclude the '.swn' file extension. Swanrun will automatically append this when opening the file.
An example of navigating the command prompt is provided below, noting this snapshot runs a different model and file location to that specified in our tutorial, you can ignore this, the process is what's important here.
For this tutorial, we need to run all 4 nested models. This is best done using a batch file as explained in the section below.
Running Simulations with Batch File
Often we will want to run multiple simulations one after another. For these situations batching our runs in a batch file is useful and this section will show you how to batch up SWAN runs. Please note you don't need to complete the running from command line section above to be able to run via a batch file.
In your C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN\03_simulation folder, create a new file named 'run.bat'.
To allow sequential running of models we need to make a slight change to the default swanrun.bat file installed with SWAN. Open C:\Program Files\swan\swanrun.bat in a text editor and navigate to the bottom of the file. Enter the command EXIT on the last line. Save and close the file. An example of where to add the EXIT command is shown as follows:
To run the batch file either:
- Open the command prompt and change the current working directory by entering 'cd C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN\03_simulation'. Run the batch file by entering 'run.bat'
- Navigate to the batch file C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN\03_simulation\run.bat in Windows Explorer and double click on the batch file.
Nice work! You have now run your suite of SWAN models. During the next stage of the tutorial we will investigate post processing options to help visualise SWAN results and also prepare the spectral wave outputs for input to the TUFLOW FV hydrodynamic model.