Meshing M02 GIS Mesher: Difference between revisions

From TUFLOW FV Wiki
Jump to navigation Jump to search
(Created page with "MB to create me:)")
 
No edit summary
Line 1: Line 1:
MB to create me:)
{| class="wikitable" align="right"
| colspan="3" style="text-align:center;" | '''USEFUL LINKS'''
|-
| width="220pt" style="text-align:center;" | '''Wiki Links'''
| width="220pt" style="text-align:center;" | '''Help'''
| width="220pt" style="text-align:center;" | '''Downloads'''
|-
| [http://fvwiki.tuflow.com/index.php?title=Main_Page ''TUFLOW FV Wiki Main Page'']
| ''[[Contact|Products Support/Contact]]''
| [https://www.tuflow.com/downloads/ ''TUFLOW FV Downloads'']
|-
| ''[[Tutorial Model Introduction|TUFLOW FV Tutorials]]''
| ''[[Requesting a Licence]]''
| [https://www.tuflow.com/downloads/tuflow-fv-models/ ''Tutorial Module Data'']
|-
| [https://wiki.tuflow.com/index.php?title=Main_Page ''TUFLOW Classic/HPC Wiki'']
| ''[[TUFLOW FV Glossary|TUFLOW FV Glossary]]''
| [https://www.tuflow.com/downloads/ ''Manuals'']
|}
 
= Tutorial Description =
In this tutorial, we will be building a mesh for an inbank area of a riverine channel using the GIS Mesher. Specifically, you will learn how to generate a mesh, apply multiple materials, apply boundary conditions and develop skills to help you refine your mesh. By the following steps outlined in this tutorial, you will create a computational mesh using the GIS Mesher. The mesh files you create in this tutorial can be used in [https://fvwiki.tuflow.com/index.php?title=Tutorial_M02_GIS_Mesher Tutorial Module 02 with GIS Mesher].
<br>
Specifically in this tutorial you will:<br>
* Generate a mesh<br>
* Apply materials to your mesh<br>
* Insert nodestrings to define the location of boundary conditions using the SMS TUFLOW FV Interface <br>
 
TUFLOW FV doesn't have its own graphical user interface (GUI), it uses GIS software, GIS Mesher software, and a text editor for its model creation and result viewing. As such, it is very efficient and flexible and doesn't have the same data load/visualisation limitations using big datasets as other modelling software GUIs.
Please note this tutorial has been created using GIS Mesher 2023.01. If using a different version of the GIS Mesher GUI, some of the dialogue boxes and screen shots may change slightly, however the overall workflow should be similar. If you run into any problems or need help, please contact [mailto:support@tuflow.com support@tuflow.com]. <br>
 
=Requirements and Downloads=
{| class="wikitable" width="75%"
 
! style="background-color:#005581; font-weight:bold; color:white;"| Requirement
! style="background-color:#005581; font-weight:bold; color:white;" | Brief Description
! style="background-color:#005581; font-weight:bold; color:white;" | Download
|-
| '''GIS Mesher''' || The GIS Mesher developed by Rising Water Software builds meshes for hydrodynamic models that use a combination of quadrilateral and triangular meshes. Spatial data is provided to the mesher as GIS layers, so that you can use your favorite GIS application to build quality meshes quickly and easily. Solution guided meshing uses results from initial mesh solutions to iteratively improve meshes. Making it easy to generate good meshes for even complicated hydrodynamic <br>
 
This tutorial was developed using GIS Mesher version 2023.01, it recommended to use this version or later versions of GIS Mesher. If using a different version of the GIS Mesher, some of the dialogue boxes and screen shots may change slightly, however the overall workflow should be similar. If you run into any problems or need help, please contact [mailto:support@tuflow.com support@tuflow.com]''. <br>
 
|| GIS Mesher downloads and release notes can be found here <u>[https://www.risingwatersoftware.com/installation/ GIS Mesher]</u>.
|-
 
| '''QGIS''' <br><br>QGIS TUFLOW plugin || The geographic information system (GIS) QGIS will be used in this tutorial to build the mesh. This tutorial was developed with QGIS 3.26.2, it is recommended to use this version or later versions. If using a different version of QGIS, some of the dialogue boxes and screen shots may change slightly.
 
The TUFLOW plugin includes numerous tools to increase workflow efficiency. <br>
 
|| QGIS can be download from <u>[https://qgis.org/en/site/forusers/download.html Latest 64-bit version of QGIS]</u>.  <br><br>
 
<u>[https://wiki.tuflow.com/TUFLOW_QGIS_Plugin QGIS TUFLOW Plugin Installation]</u>.
 
|-
| '''Model Data''' || The data provided for the completion of this tutorial includes: <br>
* The Module_Data folder which contains the bathymetry data as a raster (.tif) dataset, land-use areas provided as a shapefile (.shp), the model domain provided as a polygon shapefile (.shp) and a projection file (.prj)
* The Complete_Mesh folder that contains the files for the completed tutorial in case you get stuck, and <br>
* A working folder is provided for the files you create and work within. <br>
||<u>[https://www.tuflow.com/downloads/tuflow-fv-models/ TUFLOW FV Tutorial Models]</u>. <br><br>
 
|-
| '''Assumed Knowledge''' || No prior knowledge is required for the completion of this tutorial. We have designed this tutorial to provide an introduction to meshing for all modelling levels. If you run into any problems or need help, please contact [mailto:support@tuflow.com support@tuflow.com]
 
|}
 
= Model Setup =
The following tutorial demonstrates the development of a simple model mesh using the GIS Mesher. The GIS Mesher supports the building of meshes for TUFLOW FV. For this tutorial, step by step instructions are given to get you started with meshing using the GIS Mesher. This example problem demonstrates the development of a basic model mesh. Follow the steps performed here and expand upon them to develop more complex, real-world models. The example is an inbank riverine channel. <br>
 
Specifically, you will use the GIS Mesher to:
* 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
* Add materials to the mesh
* Build the mesh using the GIS Mesher
 
 
By now you should have downloaded the Meshing M02 Tutorial GIS Mesher Model data from [https://www.tuflow.com/downloads/tuflow-fv-models/ TUFLOW FV Tutorial Models]. This includes the '''Module_Data''', '''Complete_Model''' and '''working''', please copy these folders to your preferred working location.
 
=== 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:<br>
 
Firstly, start up the GIS Mesher GUI. It should like like the figure below. <br>
Select '''File > New Project''' from the menu. <br>
[[File:River_chan_Newproj_00.png|500px]]
<br>
<br>
In the New Project dialog box, select the following: <br>
'''1.''' Specify the parent folder as the '''working''' folder in your tutorial folder (likely different than specified below). <br>
'''2.''' Set the project name as '''Riverine_Channel'''. <br>
'''3.''' Click on the '''[...]''' for the working projection and select the '''_projection.prj''' file from the '''Module_Data''' folder. <br>
'''4.''' We will leave the GIS filetype as '''ESRI Shapefile'''. <br>
'''5.''' For the Initial GIS files please check '''mesh_polylines''', '''nodestrings''', '''boundary''' and '''materials''', then uncheck the remaining GIS filetypes. <br>
'''6.''' Leave the filenames and other settings as default. <br>
<br>
The dialog should look similar to the figure below '''Click OK'''.
 
[[File:River_chan_projSetup_00.png|500px]]
<br>
<br>
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 TUFLOWFV simulation that can be used as a starting point to build models. Some of the folders and files will be referred to later.
 
[[File:Trap_chan_folderstructure_01.png]]
<br>
 
=== 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): <br>
 
'''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. <br>
 
'''2.''' Select the '''mesh_polylines_001''' layer in the layers panel and click the '''Toggle Editing'''[[File:tut_01_qgis_editable_00.png]] button on the digitizing tab. <br>
'''3.''' Select the '''Add a Line Feature''' [[File:tut_01_digiLine_00.png]] button on the digitizing toolbar. <br>
'''4.''' With '''Snapping Enabled''' [[File: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. <br> [[File:tut_02_trace_offset.png]]. <br>
 
'''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. <br>
 
'''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. <br>
 
'''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. <br>
 
'''8.''' Turn off '''Enable Tracing''' in snapping toolbar. <br>
 
'''9.''' Click the '''Save''' button and then '''Toggle Editing''' button on the digitizing toolbar. <br>
 
Your project window should look similar to the below. <br>
[[File:tut_02_mesh_polylines.png|800px]]
 
=== 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. <br>
 
To specify the nodestring locations (QGIS instructions):<br>
'''1.''' Add the file '''Working\Riverine_Channel\meshing\GIS\nodestrings_001.shp''' to QGIS using the '''Layer | Add Layer | Vector Layer''' Command. <br>
'''2.''' Select the '''nodestrings_001''' layer in the layers panel and click the '''Toggle Editing'''[[File:tut_01_qgis_editable_00.png]] button on the digitizing tab. <br>
'''3.''' With '''snapping enabled''' [[File:tut_01_EnableSnapping_00.png]] (snapping toolbar), '''Add a Line Feature''' [[File: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.<br>
'''4.''' Repeat step 3 at the model outflow (see figure below). Set the ID to '''2''' and External to '''T'''.<br>
'''5.''' Click the '''Save''' button and then the '''Toggle Editing''' button on the digitizing toolbar.<br>
 
The figure below shows the direction and ID of your newly created nodestrings: <br>
 
[[File: River_boundary_NS_polylines_00.png|800px]]
<br>
 
=== 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: <br>
'''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).<br>
'''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.<br>
 
[[File:Tut_02_MCF_GRID_COMMANDS_00.png]]
<br>
 
=== 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.
 
[[File: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 [https://fvwiki.tuflow.com/index.php?title=Tutorial_M02_GIS_Mesher Tutorial Module 02 with GIS Mesher].
 
[[File: tut_02_mat_ID_.png|800px]]
 
=== Build the mesh using the GIS Mesher ===
Now we need to build the mesh from the GIS Mesher GUI. To do this:<br>
'''1.''' In the '''Run Mesher''' tab, verify that the control file is '''Riverine_Channel_000.mcf'''.<br>
'''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.''<br>
[[File:River_chan_GUISetup_00.png]] <br>
'''3.''' Load the file '''meshing\output\Riverine_Channel_000_Cells.shp''' into your GIS Application to verify that the mesh appears correct.<br>
 
This shapefile provides a representation of the mesh file. This should look something like the figure below if styled similarly based upon '''Z''' value and coloured using the Viridis color ramp. You can also symbolize the mesh based upon the '''MaterialID''' field to verify that these are set correctly.
 
[[File:tut_02_cell_mesher.png|800px]]
<br>
 
 
The '''Riverine_Channel_000.2dm''' file located in .\meshing\output\ is the meshing input file for TUFLOW FV. This '''.2dm''' file will later become the geometry input file for the TUFLOW FV tutorial model in [https://fvwiki.tuflow.com/index.php?title=Tutorial_M02_GIS_Mesher Tutorial Module 02 with GIS Mesher]. Congratulations on building your first mesh. <br>
 
== 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: <br>
::* Change the size parameters on existing points or polylines. <br>
::* 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. <br>
::* Use the Size Multiplier command to scale the sizes for an entire mesh points or mesh polylines layer. <br>
::* Add a Size Multiplier GIS layer to scale the sizes attached to mesh points or mesh polylines. <br>
 
We will use the Size Multiplier GIS layer to create a mesh with an area of refinement.<br>
 
To set up the refined mesh, we firstly need to create the Size Multiplier GIS layer. Please follow the below steps: <br>
'''1.''' In the GIS Mesher GUI, switch to the '''Create GIS''' tab. <br>
'''2.''' Choose '''size_multipliers''' for the Type. <br>
'''3.''' Now set the filename to '''sm_refinement_001.shp''' and leave the layername field blank. <br>
'''4.''' Click '''Create file'''. The file will be created in the Working\tut02\meshing\GIS folder. <br>
 
[[File:tut_02_create_sizemulti_shp.png|550px]]  <br>
 
Now load the created Size Multiplier GIS layer, boundary layer and DEM into QGIS:
:* '''.\Working\Riverine_Channel\meshing\GIS\sm_refinement_001.shp'''<br>
:* '''.\Working\Riverine_Channel\meshing\GIS\boundary_001.shp'''<br>
:* '''.\Module_Data\rb_dem.tif'''<br>
 
We will now edit sm_refinement_001.shp and set the Size Multiplier values: <br>
 
'''1.''' Select the '''sm_refinement_001''' layer in the layers panel and click the '''Toggle Editing'''[[File:tut_01_qgis_editable_00.png]]button on the digitizing tab.<br>
'''2.''' Create a polygon in approximately the same location shown in the figure below. <br>
'''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). <br>
'''4. ''' Click the Save button and then Toggle Editing button on the digitizing toolbar. <br>
 
[[File:tut_02_mesh_refinement_parameters.png|800px]] <br>
 
We will now create the refined mesh: <br>
'''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''' <br>
'''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.<br>
'''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.<br>
You should now have a new mesh file \.meshing\output\Riverine_Channel_001.2dm <br>
 
[[File:tut_02_runGUI_fvc02.png]] <br>
 
Open the _Cells.shp, remeber we did this in step 3 of [https://fvwiki.tuflow.com/index.php?title=Meshing_M02_Tutorial_GIS_Mesher#Build_the_mesh_using_the_GIS_Mesher Build the mesh using the GIS_Mesher]. Can you see where you have refined your mesh? How does your first mesh Riverine_Channel_000.2dm compare to the new mesh Riverine_Channel_001.2dm compare?
How does your first mesh Riverine_Channel_000 compare to the new mesh Riverine_Channel_001 compare?
 
The '''Riverine_Channel_001.2dm''' file located in .\meshing\output\ is the meshing input file for TUFLOW FV. Congratulations, you have completed the construction of a mesh using the GIS Mesher. Great work! This '''.2dm''' file will later become the geometry input file for the TUFLOW FV tutorial model in [https://fvwiki.tuflow.com/index.php?title=Tutorial_M02_GIS_Mesher Tutorial Module 02 with GIS Mesher].
 
==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 [https://fvwiki.tuflow.com/index.php?title=Tutorial_M02_GIS_Mesher Tutorial Module 02 with GIS Mesher].
 
To complete more tutorials or learn more tips and tricks, please return to the [[Main Page|TUFLOW FV Wiki Mainpage]]. <br>
 
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 [https://www.linkedin.com/groups/1908583 our LinkedIn group]. <br>
 
If you have any queries, feedback or requests for new functionality, please feel free to get in contact with support@tuflow.com

Revision as of 14:25, 24 May 2023

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 GIS Mesher. Specifically, you will learn how to generate a mesh, apply multiple materials, apply boundary conditions and develop skills to help you refine your mesh. By the following steps outlined in this tutorial, you will create a computational mesh using the GIS Mesher. The mesh files you create in this tutorial can be used in Tutorial Module 02 with GIS Mesher.
Specifically in this tutorial you will:

  • Generate a mesh
  • Apply materials to your mesh
  • Insert nodestrings to define the location of boundary conditions using the SMS TUFLOW FV Interface

TUFLOW FV doesn't have its own graphical user interface (GUI), it uses GIS software, GIS Mesher software, and a text editor for its model creation and result viewing. As such, it is very efficient and flexible and doesn't have the same data load/visualisation limitations using big datasets as other modelling software GUIs. Please note this tutorial has been created using GIS Mesher 2023.01. If using a different version of the GIS Mesher GUI, some of the dialogue boxes and screen shots may change slightly, however the overall workflow should be similar. If you run into any problems or need help, please contact support@tuflow.com.

Requirements and Downloads

Requirement Brief Description Download
GIS Mesher The GIS Mesher developed by Rising Water Software builds meshes for hydrodynamic models that use a combination of quadrilateral and triangular meshes. Spatial data is provided to the mesher as GIS layers, so that you can use your favorite GIS application to build quality meshes quickly and easily. Solution guided meshing uses results from initial mesh solutions to iteratively improve meshes. Making it easy to generate good meshes for even complicated hydrodynamic

This tutorial was developed using GIS Mesher version 2023.01, it recommended to use this version or later versions of GIS Mesher. If using a different version of the GIS Mesher, some of the dialogue boxes and screen shots may change slightly, however the overall workflow should be similar. If you run into any problems or need help, please contact support@tuflow.com.

GIS Mesher downloads and release notes can be found here GIS Mesher.
QGIS

QGIS TUFLOW plugin
The geographic information system (GIS) QGIS will be used in this tutorial to build the mesh. This tutorial was developed with QGIS 3.26.2, it is recommended to use this version or later versions. If using a different version of QGIS, some of the dialogue boxes and screen shots may change slightly.

The TUFLOW plugin includes numerous tools to increase workflow efficiency.

QGIS can be download from Latest 64-bit version of QGIS.

QGIS TUFLOW Plugin Installation.

Model Data The data provided for the completion of this tutorial includes:
  • The Module_Data folder which contains the bathymetry data as a raster (.tif) dataset, land-use areas provided as a shapefile (.shp), the model domain provided as a polygon shapefile (.shp) and a projection file (.prj)
  • The Complete_Mesh folder that contains the files for the completed tutorial in case you get stuck, and
  • A working folder is provided for the files you create and work within.
TUFLOW FV Tutorial Models.

Assumed Knowledge No prior knowledge is required for the completion of this tutorial. We have designed this tutorial to provide an introduction to meshing for all modelling levels. If you run into any problems or need help, please contact support@tuflow.com

Model Setup

The following tutorial demonstrates the development of a simple model mesh using the GIS Mesher. The GIS Mesher supports the building of meshes for TUFLOW FV. For this tutorial, step by step instructions are given to get you started with meshing using the GIS Mesher. This example problem demonstrates the development of a basic model mesh. Follow the steps performed here and expand upon them to develop more complex, real-world models. The example is an inbank riverine channel.

Specifically, you will use the GIS Mesher to:

  • 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
  • Add materials to the mesh
  • Build the mesh using the GIS Mesher


By now you should have downloaded the Meshing M02 Tutorial GIS Mesher Model data from TUFLOW FV Tutorial Models. This includes the Module_Data, Complete_Model and working, please copy these folders to your preferred working location.

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 TUFLOWFV simulation that can be used as a starting point to build models. Some of the folders and files will be referred to later.

Trap chan folderstructure 01.png

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 Tutorial Module 02 with GIS Mesher.

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.

This shapefile provides a representation of the mesh file. This should look something like the figure below if styled similarly based upon Z value and coloured using the Viridis color ramp. You can also symbolize the mesh based upon the MaterialID field to verify that these are set correctly.

Tut 02 cell mesher.png


The Riverine_Channel_000.2dm file located in .\meshing\output\ is the meshing input file for TUFLOW FV. This .2dm file will later become the geometry input file for the TUFLOW FV tutorial model in Tutorial Module 02 with GIS Mesher. Congratulations on building your first mesh.

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

Open the _Cells.shp, remeber we did this in step 3 of Build the mesh using the GIS_Mesher. Can you see where you have refined your mesh? How does your first mesh Riverine_Channel_000.2dm compare to the new mesh Riverine_Channel_001.2dm compare? How does your first mesh Riverine_Channel_000 compare to the new mesh Riverine_Channel_001 compare?

The Riverine_Channel_001.2dm file located in .\meshing\output\ is the meshing input file for TUFLOW FV. Congratulations, you have completed the construction of a mesh using the GIS Mesher. Great work! This .2dm file will later become the geometry input file for the TUFLOW FV tutorial model in Tutorial Module 02 with GIS Mesher.

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 Module 02 with GIS Mesher.

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