Tutorial Module01 CN

Jump to navigation Jump to search
LINKS: Main page
Modelling Advice Tutorial Models Tips and Tricks
Mesh Generation Tips Tutorial Module 1 SMS
A Model Won't Start Tutorial Module 2 UltraEdit
A Model Crashes Tutorial Module 3 Notepad++
A Model Runs Slow Tutorial Module 4 Excel
TUFLOW Products Support / Contact TUFLOW FV Utilities
Requesting a Licence Running TUFLOW FV
Mesh Generation Tips




  • 顶部宽度 = 100米
  • 底部宽度 = 50米
  • 深度 = 5米
  • 通道长度 = 1,000米
  • 河道坡度 = 1:1000


注:请尝试完成以下步骤以创建本教程模块中的TUFLOW FV模型。作为参考,可以从TUFLOW网站下载完整版本的模型:http://www.tuflow.com/FV%20TutorialModel.aspx


第一步是建立文件夹结构。建立名为“Trapezoidal_Steady_State_Example”的TUFLOW FV模型文件夹,文件夹内部结构为:

Module1 Folder Structure.jpg



Map Coverage

  • SMS “Map Coverage”中包含的数据用于定义模型网格布局。
  • 第一步是设置SMS “Map coverage”. 在“Map coverage”中,用点和曲线定义地形的“轮廓”。点击SMS窗口左下角的这个图标1.1.1A.png
  • 在将数据输入到“Map coverage”之前,应先选择“Generic Model”为“Map coverage”的类型。右键单击资源管理栏中的“Generic Model”标签,按图所示选择“Generic Model”:

Tute1 FV000.PNG

  • 如果“Generic Model”标签尚未显示在资源管理栏中。右键单击“Map Data”标签,选择"New Coverage",在弹出窗口创建“Generic Model”。

Tute1 FV000b.pngTute1 FV000c.png

  • 绘制“Map coverage”时界面为俯视图。使用““create feature point”按钮1.1.1B.png,点击创建定义河道的8个点(feature point)。
  • 每创建一个点,使用主显示窗口上方工具栏中的坐标框指定精确的平面坐标(x和y)和高程(z)Module2 Coordinate Boxes.jpg


1 0.0 0.0 0.0
2 0.0 25 -5
3 0.0 75 -5
4 0.0 100 0.0
5 1000 0.0 0.0
6 1000 25 -6
7 1000 75 -6
8 1000 100 0.0

加完所有feature point后,界面应该看起来向这样:


  • 下一步点击“Create feature arc”按钮 Tute1 FV002.PNG 用线(feature arc)链接点.


  • 保存当前SMS项目到“Geo”文件夹中,项目文件名为“trap_steady_01.sms”。


创建“Scatter Points”

  • Scatter points包含模型的高程信息,该高程信息会在下个阶段被插值到模型的计算网格上。
  • 在这个教程模型中,将从之前创建的Map Coverage创建Scatter points。从菜单中选择“Feature objects” -> “Map - > Scatter”。


  • Make sure you specify the z value source from the “Arc node and vertex elevations” in the dialog box:

TUFLOW FV Module 1 Edit1.jpeg

  • Use the display button to turn on contours in the scatter data module and view the newly created dataset:1.1.2C1.png
  • Select the contours tab in the Scatter Display Options. Also update the countours method within the Contours tab.

Tute1 FV003.PNG

  • Select 'Color Fill' to visualize the z values. Reverse the colour palette so blue aligns with the minimum value and red with the maximum value.

Tute1 FV004.PNGTute1 FV005.PNG
The above configuration update should now show the below contoured z values:

Note: These steps relating to the scatter point dataset have replaced the often complex steps associated with inputting GIS layers, scatter datasets, etc to create the base topography/bathymetry for the model. The approach demonstrated is fine for a simple test case, but real world applications are often more complex and contain a variety of data sources. This can be done in SMS in a more rigorous manner (discussed in the SMS manuals) but is also done using other software such as GIS and CAD.

Build Polygons

  • Click on the “Map Data” entry in the explorer window to do this.


  • The next step is to build polygons, which is done from the menu “Feature Objects” – “Build Polygons”.


This takes the feature arcs and creates a series of polygons. It is these polygons that we can now individually investigate and specify mesh properties for.

Build The Mesh

  • Now we can build a mesh. To build the mesh, use the menu commands “Feature Objects” – “Map -> 2D Mesh”.


The resulting mesh, as shown. It doesn’t look very good. But it is a mesh! A mesh has been created using 6 triangular elements (pave), connected by the nodes which, in this case, are the 8 points used to define the extents of the trapezoidal channel.


Note in the image that the scatter data set has been “unticked” in the explorer window – this hides the scatter data in the display, which makes the other information easier to see. Also unclick the map data set to better inspect the mesh data information. This model geometry is not good enough. We require a much higher resolution than this. A higher resolution is achieve by updating the information within the map data coverage, creating more vertices and hence more elements.

Note: more vertices along the polygon arcs = higher mesh resolution.

Modify Polygons

  • Click on the “Map Data” entry in the explorer window to make the coverage editable.


  • Using the “select feature polygon” button, double click on each of the polygons.1.1.5A.png

A dialog box will appear with many options. Check out the SMS manual for a better description, or try a few different options and see what happens.


Some of the key options worth noting are:

  • Mesh type:
    • Paving is the classic triangular mesh, where triangles are used to fill the polygon area.
    • Patch fills the polygon area with a patch of quadrilateral (rectangular) elements. There are some limitations to using this mesh type (like having 4 arcs defining the polygon).
  • Bathymetry Type:
    • Scatter Set will use the scatter data we have created in the 'Create Scatter Points' step to set the z values in the mesh.
  • Preview Mesh:
    • Use this to see how your mesh design looks for this polygon area.

Along the bottom of the display image is a series of buttons which let you adjust arc lines and the vertices that define them.

  • For this model example we should adopt a resolution of 12.5 m across the channel and 25 m along the channel. Using the “Select Feature Arc” button 1.1.5B.png, select the top arc adjust the number of vertices (the “Arc options” buttons) to suit the desired mesh resolution. In this instance, there should be 1,000 / 25 - 1 = 39 vertices. Repeat this for the bottom arc.


  • Repeat for the left and right arcs, which will have 25 / 12.5 - 1 = 1 vertices. You may need to use the “zoom” button to assist with arc selection.1.1.5C.png
  • Once this is done, select a Patch Mesh Type. For a straight trapezoidal channel such as this, a patch mesh type is the most efficient.
  • Update the Bathymetry Type from Constant to Scatter Set and select Scatter Options to choose the specific dataset to apply.

Tute1 FV007.PNG

  • Use the “Preview Mesh” to see what the mesh looks like. Use the zoom function to see the finer details.


  • Once you are happy with the layout of the mesh within this specific polygon, repeat the steps for the remaining polygons. The middle polygon has 50 / 12.5 - 1 = 3 vertices across the channel and 1,000 / 25 -1 = 39 vertices along the channel. The lower polygon has the same vertex count as the top polygon. Note that as each polygon is edited, the arc vertices are updated – this highlights how the mesh generator tracks each polygon to ensure that the overall mesh is consistent.
  • Now repeat the steps listed for "Build Polygons" and "Build the Mesh" using the menu commands “Feature Objects” – “Build Polygons” and “Feature Objects” – “Map -> 2D Mesh” to create the mesh. When the 2D mesh Options dialog appears, make sure the option for 'Linear elements' is selected.

Tute1 FV006.PNG
This time, a reasonable looking mesh should appear.
Note: If a mesh covering only one polygon is produced, please use the “select feature polygon” button1.1.5A.png, click at any empty location in the screen to deselect all polygons and repeat the "Map -> 2D Mesh step".

Linear Elements

In the previous section we created a linear mesh. TUFLOW FV requires this. It cannot use a quadratic mesh (that include mid-side nodes). The difference between linear and quadratic can be seen in the mesh display. The quadratic form is the first display below followed by the linear mesh display.

1.1.6B.png 1.1.6C.png

If you have created or have been give a quadratic mesh that you wish to use in a TUFLOW FV model, you can convert it to a linear mesh using SMS. Click on the "Mesh Data" entry in the explorer window. Press the menu command “Elements” – “Linear <-> Quadratic” to remove the mid-side nodes.

View the node locations by selecting the Nodes checkbox in the 2d Mesh Display Options: 2D Mesh >> Nodes
Tute1 FV008.PNG

Nodestrings (Boundary Conditions)

The last step is to insert nodestrings. Nodestrings are a string of nodes that can be used to define the location of boundary condition inflows/outflows. For this example, there will be an upstream and a downstream boundary condition applied (ie along the left and right edges of the model domain).

  • Press the “Create nodestring” button 1.1.7.png, then click along the nodes that make up the left edge of the mesh. Nodestrings should all be created from right to left while looking downstream.
  • Repeat this procedure along the right edge of the mesh.

Hint – hold the “shift” button down to select all nodes between first clicked and second clicked nodes. Hit "Enter" to finish editing.


You have completed the construction of a mesh, congratulations. Resave your SMS project


  • A useful way to review the created mesh is to use the “Rotate” button. This allows you to visualise the mesh in perspective view.1.1.8.png


  • Click File >> Save to save the SMS project 'trap_steady_01.sms'. This will preserve all of the input data used to develop our mesh (in case we wish to make updates in the future).
  • Click File >> Save As. Select the type " 2D Mesh files (*.2dm). Save the file using the name 'trap_steady_01.2dm'. This will become the geometry input file for the TUFLOW FV model.

TUFLOW FV Model Setup

The following example takes the trapezoidal channel created above 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

Nodestring Order

Open the 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 crated, the NS lines are as follows:

NS 1 2 4 7 11 16 22 29 -37 1
NS 198 206 213 219 224 228 231 233 -234 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 nodes in SMS), 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 are in 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. The flow boundary (called “steadyQ_01.csv”) should contain 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.

The water level boundary (called “steadyWL_01.csv”) should contain the following:

Time WL
0.0 -3.5
48.0 -3.5

Both files should be placed in the folder “bc”.

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’s 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 example, the file is called “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
! 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 – that’s 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.2.

stability limits == 10. ,100.
momentum mixing model == Smagorinsky
global horizontal eddy viscosity == 0.2

! GEOMETRY The model geometry is the 2dm created above in this tutorial module.
geometry 2d == ..\geo\trap_steady_01.2dm

! MATERIAL PROPERTIES So far, material types haven’t been highlighted. By default, SMS 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 nodestring 2 is assigned a water level boundary.
bc == Q, 1, ..\bc\steadyQ_01.csv
bc header == time,flow
Sub-type == 4
end bc

bc == WL, 2, ..\bc\steadyWL_01.csv
bc header == time,WL
end bc

! OUTPUT COMMANDS In this instance, a datv format file is specified. This format is easily read into SMS for viewing. The h, v and d mean that outputs files containing water level, velocity and water depth will be created.
output dir == ..\Output\
output == datv
Output Parameters == h,v,d
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.

TUFLOW FV Simulation File.png


Once you’re happy with the fvc file contents, run TUFLOW FV. Refer to the following link for simulation run options: Running TUFLOW FV
An example batch file (run.bat) has been included in the the tutorial dataset download within the 'input' folder. You can run the batch file by double clicking it from Windows Explorer. It will sequentially execute the three models that are included in this tutorial module.

You may find that your simulation has crashed. This has likely occured 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 the result files will be written; one for the water levels (“_H”.dat), one for velocities (“_V.dat”) and another for water depths (“_D.dat”). They will have the same prefix as the fvc file; in this example they will be called:




To view them, start SMS and open the 2dm file. Then, from either the SMS menu or by dragging into the SMS window, open the dat files. There are a range of display options in SMS; the following display shows a longitudinal profile of water depths throughout the simulation. To do this, a feature arc needs to be created in the Map module (the type of this coverage needs to be “Observation”). Then, the “Display” – “Plot wizard” menu is used. See the SMS manual for advice on viewing results files.


Inclusion of Salinity

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

Note: Licensing enabling the TUFLOW FV AD Module is required to model salinity.

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 Include salinity as a model parameter (the first number = 1), but decoupled from the density simulations (the second number = 0).

! Flow along a trapezoidal channel + AD


include salinity == 1,0

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

Scalar mixing model == constant
Global horizontal scalar diffusivity == 1

geometry 2d == ..\geo\quick tutorial.2dm

material == 1
bottom roughness == 0.018
end material

initial water level == -3.5

Initial Salinity == 0 The initial concentration is 0.

! BOUNDARY CONDITIONS An additional column in the boundary condition files is required, specifying the concentration at the boundary. the new boundary condition has been renamed as version 02.

bc == Q, 1, ..\bc\steadyQ_002.csv
bc header == time,flow,Sal
Sub-type == 4
end bc
bc == WL, 2, ..\bc\steadyWL_02.csv
bc header == time,WL,Sal
end bc

bc == QC, 240,55, ..\bc\cellQ_02.csv 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 header == Time,flow,Sal
end bc

! OUTPUT COMMANDS An additional output parameter is specified (Sal).
output dir == ..\Output\
output == datv
Output Parameters == h,v,d,Sal
Output Interval == 600
end output

Update Boundary Condition Files

The updated flow boundary (called “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 (called “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 (called “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

View Results

The output file with concentrations will have the extension “_SAL.dat”:


The results view in SMS should look something similar to the following:


Going Further

Model Topography Modification

For modellers with a firm grasp of the basics of modelling, the best way to learn how to setup and run TUFLOW FV is to experiment. In the following example, the mesh has been adjusted 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.

The results are far more interesting using this mesh design. The SMS Map, Scatter and Mesh data associated with this model can be downloaded from the TUFLOW website: http://www.tuflow.com/FV%20TutorialModel.aspx

The model inputs and results have the suffix '03' in their file name.




Note: When viewing model results in SMS it is required that the associated '2dm' file be opened first. Using SMS, skipping this step with either result in:

  • a data load error (if the number of vertices/points/elements in the result file do not match that in the 2dm file); or alternatively
  • the results dataset will load though not be displayed correctly. This display error occurs due to the number of vertices/points/elements in the result file matching the 2dm file, though the spatial location of the vertices/points/elements not matching.

Model Resolution Update

Try doubling the resolution of the model. What happens to the model simulation time when the model resolution is increased to cells with the following dimensions: 6.25 m across the channel and 12.5 m along the channel?

Halving the cell size results in 4 times the number of cells and a halving of the model timestep (required to meet the Courant criteria limits which calculate the model timestep). As such, halving the full model domain resolution results in an 8 fold increase in simulation time. This result highlights one of the benefits in using the TUFLOW FV flexible mesh model structure, where model resolution refinements can be varied spatially (ie. not applied globally over the entire model). This model structure reduces the overall number of computation cells within a model and increases the simulation runtime efficiency.


This section contains a link to 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

For further support please email support@tuflow.com