Tutorial RiverineChannel Meshing GISMesher

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

Tutorial Description

In this tutorial, we will be building a mesh for an inbank area of a riverine channel using the Rising Water Software GIS Mesher (version 2022.01). Specifically, you will learn how to generate a mesh, apply multiple materials, and develop skills to help you refine your mesh. The GIS Mesher supports building meshes for TUFLOW FV using several approaches. For this tutorial, step by step instructions are given to get you started with the GIS mesher. The GIS Mesher will be used to create a simple model of a short section of river. We will build a mesh for an inbank area of a river which can be later used in [TBC HYPERLINK TO TUT].

The GIS Mesher works in coordination with your favourite GIS application and text editor to build meshes using command files similar to how TUFLOW FV files are utilised. For this workflow, we recommend using the QGIS TUFLOW Viewer for post-processing, however Aquaveo SMS may also be used. These instructions will use QGIS, but any GIS application that can build ESRI Shapefiles or Geopackage files can be used.

Please note that this tutorial has been created using the GIS Mesher version 2022.01 and QGIS version 3.26.2. You may use other versions of the QGIS, however some minor differences may exist between the screenshots in this tutorial and the software version you are using. If you run into any problems or need help, please contact support@tuflow.com

Tutorial Data

Download the [TBC] Tutorial Module 2 dataset from the TUFLOW Website: http://www.tuflow.com/FV%20TutorialModel.aspx
The folders provided in this tutorial include Module_Data, Complete_Mesh, and working. Copy these folders to where you would like to work with the project.

  • The Module_Data folder contains bathymetry data as a raster .tif dataset, land-use areas provided as a shapefile, the model domain provided as a polygonal shapefile, and the project projection file .prj,
  • The Complete_Mesh folder has the files for the completed tutorial, in case you get stuck, and
  • The working folder is for the files you create and work within.

Building the Mesh

Using our GIS application and the GIS Mesher, we will create the mesh from GIS layers. At a minimum, the GIS mesher requires a boundary to mesh within and target cell sizes and orientation. Nodestrings, materials, and elevations may also be assigned with the GIS Mesher. Some of these may also be assigned to the TUFLOW FV model using GIS layers. For this tutorial, we will use the GIS Mesher to accomplish the following:

  • Create the project using the GIS Mesher GUI
  • Define the model domain (boundary polygon)
  • Define the mesh sizes
  • Specify the nodestring locations
  • Add the Elevation data
  • Build the mesh using the GIS Mesher

Creating the Project

The GIS Mesher GUI provides tools for building projects, creating GIS files, running the mesher, and running TUFLOW FV. Follow the below steps to create the project:

Firstly, start up the GIS Mesher GUI. It should like like the figure below.
Select File > New Project from the menu.
River chan Newproj 00.png

In the New Project dialog box, select the following:
1. Specify the parent folder as the working folder in your tutorial folder (likely different than specified below).
2. Set the project name as Riverine_Channel.
3. Click on the [...] for the working projection and select the _projection.prj file from the Module_Data folder.
4. We will leave the GIS filetype as ESRI Shapefile.
5. For the Initial GIS files please check mesh_polylines, nodestrings, boundary and materials, then uncheck the remaining GIS filetypes.
6. Leave the filenames and other settings as default.

The dialog should look similar to the figure below. Click OK.

River chan projSetup 00.png

Creating a new project creates a set of folders and files that we will use as a starting point to build the model. The folder structure is shown in the figure below. The .GISmesher folder stores the project settings for the GIS Mesher GUI. The meshing folder will have the meshing control files and has subfolders for GIS and Tables. The GIS folder has the blank GIS files for the boundary, mesh polylines (used to define size information), and nodestrings which will be used in the meshing process. The Tables folder is used for an advanced meshing technique called solution guided meshing which we will not be using. The TUFLOW FV folder and subfolders contain a TUFLOW FV simulation that can be used as a starting point to build models. Some of the folders and files will be referred to later.

River chan folderSetup 00.png

[TBC remove space between TUFLOW FV folder]


Defining the model domain

Now that the project has been created, we need to fill in the layers that were created by the GIS Mesher GUI. We'll start with the model domain (boundary GIS layer).

To save time, the model boundary has been provided. Copy all the files that start with boundary_001 from the Module_Data folder, replacing the files of the same names in the Working\Riverine_Channel\meshing\GIS folder. This file is a GIS shapefile and its supporting files.

Define the mesh size information

The mesh size information can be specified on mesh points but we are going to use mesh polylines so we can elongate the cells in the direction of flow. Mesh polylines specify sizes as a size parallel to the polyline and a size perpendicular to the polyline.

To create the polylines and set the mesh sizes (QGIS instructions):

1. Open QGIS and add the file meshing\GIS\boundary_001.shp and meshing\GIS\mesh_polylines_001.shp using the Layer | Add Layer Command | Add Vector Layer option.

2. Select the mesh_polylines_001 layer in the layers panel and click the Toggle EditingTut 01 qgis editable 00.png button on the digitizing tab.
3. Select the Add a Line Feature Tut 01 digiLine 00.png button on the digitizing toolbar.
4. With Snapping Enabled Tut 01 EnableSnapping 00.png set the Enable Tracing offset to 10m. Now trace the eastern bank of the boundary to generate mesh polylines along the side of the model boundary.
Tut 02 trace offset.png.

5. Set the feature attributes as the following: sizePara to 24 (m) and sizePerp to 8 (m). This will make cells 24m in the direction of the polylines and 8m perpendicular.

6. To trace the western bank of the boundary firstly change the Enable Tracing offset to -10m and now trace the west bank of the boundary.

7. Set the feature attributes as the following: sizePara to 24 (m) and sizePerp to 8 (m). This will make cells 24m in the direction of the polylines and 8m perpendicular.

8. Turn off Enable Tracing in snapping toolbar.

9. Click the Save button and then Toggle Editing button on the digitizing toolbar.

Your project window should look similar to the below.
Tut 02 mesh polylines.png

Specify the nodestring locations

Now that we have told the mesher how to size the mesh cells, we need to identify the nodestring locations. We need a nodestring on the upstream (outflow) and downstream (inflow) boundary of the model domain.

To specify the nodestring locations (QGIS instructions):
1. Add the file Working\Riverine_Channel\meshing\GIS\nodestrings_001.shp to QGIS using the Layer | Add Layer | Vector Layer Command.
2. Select the nodestrings_001 layer in the layers panel and click the Toggle EditingTut 01 qgis editable 00.png button on the digitizing tab.
3. With snapping enabled Tut 01 EnableSnapping 00.png (snapping toolbar), Add a Line Feature Tut 01 digiLine 00.png across the boundary_001.shp at the model inflow (See figure below). Set the ID to 1 and specify T for External which forces the nodestring to follow the mesh boundary.
4. Repeat step 3 at the model outflow (see figure below). Set the ID to 2 and External to T.
5. Click the Save button and then the Toggle Editing button on the digitizing toolbar.

The figure below shows the direction and ID of your newly created nodestrings:

River boundary NS polylines 00.png

Add the Elevation data

We need to tell the GIS Mesher the elevation data to apply to the model. This is done by changing the meshing control file.

To specify the bathymetry for elevations:
1. Open the file Working\Riverine_Channel\meshing\Riverine_Channel_000.mcf in a text editor (Notepad++ is a free editor that has a lot of useful features).
2. Find the line that has Read Grid Zpts. The line starts with an exclamation mark (!), which comments it out. Remove the exclamation mark and change it to Read Grid Zpts == ..\..\..\Module_Data\rb_dem.tif, as shown in the figure below.

Tut 02 MCF GRID COMMANDS 00.png

Incorporate the materials information

Manning Roughness Coefficients are assigned to the mesh based upon a "material" type that is specified for each cell. The materials can be provided using a GIS polygon layer with IDs for each of the materials. A default material (generally the most prevalent) can be assigned in the GIS Mesher Control File to reduce the amount of digitizing required.

To reduce digitizing, the material polygons have been provided. From the Module_Data folder, copy materials_001 with the varied file extensions to Working\Riverine_Channel\meshing\GIS, and replace the existing materials file in GIS folder.

Open the Meshing Control File, Riverine_Channel_000.mcf in your text editor. Look for the line with the command Set Materials == 1, and ensure that this is set to 1. This command sets the default material ID.

Tut 02 set mat.png

If you load the materials data into your GIS application and colour by material ID, you should see something similar to the figure below. The Manning N values will be defined when setting up the TUFLOW FV model in TBC Tut 02 ADD HYPERLINK.

Tut 02 mat ID .png

Build the mesh using the GIS Mesher

Now we need to build the mesh from the GIS Mesher GUI. To do this:
1. In the Run Mesher tab, verify that the control file is Riverine_Channel_000.mcf.
2. Click Run. The text in the output should provide feedback on the meshing process and after a few seconds include the line GIS Mesher Finished Successfully.
River chan GUISetup 00.png
3. Load the file meshing\output\Riverine_Channel_000_cells.shp into your GIS Application to verify that the mesh appears correct.

The mesh should look something like the figure below if styled similarly based upon Z value. You can also symbolize the mesh based upon the MaterialID field to verify that these are set correctly.

Tut 02 cell mesher.png


Congratulations! You have successfully created a mesh using the GIS Mesher. Please find your new mesh file here: meshing\output\Riverine_Channel_000.2dm.

Refining the Mesh

Mesh generation is rarely done all at once. Meshes are refined as model results are reviewed to better capture hydraulic controls, to add refinement as needed, or coarsen the mesh to improve run times.

There are lots of ways to modify sizes in the GIS Mesher, including:

  • Change the size parameters on existing points or polylines.
  • Add additional size points or polylines - This can be useful if you want to refine an area and there is sufficient space for a size transition.
  • Use the Size Multiplier command to scale the sizes for an entire mesh points or mesh polylines layer.
  • Add a Size Multiplier GIS layer to scale the sizes attached to mesh points or mesh polylines.

We will use the Size Multiplier GIS layer to create a mesh with an area of refinement.

To set up the refined mesh, we firstly need to create the Size Multiplier GIS layer. Please follow the below steps:
1. In the GIS Mesher GUI, switch to the Create GIS tab.
2. Choose size_multipliers for the Type.
3. Now set the filename to sm_refinement_001.shp and leave the layername field blank.
4. Click Create file. The file will be created in the Working\tut02\meshing\GIS folder.

Tut 02 create sizemulti shp.png

Now load the created Size Multiplier GIS layer, boundary layer and DEM into QGIS:

  • .\Working\Riverine_Channel\meshing\GIS\sm_refinement_001.shp
  • .\Working\Riverine_Channel\meshing\GIS\boundary_001.shp
  • .\Module_Data\rb_dem.tif

We will now edit sm_refinement_001.shp and set the Size Multiplier values:

1. Select the sm_refinement_001 layer in the layers panel and click the Toggle EditingTut 01 qgis editable 00.pngbutton on the digitizing tab.
2. Create a polygon in approximately the same location shown in the figure below.
3. Set the MultiPri and MultiSec attributes both to 0.5. This will override the mesh sizing in the area to make the cells half as large in the primary (parallel to polyline) and secondary directions (perpendicular to the polylines).
4. Click the Save button and then Toggle Editing button on the digitizing toolbar.

Tut 02 mesh refinement parameters.png


We will now create the refined mesh:
1. Make a copy of the file Riverine_Channel_000.mcf in the Working\Riverine_Channel\meshing folder and name it Riverine_Channel_001.mcf
2. Open the new file Riverine_Channel_001.mcf in your text editor and add the line Read GIS Size Multipliers == GIS\sm_refinement_001.shp. The location in the file is not critical however after the global options and projection commands is recommended to keep those items at the top.
3. In the GIS Mesher, change to the Run Mesher tab and select the file Riverine_Channel_001.mcf and click Run. This will regenerate the mesh with refined area.
You should now have a new mesh file \.meshing\output\Riverine_Channel_001.2dm

Tut 02 runGUI fvc02.png

How does your first mesh (Riverine_Channel_000.2dm) compare to the new mesh (Riverine_Channel_001.2dm compare)? Remember you can review and compare your mesh configuration using the _Cells.shp file we opened in section [TBC insert hyperlink]. Can you see how you have refined your mesh?

Congratulations, you have completed the construction of a mesh using the GIS Mesher. Great work! This mesh can be used in [TBC Tutorial 02 (HYPER LINK)]

Conclusion

Congratulations on completing meshing a riverine channel using the Rising Water Software GIS Mesher. We've covered a lot in this tutorial, including mesh generation, application of multiple materials, and refining your mesh. You can now use your completed mesh in Tutorial 02 [TBC hyperlink].

To complete more tutorials or learn more tips and tricks, please return to the TUFLOW FV Wiki Mainpage.

We will continue to add more functionality over time, so please periodically review. If you wish to keep up to date with all things TUFLOW and TUFLOW FV, then please join our LinkedIn group.

If you have any queries, feedback or requests for new functionality, please feel free to get in contact with support@tuflow.com