Tutorial Module01 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

The following example demonstrates the development of a very simple model mesh using the GIS Mesher. 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 works in coordination with your favorite 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 but 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.

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 a trapezoidal channel, dimensions as shown:

  • 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.

Note: Try completing the following steps to create a mesh that can be later used in TUFLOW FV tutorial X [TBC]. For reference, complete versions of the models can be downloaded from the TUFLOW website.

Building the Mesh

Please note that this tutorial has been created using QGIS version 3.20.1. You may use other versions of QGIS, however some minor differences may exist between the screenshots in this tutorial and the QGIS version you are using.

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. The GIS Mesher may also be used to assign nodestrings, materials, and elevations. Some of these properties 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

For this simple model a single material will be used for the full domain.

Creating the Project

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 includes the bathymetry information for the trapezoidal channel described in Tutorial Description and a projection file for the project,
  • 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.

The GIS Mesher GUI provides tools for building projects, creating GIS files, running the mesher, and running TUFLOW FV. 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.
Tut 01 GIS MESHER GUI 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 Trap_Channel,
3. Click on the [...] for the working projection and select the working_projection.prj file from the Module_Data folder,
4. We will leave the GIS file type as ESRI Shapefile,
5. For the Initial GIS files, please check mesh_polylines, nodestrings, and boundary and uncheck the remaining GIS file types, and
6. Leave the filenames and other settings as default.

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

Trap 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 TUFLOWFV 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.

Trap chan folderstructure 00.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).

Note: You may need to add the QGIS plugin NumericalDigitize to access the Numeric Digitizing tool

To set up the model boundary (QGIS instructions):
1. Open a new QGIS project and set the project CRS to WGS 84 / UTM zone 60S [EPGS:32760],
2. Load the file working\Trap_Channel\meshing\GIS\boundary_001.shp by selecting Layer | Add Layer | Vector Layer from the menu. Select the file for the Vector Dataset(s) and click Add,
3. Make sure that the Digitizing Toolbar is active (right-click on the toolbar area to add it if needed). Select the boundary_001 layer and make editable by selecting the Toggle EditingTut 01 qgis editable 00.pngbutton. Click on the Numerical DigitizingNumericaldigi.pngbutton and fill in the x and y values, as shown in the figure below. Select Coordinates are given in the CRS of the Layer and click OK,


Tut 01 numeric digi 00.png


4. Make the ID 1 in the dialog that pops up, and

5. In the Digitizing Toolbar, click the save button and then the Toggle Editing to stop editing.

Your Boundary shapefile should now look the same as the below screen grab:
Tut 01 boundaryshape 00.png

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. Add the file Working\Trap_channel\meshing\GIS\mesh_polylines_001.shp to QGIS using the Layer | Add Layer | Vector Layer Command,
2. Select the mesh_polylines_001 layer in the layers panel and click the Toggle EditingTut 01 qgis editable 00.pngbutton on the Digitizing Toolbar, and
3. Use the Numerical DigitizingNumericaldigi.png tool to create mesh polylines with the following geometry and attributes. Please note that to use this tool, the NumericalDigitize plugin must be installed. To install this plugin, go to Plugins | Manage and Install Plugins, search for "NumericalDigitize" to select the plugin, and then click Install Plugin.

a. Polyline 1 south side of flume
i. geometry: from 0,0 to 1000, 0
ii. attributes: sizePara = 25, SizePerp = 12.5


Tut 01digi polylines 00.png

b. Polyline 2 north side of flume
i. geometry: from 0,100 to 1000,100
ii. attributes: sizePara = 25, SizePerp = 12.5

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

Your mesh_polylines shapefile should now look the same as the below screen grab
Tut 01 polylines 00.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 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.

To specify the nodestring locations (QGIS instructions):
1. Add the file Working\Trap_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.pngbutton on the Digitizing Toolbar,
3. With snapping enabled Tut 01 EnableSnapping 00.png (Snapping Toolbar), Add a Line Feature Tut 01 digiLine 00.png for the inflow on the left side of the mesh (from 0, 0 to 0, 100). Set the ID to 1 and specify T for External which forces the nodestring to follow the mesh boundary, and
4. Repeat step 3 for the downstream side of the mesh (1000, 0 to 1000,100). 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

Tut 01 Nodestrings 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 flume bathymetry for elevations:
1. Open the file working\Trap_Channel\meshing\Trap_Channel_000.mcf in a text editor (Notepad++ is a free editor that has a lot of useful features) and
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\bathy_raster.tif, as shown in the figure below.

Tut 01 MCF GRID COMMANDS 00.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 Trap_Channel_000.mcf,
2. Click Run. The text in the output should provide feedback on the meshing process and after a few seconds display the line GIS Mesher Finished Successfully, and
Trap chan RunMesher 00.png
3. Load the file meshing\output\Trap_Channel_000_cell_elevations.shp into your GIS Application. This is the mesh in shapefile format. The z attribute has the elevations assigned to the cells. The figure below shows the z elevations coloured using the Viridis color ramp in QGIS. Note that the .2dm file will be used for TUFLOW FV. This can later become the geometry input file for the TUFLOW FV tutorial model in XHYPERLINKX [TBC].

Tut 01 00 mesh cells.png

Going Further

The best way to learn how to setup and run TUFLOW FV is to experiment. In the following example, we will walk you through how to adjust your mesh to include a “bump” in the centre and a constriction further downstream, which will induce transitions to supercritical flow. Mesh resolution has been increased around these features. We can later run this mesh in TUFLOWFV SEE TUT TBC. To adjust your mesh, please follow the steps outlined in this section. In case you get stuck, we have provided the completed mesh files in Complete_Mesh/Trap_Channel_001.

Firstly, we need to duplicate our original Mesh Generator map file. Do this by right clicking Mesh Generator > Duplicate.

Tut 01 duplicate mesh.png

Conclusion

Congratulations on completing Tutorial XX. You have now learnt how to build a simple mesh model in the GIS Mesher which can be used in Tutorial X.

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