TUFLOW SWMM Tutorial M01 development

From Tuflow
Jump to navigation Jump to search

NOTE

This tutorial is under development. The official version is at [1].

Introduction

In this module, three culverts are added to represent flow through three separate road embankments. EPA SWMM is used as the solution scheme for the 1D culvert flow calculations, dynamically linked with the TUFLOW HPC 2D solution scheme.

TUFLOW SWMM Tutorial Module 1 builds from the model created in TUFLOW Tutorial Module 2 (in the TUFLOW Only tutorial dataset). The completed TUFLOW Module 2 model is provided in the TUFLOW_SWMM_Module_01\TUFLOW folder of the download dataset as the starting point for this tutorial. If you are not already familiar with TUFLOW, we recommend first completing Module 1 and 2 of the "TUFLOW Only" Tutorials to establish an understanding of 2D modeling, before progressing to learning how to link 1D EPA SWMM to 2D TUFLOW.

Project Initialization

Three steps are required for the project initialization:

  1. Setting the QGIS Project Coordinate Reference System (CRS).
  2. Configuring the QGIS TUFLOW Plugin.
  3. Establishing the new TUFLOW model GeoPackage file that will include new GIS inputs associated with this model update.

QGIS

QGIS Version 3.34 or newer, and QGIS TUFLOW Plugin 3.11 or newer are required to access the SWMM Processing Tools described in the following sections. For installation, see Installation of TUFLOW Plugin.
Firstly, define the Coordinate Reference System (CRS), also called ‘Projection’, for the QGIS workspace:

  1. Open QGIS.
  2. Go to Project > Properties…
  3. In the CRS tab, type ‘WGS 84 / UTM Zone 60S’.
  4. Select the matching projection in the 'Predefined Coordinate Reference Systems' section.
  5. Click ‘Apply’ and ‘OK’.
  6. Ensure that the projection is set correctly by viewing the bottom right hand corner of the workspace. It should read ‘EPSG:32760’.



TUFLOW Model

Load and Style TUFLOW Model Files

Load and Style the GIS layers from the TUFLOW model:

  1. Click on the ‘Load TUFLOW Layers from TCF’ symbol from the TUFLOW Plugin toolbar.
    Tuflow plugin load tcf layers.png

  2. Navigate to the TUFLOW_SWMM_Module_01\TUFLOW\runs folder and select M02_5m_001.tcf.
  3. In the Load Layers window, select:
    • Ordering Options: Alphabetical
    • Grouping Options: Group by control file
    • Raster Load Options: Load Normally
  4. Click ‘Open’ and ‘OK’.


Style the TUFLOW layers however you desire. Common steps to do this are:

  1. Click on the ‘Apply TUFLOW Styles to Open Layers’ symbol from the TUFLOW Plugin toolbar.
    Tuflow plugin styles open layers.png

  2. Change the symbology of the DEM:
    • Right click on the DEM file in the QGIS Layers Panel and select 'Properties'.
    • From the Symbology tab, under 'Band Rendering' select the following options:
    • Render type: Singleband pseudocolor
    • Color ramp: Spectral
    • Color ramp: Invert Color Ramp
    • Mode: Equal Interval
    • From the Transparency tab, set the Global Opacity to 75%.
    • Click 'Apply' and 'OK'.


  3. Create a hillshade of the DEM:
    • Right click on the DEM file in the QGIS Layers Panel and select 'Duplicate Layer'.
    • Right click on the DEM_copy and select 'Rename Layer'. Rename the layer to DEM_Hillshade.
    • Right click on the DEM_Hillshade and select 'Properties'.
    • From the Symbology tab, under 'Band Rendering' select the following options:
    • Render type: Hillshade
    • Z Factor: 3
    • Click 'Apply' and 'OK'.


TUFLOW Plugin

Next we need to configure the QGIS TUFLOW Plugin settings to link with the project folder where we will build our model:

  1. Open the 'Configure TUFLOW Project' tool by selecting Plugins > TUFLOW > Editing > Configure / Create TUFLOW Project.
  2. Set the CRS (Coordinate Reference System) by selecting one of the vector layers associated with the opened model using the drop menu list. For example, 2d_bc_M01_001_L.
  3. To set the location of the TUFLOW folder, click 'Browse...' and navigate to the TUFLOW_SWMM_Module_01 folder. Click 'Select Folder'.
  4. To set the location of the TUFLOW single precision executable file, click 'Browse...' and navigate to the exe\2023-03-AF folder. Select TUFLOW_iSP_w64.exe and click 'Open'.
  5. Select 'GPKG' as the GIS Format.
  6. Select 'TUFLOW Classic / HPC' as the TUFLOW Engine.
  7. Tick on 'Save Default Settings Globally'.
  8. Click 'OK'.

    TS1 Configure Project 01a.png


Increment Model GeoPackage File

We will now save a copy of M02_001.gpkg with a new name, TS01_001.gpkg. This project initialization step is recommended so prior model versions from a project are not broken as a result of changes being made to GIS inputs.

  1. In the QGIS Layers Panel, select (left click) 2d_bc_M01_001_L.
  2. Click on the 'Increment Selected Layer' symbol from the TUFLOW Plugin toolbar. This opens the dialog shown below.
    Tuflow plugin increment layer.png

    • Source Layer: Automatically set to the selected layer, 2d_bc_M01_001_L.
    • Output Database: Click 'Browse...'. This will automatically open to the TUFLOW\model\gis folder. Set the new output database name to TS01_001.gpkg and click 'Save'.
    • Output Layer Name: This will automatically increment to 2d_bc_M01_002_L. Change the name back to 2d_bc_M01_001_L.
    • Delete the pre-filled 'Incremented Layer' entry in the table. We do not wish to modify the version number associated with the 2d_bc file. This current exercise will not change the version number of any of the GIS layer inputs, it is simply establishing a copy of the existing GeoPackage where future edits will be saved to.
    • Select 'Remove Source Layer from Workspace'.
    • Select 'Increment Layer and Preserve Database'.
  3. Click 'OK'.
  4. The GeoPackage database, TS01_001.gpkg will now be in the TUFLOW_SWMM_Module_01\TUFLOW\model\gis folder.


Save QGIS Project Workspace

  1. Go to Project > Save As.
  2. Navigate to the TUFLOW_SWMM_Module_01 folder and type SWMM_M01 as the filename with the extension .qgz.


GIS Inputs

Create SWMM GeoPackage Spatial Database

Create a new folder in the TUFLOW_SWMM_Module_01\TUFLOW\model folder called swmm. This is the location where all SWMM inputs will be saved.

In QGIS, create the SWMM GeoPackage Database:

  1. Go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
  2. Go to TUFLOW >> SWMM in the processing tool list and select 'GeoPackage - Create'. This opens the dialog shown below.
    • To set the ‘CRS for GeoPackage’: Click the drop down menu and select ‘Project CRS: EPSG:32760 - WGS 84 / UTM zone 60S’.
    • To set the ‘Initial SWMM Sections’: Click …, and tick on (if not already ticked):
    • Project--Title, Project--Options, Project --Report.
    • Nodes--Junctions, Nodes--Outfalls., Nodes--Storage.
    • Links--Conduits, Links--Streets.
    • To define the ‘GPKG filename to create’: Click …, select ‘Save to File’. Navigate to the TUFLOW\model\swmm folder and save the GeoPackage database as sw01_001.gpkg.
  3. Click ‘Run’.
  4. Once the tool has finished, click ‘Close’.
  5. In Windows File Explorer, navigate to the TUFLOW\model\swmm folder and drag and drop sw01_001.gpkg into QGIS.
  6. When prompted by QGIS, under 'Options', tick on 'Add layers to group', then select 'Add Layers' to open all vectors within sw01_001.gpkg. By default, all items in the available list should have been selected.
  7. In the QGIS Layers Panel, move sw01_001.gpkg to the top of the list. This will ensure the data within this database file is displayed above all other layers in the project.




GIS Data Entry

A GeoPackage database called SWMM_Culverts.gpkg is provided in the TUFLOW_SWMM_Module_01\Tutorial_Data folder. It contains three layers:

  • Conduits: defines the culvert location, type and geometry.
  • Outfalls: defines the downstream culvert inverts.
  • Storage_nodes: defines the upstream culvert inverts.


To populate the GeoPackage database created in the previous section:

  1. In Windows File Explorer, navigate to the TUFLOW_SWMM_Module_01\Tutorial_Data folder. Drag and drop the SWMM_Culverts.gpkg into QGIS.
  2. When prompted by QGIS, under 'Options', tick on 'Add layers to group'. By default, all items in the GeoPackage database will be selected. Click 'Add Layers'.
  3. In the QGIS Layers Panel, right click on the SWMM_Culverts >> Conduits layer and select 'Zoom to Layer(s)'.
  4. Use the 'Select Features' tool to highlight all items included in Conduits.
  5. Select 'Edit' from the top QGIS tab and 'Copy Features' from the drop down menu.
  6. In the QGIS Layers Panel, select (left click) the sw01_001.gpkg >> Links--Conduits layer.
  7. Make the Links--Conduits layer editable by clicking the 'Toggle Editing' symbol Toggle editing icon.png.
  8. Select 'Edit' from the top QGIS tab and click 'Paste Features' from the drop down menu.
  9. Toggle the editing off to save the edits.


  10. Similarly, copy the objects from Storage_nodes into Nodes--Storage. Junctions and storage nodes are allowed at the upstream end of culverts. Storage nodes are preferred for culverts receiving 2D flows not through a storm drain inlet.
  11. Also copy the objects from Outfalls into Nodes--Outfalls. Outfalls are treated as outlets, and are required at the downstream end of culverts.
  12. Toggle off editing and save the edits.
  13. Remove SWMM_Culverts.gpkg.


  14. Inspect the attribute information within the respective layers to familiarize yourself with the data.


GIS Data Updates

The provided GIS data requires numerous updates before proceeding to a model simulation. We have intentionally built these updates into this tutorial to demonstrate some of the available TUFLOW SWMM model build processing tools. The following updates are being made to objects and layers within sw01_001.gpkg.

Update Conduit Details

Node Details

Stage 1 of building the 1D SWMM network involves updating the 'From Node' and 'To Node' attribute information in Links--Conduits. This information defines the Link/Node connections.
The information we will be adding to Links--Conduits is extracted from Nodes--Storage and Nodes--Outfalls automatically using the 'Conduits - Assign node fields' tool from the Processing Toolbox.

  1. In the QGIS Layers Panel, select (left click) Links--Conduits and toggle on editing.
  2. In the Processing Toolbox, select the 'Edit Features In-Place' tool Edit features in place icon.png. This allows the editing of an existing layer, instead of the creation of a new layer.
  3. Go to TUFLOW >> SWMM in the processing tool list and select 'Conduits - Assign node fields'. This opens the dialog shown below.
    • SWMM Node Layers: Tick on sw01_001 >> Nodes--Storage and sw01_001 >> Nodes--Outfalls. Click 'OK'.
  4. Select 'Modify All Features'.
  5. Once the tool has finished, click 'Close'.
  6. Turn off editing to save the edits.
  7. View the attributes associated within Links--Conduits to verify the data processing has been completed correctly. The 'From Node' and 'To Node' attribute information is now configured correctly. For a broader understanding of the other attributes associated with the Links--Conduits layer, refer to TUFLOW 2023-03-AD Release Notes (Table A.19) and the SWMM Reference Manual - Volume 2 (Hydraulics).

    Tip 1: If you wish to only update a selection of objects, instead of selecting the entire Links--Conduits dataset, select the target objects first using the 'Select Features' tool. The 'Conduits - Assign node fields' tool will provide an option to 'Modify Selected Features', instead of 'Modify All Features.'
    Tip 2: Unique Node ID's are required for the SWMM network to function error free. If you are following this workflow for a project model build, please ensure the Nodes--Storage and Nodes--Outfalls object ID information is unique. If duplicate ID values are assigned to multiple objects, consider using the 'Integrity - Make object names unique ' TUFLOW SWMM processing tool to ensure all ID values are unique before using 'Conduits - Assign node fields'.



Update Losses

Stage 2 involves updating the loss attributes in the Links--Conduits layer. In this example, default loss values are used and will be entered manually. These loss values can be adjusted in your project models to reflect site specific information if desired.

  1. In the QGIS Layers Panel, select (left click) Links--Conduits and toggle on editing.
  2. Right click Links--Conduits and select 'Open Attribute Table'.
  3. For each conduit, update the following fields:
    • losses_Kentry: 0.5
    • losses_Kexit: 1.0
    • losses_Kavg: 0.0
    The video below demonstrates how to do this one entry at a time, or via the bulk attribute update options in QGIS.
  4. Turn off editing to save the edits.


Since all the 1D SWMM inputs in this model are embankment culverts that all use the same loss parameters, it's not necessary to specify different loss attributes. The TUFLOW SWMM Module 2 will demonstrate an urban pipe network added to the model, with different loss attributes required for the road culverts and underground storm pipe network links. To simplify this step, Module 2 uses the 'Conduits - Assign node fields' processing tool.

Create 1D/2D Connections

The following instructions introduce a new tool that automates the creation of 1D/2D connections. Due to the limitations of SWMM boundary conditions, HX lines are required for the upstream end of the culvert (rather than SX), and SX connections are used at the downstream end of the culvert.

  1. In the QGIS Layers Panel, select (left click) Links--Conduits.
  2. In the Processing Toolbox, go to TUFLOW >> SWMM and select 'BC - Create channel endpoint 1D/2D connections'. This opens the dialog shown below.
    Note: Ensure the 'Edit Features In-Place' tool has been turned off.
    • Input Conduits Layer: Links--Conduits
    • Create connections at: 'Both ends'.
    • Offset Distance: 2
    • Length of BC lines: 10
    • Tick on 'Set 2D cell elevation to 1D culvert invert at 1D/2D connection cells if needed'.
    • Output Layer:
    1. Click the ... and select 'Save to GeoPackage'.
    2. Navigate to the TUFLOW\model\gis folder and select TS01_001.gpkg. Click Save.
    3. A dialog will open. In the Layer name field, write 2d_bc_SWMM_Culvert_Connections_001_L.
    4. Click 'OK'.
  3. Click 'Run'.
  4. Once the tool is finished, click 'Close'.
  5. The 2d_bc_SWMM_Culvert_Connections_001_L appears in the QGIS Layers Panel. Select 'Apply TUFLOW Styles to Current Layer'.


Note: The positions of the HX and SX connections may not be in the optimum location or extent using the generalized automated tool. As such, it is recommended to check the output from this processing step. In this module, the 1D/2D connections associated with 2d_bc_SWMM_Culvert_Connections_001_L are checked in TUFLOW SWMM Tutorial 01 Check Files.

Update Storage Node Details

The attributes of the storage nodes need to be modified to represent the storage of the connected HX cells since these cells do not represent storage themselves. The area associated with the storage nodes should be similar to the areas of the HX cells. To set the area, we will use a "PYRAMIDAL" shape with SWMM side slope (run/rise) set to 0 to represent vertical walls. As the cell size is 5m, and the length of each polyline is 10m, the length will be set to 10m and the width to 5m. These sizes will be modified later when we change the boundary conditions.

  1. In the QGIS Layers Panel, select (left click) Nodes--Storage and toggle on editing.
  2. Right click Nodes--Storage and select 'Open Attribute Table'.
  3. Set the following attributes:
    • YMax: 50.0 (this is a value greater than the expected water level. It is required to allow water to fill node)
    • TYPE: 'PYRAMIDAL'
    • L: 10
    • W: 5
    • Z: 0.0
  4. Turn off editing to save the edits.  


SWMM Options

  1. In the QGIS Layers Panel, select (left click) Project--Options and toggle on editing.
  2. Right click Project--Options and select 'Open Attribute Table'.
  3. Update the following options:
    • START_DATE: 2020-01-01 (Date Format: YYYY-MM-DD)
    • REPORT_STEP: 00:01:00
  4. Turn off editing to save the edits.



Save the QGIS Project Workspace:

  1. Go to Project > Save. This will update SWMM_M01.qgz, which was created previously in the folder TUFLOW_SWMM_Module_01.

Export SWMM INP File

SWMM is not able to read the sw01_001.gpkg database directly, therefore, we need to convert the GeoPackage file to a SWMM INP file format.

  1. Right-click Links--Conduits (or any of the SWMM layers) and select 'TUFLOW' > 'SWMM - Export inp file'.
  2. This will open the 'GeoPackage - Write to SWMM inp' processing tool, prepopulated with the filename of the layer's GeoPackage.
    Note: This tool can also be activated from the Processing Toolbox.
  3. Click 'Run'.
  4. Once the tool is finished, click 'Close'.
  5. This tool will save the SWMM inp file in the same folder location and with the same name as the GeoPackage input file. In this case, it will save sw01_001.inp to the TUFLOW\model\swmm folder.


Simulation Control Files

The following steps will require use of a text editor. The tutorial demonstration uses Notepad++. For its configuration information refer to Notepad++ Tips.

To differentiate the TUFLOW SWMM tutorials from the TUFLOW/ESTRY tutorials, 'TS' is used as the file prefix in this series of tutorials. To avoid the potential risk of overwriting existing control files accidentally, we will start by saving new control files where we will be making subsequent syntax updates during the following steps.

Set up the simulation control files:

  1. In Windows File Explorer, navigate to the TUFLOW_SWMM_Module_01\TUFLOW\runs folder and open M02_5m_001.tcf in a Text Editor (Notepad++ is recommended).
  2. Save the file as TS01_5m_001.tcf in the TUFLOW_SWMM_Module_01\TUFLOW\runs folder.
  3. Open M01_001.tbc using the 'Open File' function in Notepad++. Save the file as TS01_001.tbc in the TUFLOW_SWMM_Module_01\TUFLOW\model folder.
  4. Create a new blank text file called TS01_001.tscf and save it in the TUFLOW_SWMM_Module_01\TUFLOW\model folder.


TUFLOW Control File (TCF)

  1. Open TS01_5m_001.tcf in a Text Editor (Notepad++ is recommended) and make the following reference updates:
    Spatial Database == ..\model\gis\TS01_001.gpkg  ! Specify the location of the GeoPackage Spatial Database
    BC Control File == ..\model\TS01_001.tbc ! Reference the TUFLOW Boundary Conditions Control File
  2. Add the following line in the 'Model Inputs' section:
    SWMM Control File == ..\model\TS01_001.tscf ! Reference the SWMM (1D) Control File
  3. Add the following line in the 'Output Settings' section:
    NetCDF Output Start Date == 2020-01-01 00:00 ! Sets the output units for the NetCDF time variable
  4. Save the TCF.


TUFLOW Boundary Control File (TBC)

  1. From TS01_001.tcf, right click TS01_001.tbc and select 'Open File'. This opens TS01_001.tbc into a new tab in Notepad ++.
  2. Add the following command line after 'Read GIS SA == 2d_sa_M01_001_R':
    Read GIS BC == 2d_bc_SWMM_Culvert_Connections_001_L ! Links 1D SWMM culverts to the 2D TUFLOW domain
  3. Save the TBC.


TUFLOW SWMM Control File (TSCF)

A new control file, the TUFLOW SWMM Control File (TSCF), is used to control the SWMM input data. All 1D SWMM files and commands are referenced in the TUFLOW SWMM Control File.

  1. From TS01_001.tcf, right click TS01_001.tscf and select 'Open File'. This opens TS01_001.tscf into a new tab in Notepad ++.
  2. Add the following command:
    Read SWMM == swmm\sw01_001.inp ! 1D SWMM culvert input file
  3. Save the TSCF.



Running the Simulation

  1. Save a copy of _run_M02_HPC.bat as _run_TS01_HPC.bat in the TUFLOW_SWMM_Module_01\TUFLOW\runs folder.
  2. Update the batch file to reference the TS01_5m_001.tcf :
    set exe="..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"
    set run=start "TUFLOW" /wait %exe% -b
    %run% TS01_5m_001.tcf
  3. Save the batch file and double click it in Windows File Explorer to run the simulation.
    If the model simulation doesn't run:
    1. Check in the screen output or the tlf file near the end for "For SWMM Model Errors see:". This indicates that there is something wrong with the SWMM inputs. Reviewing that file will provide feedback on what is wrong.
    2. Review this link for common TUFLOW SWMM Troubleshooting advice.




Check Files and Results Output

Complete the steps outlined in following links to review check files and simulation results from the TUFLOW SWMM model simulation:

TUFLOW SWMM Tutorial 01 Check Files
TUFLOW SWMM Tutorial 01 Results

Conclusion

  • EPA SWMM culverts were added to convey water through the structures under the three roads in the tutorial model.
  • Check files were used to review the inclusion of 1D SWMM culverts to a 2D TUFLOW model.
  • Results through the 1D culverts were assessed.


Other TUFLOW SWMM Tutorials

Up
Go-up.png Return to TUFLOW SWMM Tutorial Introduction Main Page