Meshing M01 GIS Mesher
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
This tutorial is designed to introduce the fundamentals of creating a mesh in the GIS Mesher developed by Rising Water Software. Using the steps outlined in this tutorial you will create a trapezoidal channel computational mesh. Specifically in this tutorial you will:
- Create the meshing project.
- Create a trapezoidal mesh topology.
- Define the mesh sizes.
- Add the elevation data.
- Build the mesh.
Trapezoidal Channel Project Area
The trapezoidal channel has dimensions as shown below:
- Top width = 100 m.
- Bottom width = 50 m.
- Depth = 5 m.
- Length of channel = 1,000 m.
- Grade of channel = 1 in 1,000.
- The model domain should have a resolution of 12.5 m across the channel and 25 m along the channel.
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. This tutorial was developed using GIS Mesher version 2023.01 and it is recommended to use this version or a more recent of GIS Mesher to complete this tutorial. 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. |
GIS Mesher downloads and release notes can be found via the GIS Mesher webpage. |
QGIS |
The Geographic Information System (GIS) QGIS will be used to build components of our models and review results.
It is recommended to have QGIS 3.28 or later to ensure compatibility with QGIS TUFLOW plugin latest features. Install the QGIS TUFLOW plugin which includes numerous tools to increase workflow efficiency. |
QGIS can be downloaded from Latest 64-bit version of QGIS. Please follow the installation steps for the OSGeo4W Network Installer.
|
Notepad++Syntax Highlighting | A text editor is required for creation of the TUFLOW FV input files. This tutorial uses NotePad++.
Ideally a text editor should be able to:
TUFLOW colour coding can be enabled using syntax highlighting. |
Download and install the Latest 64-bit version of Notepad++.
For instructions on configuring Notepad++ for TUFLOW modelling, see Notepad++ tips. |
Meshing Data | Data required to complete the tutorial. | Download the GIS Mesher Module 1 Data Package. |
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. |
Prepare Your Working Environment
Unzip the required Model Data to your preferred working location, for example E:\TUFLOWFV\Meshing_M01_GIS_Mesher.
- The Complete_Mesh folder has the files for the completed tutorial in case you get stuck.
- The Module_Data folder that contains the bathymetry data as a raster (.tif) dataset for the trapezoidal channel and a projection file (.prj).
- The Working folder is where we will save our files and build our mesh.
- Note: All file paths referred to will be relative to this base directory. For example, Complete_Mesh\Trap_Channel_000 refers to E:\TUFLOWFV\Meshing_M01_GIS_Mesher\Complete_Mesh\Trap_Channel_000.
Setup Your GIS Mesher Project
The open the GIS Mesher GUI and create new project by selecting File > New Project from the menu:
In the New Project dialog box, set the following and use the below animation as a guide:
- 1. Specify the Parent Folder as the Working folder in your tutorial folder. For example, E:\TUFLOWFV\Meshing_M01_GIS_Mesher.
- 2. Set the Project name as Trap_Channel_000.
- 3. Set the Working Projection to Module_Data\working_projection.prj.
- 4. Leave the Default GIS filetype as ESRI Shapefile (shp).
- 5. For the Initial GIS files check mesh_polylines, nodestrings, and boundary and uncheck the remaining GIS file types. So that the naming convention is consistent with the project update the GIS file suffix to _000.
- 6. Leave the rest as default and Click Ok.
After you hit OK GIS Mesher will create 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 Trap_Channel_000 folder is the parent folder we set when creating the new project.
- 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 template 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 TUFLOWFV folder contains the sub-folders used to construct a TUFLOW FV model.
Setup Your QGIS Project
Open a new QGIS project and save a new project by selecting Project > Save As.... Navigate to the Working folder and save the project as Trap_Channel_000.qgz.
Setting The Workspace Projection
When using GIS integration for mesh development it is a requirement that the mesh and all GIS inputs are in the same spatial reference system. This ensures GIS objects align correctly with the mesh.
Use the following steps to set the project's Coordinate Reference System (CRS):
- 2. In the Project Properties, select CRS on the left-hand pane.
- 3. In the Filter search bar, type WGS 84 / UTM zone 60S.
- 4. Select Apply and OK.
Configuring Plugins
In the next sections we will be using NumericalDigitize tool which is a plugin. To install this plugin, go to Plugins > Manage and Install Plugins.
In the Plugin dialog box select All at the top of the lefthand panel and search and select NumericalDigitize and click Install Plugin. Once the installation has completed you can close the Plugin dialog box.
Defining The Model Domain
We will now edit the template layers created by the GIS Mesher GUI to define our mesh topology. Using the following steps specify the model domain:
- 1. Load the boundary_000.shp by selecting Layer > Data Source Manager from the menu.
- In the Data Source Manager dialog select the Vector data type and navigate to Working\Trap_Channel_000\meshing\GIS\boundary_000.shp and select Add.
- 2. Make sure that the Digitizing Toolbar is active (right-click on the toolbar area to add it if it is not present).
- 3. Select the boundary_000 layer and make it editable by selecting the Toggle Editingfrom the toolbar. Select Numerical Digitizing, in the Add feature dialog entre the the x and y values as shown in the below figure and set the Coordinates are given in the CRS of the Layer and click OK.
4. The Feature Attributes dialog will appear. Set the ID to 1 and select OK:- 5. From the Toolbar select the Save Layer Edit button and Toggle Editing to save and stop editing. The boundary_000 layer should look the same as the below:
Define The Mesh Size Information
To define mesh size information, 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. Load the mesh_polylines_000.shp'Working\Trap_Channel_000\meshing\GIS\mesh_polylines_000.shp' by selecting Layer > Data Source Manager from the menu.
- In the Data Source Manager dialog select the Vector data type and navigate to Working\Trap_Channel_000\meshing\GIS\boundary_000.shp and select Add.
- 2. Make sure that the Snapping Toolbar is active (right-click on the toolbar area to add it if it is not present).
- 3. With Snapping enabled select the mesh_polylines_000 layer in the layers panel and click the Toggle Editingbutton on the Digitizing Toolbar, and select the Add Line Feature.
- Use the below attributes and animation to create mesh polylines with the following geometry and attributes:
- SizePara = 25
- SizePerp = 12.5
Specify The Nodestring Locations
To define the location of boundary conditions we will define two nodestring locations. We need a nodestring on the upstream side (west) of the model for the inflow boundary condition and a nodestring on the downstream side (east) of the model for the outflow boundary condition. Follow the below steps to define the nodestrings:
- 1. Load the Working\Trap_Channel_000\meshing\GIS\nodestrings_000.shp by selecting Layer > Data Source Manager from the menu.
- In the Data Source Manager dialog select the Vector data type and navigate to Working\Trap_Channel_000\meshing\GIS\boundary_000.shp and select Add.
- 2. With Snapping enabled select the nodestrings_000 layer in the layers panel and click the Toggle Editingbutton on the Digitizing Toolbar and select the Add Line Feature. Use the below attributes and animation to create mesh nodestrings:
- Upstream Boundary
- ID = 1
- External T
- Downstream boundary
- ID = 2
- External T
- Upstream Boundary
- 3. For better visualisation update the symbology of the nodestrings. Use the below animation as a guide:
Review The Elevation data
Before adding the elevation data to the GIS Mesher control file we will review the data in QGIS:
- 1. Load the bathy_raster.tif by selecting Layer > Data Source Manager from the menu.
- In the Data Source Manager dialog select the Raster data type and navigate to Module_Data\bathy_raster.tif and select Add.
- 2. Use the below animation to update the elevation symbology:
The bathymetry will cover the same extent as the model domain you have created. The bathymetry has been created so that the channel is deeper at the downstream boundary (west) and shallower at the upstream boundary (east).
Adding The Elevation Data
The GIS Mesher control file (.mcf extension) is used to by the GUI to generate the mesh. The control file was originally made by the GUI when you created a New Project. We need to update the control file to read the elevation data. The .mcf can be edited via the text editor Notepad++. Refer to the Requirements and Downloads table if you have not already installed Notepad++.
- 1. To update the.mcf Launch Notepad++ and select File > Open... and navigate to the Working\Trap_Channel_000\meshing folder and open Trap_Channel_000_000.mcf.
- 2. Save a new copy of this file into the Working\Trap_Channel_000\meshing folder and call it Trap_Channel_000.mcf. For easy visualisation of the commands enable the TUFLOW FV syntax highlighting. Installation of the syntax highlighting is provided in the Requirements and Downloads table. Your Trap_Channel_000.mcf should appear as the below:
- Note: Your MCF will already have most of the required commands. These are default commands produced when you configured the GIS Mesher project. For more information on the these commands refer to the Rising Water Software Documentation.
- 3. Find line 59 that reads !Read Grid Zpts. The exclamation mark (!) comments out the command. Remove the exclamation mark and change the command to Read Grid Zpts == ..\..\..\Module_Data\bathy_raster.tif, as shown in the figure below:
- 4. For licensing purposes we need to enable the Tutorial model. At the top of the .mcf (line 1) add the following command Tutorial Model == ON, as shown below:
Save and close Trap_Channel_000.mcf
Using the GIS Mesher GUI to Create A Mesh
If you have closed the GIS Mesher GUI use the below steps to reopen your project otherwise skip to the next step.
- 1. Select File > Open Project...
- 2. Navigate to Working\Trap_Channel_000\.GISmesher\project_settings.GISMesher and select open:
Use the below steps build the mesh from the GUI:
- 1. From the GIS Mesher GUI select the Run Mesher tab and from the Control File drop down select Trap_Channel_000.mcf:
- 2. Click Run.
- 3. The text in the Output window will provide feedback on the meshing process. Once successfully complete Output dialog will display GIS Mesher Finished Successfully.
You should now have three new sub folders in the Meshing folder these include the output, check, and log folders.
Reviewing The Mesh
The GIS Mesher has generated a mesh (.2dm) file and associated cells, nodes and nodestring (.shp) files that make up a mesh. Before reviewing the mesh close previous GIS layers in the QGIS window. This maintains a tidy workspace which is good modeling practice. The Trap_Channel_000.2dm file located in Working\meshing\output\ is the meshing input file for TUFLOW FV. You can drag and drop the .2dm into your workspace. Use the below animation as a guide to review and style the mesh:
Congratulations you have completed the construction of a meshes using the GIS Mesher. Great work!
Feedback
If you have any queries, feedback or requests for new functionality you'd like added to the tutorial modules, please feel free to get in contact with support@tuflow.com.
If you wish to keep up to date with all things TUFLOW and TUFLOW FV, then please join our LinkedIn group.
Conclusion and Next Steps
Well done on completing the Trapezoidal Channel Mesh Build. You have now learnt how to build and modify a simple mesh using the GIS Mesher.
To try more meshing techniques with GIS Mesher return to the GIS Mesher Wiki Page or you can return to the TUFLOW FV Wiki Main Page.