SWAN GIS Model Builder

From TUFLOW FV Wiki
Jump to navigation Jump to search
USEFUL LINKS
Wiki Links Help Downloads
TUFLOW FV Wiki Main Page Products Support/Contact TUFLOW FV Downloads
TUFLOW FV Tutorials Requesting a Licence Tutorial Module Data
TUFLOW Classic/HPC Wiki TUFLOW FV Glossary Manuals

Introduction

This page guides you through the SWAN GIS Model Builder Panel of the TUFLOW Viewer Plugin and is the third step the step by step guide. We will use the Model Builder Panel to:

  • Assign our working directory and configuration
  • Digitise our model domains, assign cell resolution and optionally assign grid rotation
  • Layer the SWAN model bathymetry via a series of DEMs
  • Input our wind and wave data for boundary condition development
  • Define our model start and end times
  • Build the SWAN model, including all runs files, computation grids, nesting, boundary conditions and model check files

    Building Model in QGIS

    1. Start QGIS (version 3.16.3 or later). Under the plugins menu, navigate to the plugins/TUFLOW/SWAN GIS Tools (beta)/Model Builder. If you don't have this option please ensure that you've installed the TUFLOW Viewer Plugin for QGIS.
      SWAN GUI REFERENCE 000b.PNG
    2. It's important that we set the working coordinate reference system. This will be used as the default coordinate reference system for our SWAN grid files and will ensure that our model grids, bathymetries, wind and wave inputs are correctly aligned. Not completing this step is a common source of error when running the SWANGIS tools. For this tutorial set the coordinate reference system to WGS84 longitude/latitude or EPSG:4326. Please note that the SWANGIS tools assume all input datasets are in the same coordinate reference system.
      SET PROJECTION 001.PNG

      Filter by typing in 4326 to select the EPSG for WG84 Long/Lat. Then click ok.
      SET PROJECTION 002.PNG

    3. Set the default coordinate reference system options for all QGIS projects via the Settings >> Options menu.
      SET PROJECTION 003.PNG

      Go to the CRS tab. We want to change the default CRS for layers with no coordinate system assigned to be the same as the project coordinate reference system.
      SET PROJECTION 004.PNG

    4. Set the SWAN folder path at the top of the model builder window, this is the location where all SWAN model files will be saved (see model folder setup). If following the tutorial we will set the path to C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN.
      SWAN BUILDING MODEL 001.PNG

      Setup Configuration File

    5. Create a new parameter configuration file by following these steps:
      1. Press the spanner icon in the 'Configuration File Input' row
      2. Set the parameter inputs to desired values. In this instance we will stick with the default values.
      3. Press the 'Save As' button
      4. Save file to C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN\CONFIG.ini

      SWAN BUILDING MODEL 002.PNG

      Open the saved configuration file in a text editor. The configuration file contains text that describes the assignment of model parameters. The model builder will use the model parameters as set in the configuration file.

      SWAN BUILDING MODEL 003.PNG

    6. Set the file path of the newly created configuration file in the model builder:
      SWAN BUILDING MODEL 004.PNG

      Define Model Domains

    7. Create a new grid layer by pressing the 'New Grid Layer' button. Save the new grid layer to C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\QGIS\SWAN_GRIDS_000.shp
      SWAN BUILDING MODEL 005.PNG

      When saved, the new layer will automatically be loaded and styled in the QGIS project.
    8. Create a new polygon for the first model grid in the newly created layer by following these steps:
      1. Select the newly created grid layer in the 'Grid Layer Input'
      2. Select the grid layer in the QGIS layers tree
      3. Unlock the grid layer for editing
      4. Digitise a polygon that covers the desired model extent, approximately [-29.5 -25] latitude and [152.5 156] longitude (it is recommended you use 'add rectangle from extent')

      Note: You don't need to exactly follow the polygons we have created, but please use them as a guide.
      For our model domain we will start with a relatively coarse mesh of Moreton Bay and the continental shelf and then add higher resolution through two levels of nesting.

      SWAN BUILDING MODEL 007.PNG

      When the feature is added to the layer, a new grid parameter input row will be created in the model builder, it will be blank as no parameters are set.

      SWAN BUILDING MODEL 008.PNG

      It is important once a grid layer has been selected that it, or any generated mesh layers, are not removed from the QGIS project as the SWAN GIS tools need to maintain a reference to the selected layer at all times. To prevent users accidentally removing the grid layer, it becomes 'locked' when selected such that users cannot remove it from the project until it is deselected.




    9. Apply the following values to populate the row:
      Name Rotation X Length Y Length
      REGIONAL 0 0.05 0.05

      On setting the values, a mesh of the computational grid will be automatically generated and displayed.

      SWAN BUILDING MODEL 009.PNG

    10. Repeat the above steps and add three more polygons, nesting them inside each other in similar locations as below and with the following names and parameters:
      Name Rotation X Length Y Length
      REGIONAL 0 0.050 0.050
      TRANSITION 0 0.025 0.025
      NORTH_MORETON 0 0.005 0.005
      POINT_LOOKOUT 0 0.005 0.005


      Approximate bounding box coordinates for each grid are provided as follows:

      Name X Min X Max Y Min Y Max
      REGIONAL 152.5 156.0 -29.5 -25.0
      TRANSITION 153.0 154.5 -28.3 -26.2
      NORTH_MORETON 153.1 153.5 -27.1 -26.7
      POINT_LOOKOUT 153.5 153.8 -27.7 -27.3


      Once you are happy with your model boundaries save your edits and toggle editing off.

      SWAN BUILDING MODEL 010.PNG

      Save Model Builder State

    11. We will now save the state of the model builder for demonstrative purposes. Press the 'save as button' and save your ini file to: C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\SWAN\BUILD.ini. Note this does not save the 'grid input layer'. This layer is edited and saved as per normal QGIS layer editing interface.
      SWAN BUILDING MODEL 011.PNG

    12. Open the newly created BUILD.ini file in a text editor. As shown, the BUILD.ini file is a simple text file which stores the input\output of the model builder for loading at a later time.
      SWAN BUILDING MODEL 012.PNG

      Load Bathymetry, Wind and Wave Datasets

    13. Load the bathymetry datasets described in the Getting Data section into QGIS. If following along with the tutorial these datasets should be within: C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\DATA\BATHY
    14. Use the bathymetry layer selector to add the Digital Terrain Models (DTM) one by one in increasing order of priority (layers on top of the list will will be overwritten by layers below where they overlap). The layers stored in this list are used to generate the bottom input files by interpolating values to the computational grid.
      SWAN BUILDING MODEL 013.PNG

    15. Set the wind source and wave source file inputs. These are references to the data files discussed in the Getting Data section. If following along with the tutorial these dataset should be within: C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\DATA\WIND and C:\Tutorial_Module_SWAN_GIS_Tools\Moreton_Bay_Waves\DATA\WAVE
      SWAN BUILDING MODEL 014.PNG

      Set the Time Period and Build Run

    16. Set the start and end dates to a period which is covered by the wind and wave data sources then press the 'Build Run' button. This will generate and save the SWAN model input and control files into our SWAN folder.
      Please note that the creation of the SWAN model files and geometry may take up to minute to complete.
      SWAN BUILDING MODEL 015.PNG

      Conclusion

      You have now successfully populated and run the SWAN GIS Model Builder panel. Next, we will review the various check files, boundary files and control files generated by the model build in the fourth step of our SWAN GIS tutorial.