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

This tutorial walks through the first tutorial model using the Rising Water Software GIS Mesher (version 2022.01). 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, 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.

This tutorial requires the mesh file Trap_Channel_000.2dm created in [TBC Hyperlink tut]. Please complete the meshing tutorial [TBC HYPERLINK] before proceeding, or alternatively you may adopt the mesh file provided in module data download from [TBC HYPERLINK]. 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 the TUFLOW FV models in this tutorial module. For reference, complete versions of the models can be downloaded from the TUFLOW website: http://www.tuflow.com/FV%20TutorialModel.aspx [TBC update link]

Tutorial Data

Download the Tutorial Module 01 GIS [TBC link] Mesher dataset from the TUFLOW Website.
The folders provided in this tutorial include Module_Data, Complete_Model, and working. Copy these folders to where you would like to work with the project.

  • The Module_Data folder contains the .2dm mesh file for those that have not completed tutorial [TBC hyperlink], as well as the projection file,
  • The Complete_Model 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

Creating the Project

The GIS Mesher GUI provides tools for building projects, creating GIS files, running the mesher, and running TUFLOW FV. In this tutorial we will use the GUI to build our project and run TUFLOW FV. To create the project:

Firstly start-up the GIS Mesher GUI. It should look 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 tut01.
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. Uncheck all of the Initial GIS files as we do not require any additional GIS files for this tutorial.
6. Leave the filenames and other settings as default.

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

Tut01 GISM NewProj .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 if specified for the boundary, mesh polylines (used to define size information), and nodestrings, which are 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 contains a TUFLOW FV simulation that can be used as a starting point to build models. In this tutorial we will be working in the TUFLOWFV folder.

Tut 01 GUI FLD STRUCTURE 02.png

TUFLOW FV Model Setup

The following example takes the trapezoidal channel mesh created in tutorial [TBC HYPERLINK] and sets up, runs and visualises a hydrodynamic simulation. Specifications for the model setup of the trapezoidal channel are as follows:

  • The bed is lined with a coarse concrete; a Manning friction of 0.018
  • There is a constant upstream inflow of 450 m3/s
  • The downstream water level is 2.5 m above the bed

Model Mesh

If you have completed tutorial [TBC HYPERKINK], please copy your .2dm file Trap_Channel_000.2dm to ./TUFLOWFV/model/geo. Alternatively, please copy the Trap_Channel_000.2dm from the Module_Data folder into ./TUFLOWFV/model/geo.

Nodestring Order

Open the ./TUFLOWFV/model/geo/Trap_Channel_000.2dm file in a text editor and look for the nodestrings. Do this by searching for NS at the start of the line. For the .2dm file which has been created, the NS lines are as follows:

NS 3 2 84 125 166 207 248 289 -330 1
NS 82 81 123 164 205 246 287 328 -369 2

TUFLOW FV uses the nodestrings as boundaries, with the first nodestring listed being boundary 1, the second nodestring as boundary 2, etc. In this case (by looking at the node list in the .2dm file and comparing to the nodestrings from the GIS Mesher [TBC HYPERLINK tut]), the first nodestring is the upstream boundary (ie – a flow boundary) and the second nodestring is the downstream boundary (ie – a water level boundary).

Don’t panic if the nodes listed in the nodestring either have different numbers or are in reverse order to that shown; this doesn’t influence their behaviour. It is however important that each nodestring lists 9 numbers. This is the number of nodes that the nodestring intercepts.

Boundary Condition Files

For TUFLOW FV, csv (comma delimited) format files contain boundary condition inputs. In this case, the boundary conditions are very simple because the run is steady state. Create the flow boundary (steadyQ_01.csv) and include the following:

Time Flow
0.0 0.0
1.0 100
2.0 450
6.0 450

Note that the first column (time) is in hours. Note also that there is a warm-up period of 2 hours.

Now create water level boundary (steadyWL_01.csv) and include the following:

Time WL
0.0 -3.5
48.0 -3.5

Both files should be placed in the ./TUFLOWFV/bc_dbase folder.

Create the TUFLOW FV Control File (FVC)

The TUFLOW FV control file is created via a text editor. Notepad++ or UltraEdit is recommended for this purpose. These software include configuration features which allow for syntax highlighting of TUFLOW FV specific commands. TUFLOW FV models can also be executed directly from the text editors. This configuration information is provided in the following pages:

Often, an .fvc file is created from an earlier model or from a template. If using a template, then it is good practice to comment out the irrelevant commands. A “!” at the start of the line means that the line is not read by TUFLOW FV. This allows you to insert comments into your fvc file (this is recommended). To simplify this example, only those lines that are relevant to this simulation are shown in the .fvc file. For this tutorial, please call your control file trap_steady_01.fvc. The .fvc file is shown below. A description of each entry is provided.

FVC File Contents

! TUFLOW FV TUTORIAL The first 2 lines are a description of the model simulation. You may also wish to include the initials of the modeller, etc.
! Flow along a trapezoidal channel
Tutorial Model == ON Enables licence free modelling.
! TIME COMMANDS The time commands include the start and end times (the default time format is Hours). The CFL limit is 1 by default – TUFLOW FV then assigns a timestep at each computational step according to the CFL limit and between the ranges specified in the timestep limits.
Start time == 0.0
End time == 6.0
CFL == 1.0
Timestep limits == 0.0001, 10.


! MODEL PARAMETERS The model parameters are those that control various physical and numerical processes.

When the stability limits are exceeded (water level first, then velocity), the model is considered to have crashed. Note that the velocity limit here is high – this is because the velocities along the wetting and drying boundary edges are high.

A Smagorinsky eddy viscosity approach has been specified, with a Smagorinsky factor of 0.5.


Stability limits == 10. ,100.
Momentum mixing model == Smagorinsky
Global horizontal eddy viscosity == 0.5
Global horizontal eddy viscosity limits == 0.05, 99999.
! GEOMETRY The model geometry is the .2dm created above in this tutorial module.
Geometry 2d == ..\model\geo\Trap_Channel_000.2dm
! MATERIAL PROPERTIES So far, material types have not been highlighted. By default, the GIS Mesher GUI will create elements using a single material type (1). It is this material type that is assigned a bottom roughness of 0.018 (the default friction approach is a Manning’s number).
Material == 1
Bottom roughness == 0.018
End material


! INITIAL CONDITIONS The initial condition is 2.5 m above the bed at the downstream end (ie -3.5 m).
Initial water level == -3.5


! BOUNDARY CONDITIONS The boundary conditions link the .csv files containing the actual flows and water levels to the nodestrings. Nodestring 1 is assigned a flow boundary and Sub-type of 3 which applies the boundary as a flux with a consideration of the depth when distributing flow. Nodestring 2 is assigned a water level boundary.
BC == Q, 1, ..\bc_dbase\steadyQ_01.csv
BC header == time,flow
Sub-type == 3
End BC


BC == WL, 2, ..\bc_dbase\steadyWL_01.csv
BC header == time,WL
end BC


! OUTPUT COMMANDS In this instance, a NETCDF format file is specified. This format is easily read into the TUFLOW Viewer for viewing results in QGIS. The h, v and d mean that outputs files containing water level, velocity and water depth will be created. We also use Logdir which specifies the directory for TUFLOW FV simulation log file.
Logdir == ..\runs\log
Output dir == ..\results\
Output == netcdf
Output Parameters == h,v,d
Output Interval == 600
End output

Note: for more information and instructions on the TUFLOW Viewer QGIS plugin, please visit TUFLOW Viewer.

The TUFLOW FV control file should look similar to the figure below. If the syntax colours are not present in your display, we recommend you configure your text editor for TUFLOW FV modelling. Refer to the Notepad++ Tips or UltraEdit Tips Wiki pages.

Tut01 FVC GISMESHER .png

Run TUFLOW FV with the GIS Mesher GUI

Once you’re happy with the .fvc file contents, run TUFLOW FV using the GIS Mesher GUI.
Firstly make sure the GUI is reading the correct TUFLOW FV executable by selecting Preferences Tut 01 preferences .png and checking that the TUFLOW FV Executables is correct. Please see below.

Tut 01 checking EXE .png

Please follow the following steps to run TUFLUW FV with the GUI.

1. Select the Run TUFLOW FV tab
2. Set the Root Folder file path to the runs folder your .fvc is located in
3. Set the Simulation to trap_steady_01.fvc
4. Click Add to Queue. This will queue your simulation
5. Click Run to initiate your model

Tut 01 runingFVC GUI 01 .png

If your model has completed successfully, the output dialog box will state Run Successful.

You may find that your simulation has crashed. This has likely occurred due to some syntax error in the inputs . See the following link for advice: Common reasons why a model won’t start.

Check Results

During the model simulation one result .nc file will be written. This netcdf file contains water levels, velocities, and water depths. The file will have the same prefix as the .fvc file; in this example it will be called trap_steady_01.nc. The netcdf result files produced by TUFLOW FV are best viewed using the TUFLOW Viewer in QGIS. For instructions on how download the TUFLOW Viewer plugin, please visit | https://wiki.tuflow.com/index.php?title=TUFLOW_Viewer.

Once you have installed the plugin, please click the TUFLOW Viewer button Tut 01 PluginButton .png. The TUFLOW View will appear as below. To open your results, please select File>Load Results-Map Output and navigate to your result.

Tut 01 LoadResults .png

Your QGIS project window should look similar to the below:
Tut 01 ViewResults ELV .png

In this section, we will use the the TUFLOW Viewer to visualise the results in two plots: (1) a long section of water level and bed elevation, and (2) a time series of the velocity with vectors on.

(1) To display a long section of the water level and bed elevation, follow the below steps:

1. Display the mesh by selecting the Toggle Mesh Rendering
2. Select the Plot cross drop down Tut 01 XSplot button .png
3. In the drop down, check bed elevation
4. In the drop down, check water surface elevation

Tut 01 ViewResults setup XS 00 .png

To draw the long section, please select the Plot cross drop down Tut 01 XSplot button .png and your cursor should now become a crosshair [+]. Now you are ready to plot your long section. See the long section example below:
Tut 01 ViewResults LS .png


(2) To display a timeseries of the velocity and velocity vectors, follow the below steps:

1. Display the mesh by selecting the Toggle Mesh Rendering
2. In the Result Type window, select velocity and velocity vector map outputs
3. Now increase the time stamp to see how the velocity vectors change throughout the model simulation
4. Select the Plot Time Series drop down Tut 01 TSplot button .png and in the drop down check velocity
5. To draw the long section, please select the Tut 01 TSplot button .png and your cursor should now become a crosshair [+]. Click on your results to view a time series similar to the below:

Tut 01 ViewResults TS .png


For more examples on how to review your results using the QGIS TUFLOW Viewer plugin, visit TUFLOW Viewer.

Inclusion of Salinity

It is relatively straightforward to include a conservative tracer into the model simulation.

Save a copy of Trap_Steady_01.fvc and name it Trap_Steady_02.fvc. The following additional components listed in the right-hand column of the table below are required within the FVC file:

FVC File Updates

! TUFLOW FV TUTORIAL The first 2 lines are a description of the model simulation. You may also wish to include the initials of the modeller, etc.
! Flow along a trapezoidal channel modelled with salinity
Tutorial Model == ON Enables licence free modelling.
! SIMULATION CONFIGURATION Include salinity as a model parameter (the first number = 1), but decoupled from the density simulations (the second number = 0).
Include salinity == 1,0
! TIME COMMANDS
Start time == 0.0
End time == 6.0
CFL == 1.0
Timestep limits == 0.0001, 10.
! MODEL PARAMETERS The scalar mixing model and diffusivity are specified as model parameters.
Stability limits == 10. ,100.
Momentum mixing model == Smagorinsky
Global horizontal eddy viscosity == 0.5
Global horizontal eddy viscosity limits == 0.05, 99999.
Scalar mixing model == Smagorinsky
Global horizontal scalar diffusivity == 0.5
Global horizontal scalar diffusivity limits == 0.05, 99999.
! GEOMETRY
Geometry 2d == ..\model\geo\Trap_Channel_000.2dm
! MATERIAL PROPERTIES
Material == 1
Bottom roughness == 0.018
End material
! INITIAL CONDITIONS The initial water level is -3.5 and initial salinity concentration is 0.
Initial water level == -3.5
Initial Salinity == 0
! BOUNDARY CONDITIONS An additional column in the boundary condition files is required, specifying the concentration at the boundary. The new boundary condition files have been renamed as version 02.






A new boundary condition (QC) defines a constant inflow into an element (or cell). The numbers 240,55 are the x,y coordinates where the inflow will occur.

BC == Q, 1, ..\bc_dbase\steadyQ_02.csv
BC header == time,flow,Sal
Sub-type == 4
End BC
BC == WL, 2, ..\bc_dbase\steadyWL_02.csv
BC header == time,WL,Sal
End BC
BC == QC, 240,55, ..\bc_dbase\cellQ_02.csv
BC header == Time,flow,Sal
End BC
! OUTPUT COMMANDS An additional output parameter is specified (Sal).
Output dir == ..\results\
Output == netcdf
Output Parameters == h,v,d,Sal
Output Interval == 600
End output

The TUFLOW FV control file should look similar to the figure below. If the syntax colours are not present in your display we recommend you configure your text editor for TUFLOW FV modelling. Refer to the Notepad++ Tips or UltraEdit Tips Wiki pages.

Tut01 ComEd FVC 02.png

Update Boundary Condition Files

The updated flow boundary (steadyQ_02.csv) should contain the following:

Time Flow Sal
0.0 0.0 0.0
1.0 100 0.0
2.0 450 0.0
6.0 450 0.0

The water level boundary (steadyWL_02.csv) should contain the following:

Time WL Sal
0.0 0.0 0.0
48.0 -3.5 0.0

The cell inflow boundary (cellQ_02.csv) should contain the following:

Time Flow Sal
0.0 0.0 30.0
1.0 10.0 30.0
2.0 10.0 30.0
6.0 10.0 30.0

Run the Model

Please follow the following steps to run TUFLUW FV with the GUI.

1. Select the Run TUFLOW FV tab
2. Set the Root Folder file path to the runs folder your .fvc is located in
3. Set the Simulation to trap_steady_02.fvc
4. Click Add to Queue. This will queue your simulation
5. Click Run to initiate your model

Tut01 FVC 02 runGUI.png

If your model has completed successfully the output dialog box will state Run Successful.

View Results

Open the trap_steady_02.nc using the TUFLOW Viewer in QGIS. For instructions on how download the TUFLOW Viewer plugin, please visit | https://wiki.tuflow.com/index.php?title=TUFLOW_Viewer.

Take a timeseries of the Salinity output. Your result should look similar to the following:

Tut01 TS SAL .png


Congratulations! You have successfully built and run a TUFLOW FV model.

Troubleshooting

This section contains a link help you troubleshoot some common issues that may occur when progressing through the first module of the TUFLOW FV tutorial model: Common reasons why a model won’t start.

Click on the following link to return to the main tutorial page.

Conclusion

Congratulations on completing Tutorial 1 with GIS Mesher. We've covered a lot in this tutorial, including introduction to modelling with TUFLOW FV, development of a TUFLOW FV model, running a model in the GIS Mesher GUI, and checking the results using the TUFLOW Viewer in QGIS.

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